tests: lib: cmsis_dsp: statistics: Update F32 tests for 1.9.0
This commit updates the statistics F32 test patterns and implementations for the CMSIS-DSP 1.9.0. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
parent
d744019229
commit
5d42316047
2 changed files with 150 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Stephanos Ioannidis <root@stephanos.io>
|
||||
* Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021 Stephanos Ioannidis <root@stephanos.io>
|
||||
* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -75,6 +75,48 @@ DEFINE_TEST_VARIANT3(arm_min_f32, 3, in_com1, 0, 3);
|
|||
DEFINE_TEST_VARIANT3(arm_min_f32, 8, in_com1, 1, 8);
|
||||
DEFINE_TEST_VARIANT3(arm_min_f32, 11, in_com1, 2, 11);
|
||||
|
||||
static void test_arm_absmax_f32(
|
||||
const uint32_t *input1, int ref_index, size_t length)
|
||||
{
|
||||
float32_t val;
|
||||
uint32_t index;
|
||||
|
||||
/* Run test function */
|
||||
arm_absmax_f32((float32_t *)input1, length, &val, &index);
|
||||
|
||||
/* Validate output */
|
||||
zassert_equal(val, ((float32_t *)ref_absmax_val)[ref_index],
|
||||
ASSERT_MSG_INCORRECT_COMP_RESULT);
|
||||
|
||||
zassert_equal(index, ref_absmax_idx[ref_index],
|
||||
ASSERT_MSG_INCORRECT_COMP_RESULT);
|
||||
}
|
||||
|
||||
DEFINE_TEST_VARIANT3(arm_absmax_f32, 3, in_absminmax, 0, 3);
|
||||
DEFINE_TEST_VARIANT3(arm_absmax_f32, 8, in_absminmax, 1, 8);
|
||||
DEFINE_TEST_VARIANT3(arm_absmax_f32, 11, in_absminmax, 2, 11);
|
||||
|
||||
static void test_arm_absmin_f32(
|
||||
const uint32_t *input1, int ref_index, size_t length)
|
||||
{
|
||||
float32_t val;
|
||||
uint32_t index;
|
||||
|
||||
/* Run test function */
|
||||
arm_absmin_f32((float32_t *)input1, length, &val, &index);
|
||||
|
||||
/* Validate output */
|
||||
zassert_equal(val, ((float32_t *)ref_absmin_val)[ref_index],
|
||||
ASSERT_MSG_INCORRECT_COMP_RESULT);
|
||||
|
||||
zassert_equal(index, ref_absmin_idx[ref_index],
|
||||
ASSERT_MSG_INCORRECT_COMP_RESULT);
|
||||
}
|
||||
|
||||
DEFINE_TEST_VARIANT3(arm_absmin_f32, 3, in_absminmax, 0, 3);
|
||||
DEFINE_TEST_VARIANT3(arm_absmin_f32, 8, in_absminmax, 1, 8);
|
||||
DEFINE_TEST_VARIANT3(arm_absmin_f32, 11, in_absminmax, 2, 11);
|
||||
|
||||
static void test_arm_mean_f32(
|
||||
const uint32_t *input1, int ref_index, size_t length)
|
||||
{
|
||||
|
@ -403,6 +445,12 @@ void test_statistics_f32(void)
|
|||
ztest_unit_test(test_arm_min_f32_3),
|
||||
ztest_unit_test(test_arm_min_f32_8),
|
||||
ztest_unit_test(test_arm_min_f32_11),
|
||||
ztest_unit_test(test_arm_absmax_f32_3),
|
||||
ztest_unit_test(test_arm_absmax_f32_8),
|
||||
ztest_unit_test(test_arm_absmax_f32_11),
|
||||
ztest_unit_test(test_arm_absmin_f32_3),
|
||||
ztest_unit_test(test_arm_absmin_f32_8),
|
||||
ztest_unit_test(test_arm_absmin_f32_11),
|
||||
ztest_unit_test(test_arm_mean_f32_3),
|
||||
ztest_unit_test(test_arm_mean_f32_8),
|
||||
ztest_unit_test(test_arm_mean_f32_11),
|
||||
|
|
106
tests/lib/cmsis_dsp/statistics/src/f32.pat
generated
106
tests/lib/cmsis_dsp/statistics/src/f32.pat
generated
|
@ -154,6 +154,84 @@ static const uint32_t in_com2[300] = {
|
|||
0x3f0f6752, 0x3c974956, 0x3e146287, 0x3c247ff1
|
||||
};
|
||||
|
||||
static const uint32_t in_absminmax[300] = {
|
||||
0x3ef3ab91, 0x3df2ff46, 0xbf800000, 0xbe5a37f3,
|
||||
0xbea44cd6, 0x3f11281c, 0xbec117b5, 0xbde5c8d5,
|
||||
0x3f07891d, 0xbf165fb6, 0x3b924435, 0xbe8a46f0,
|
||||
0x3e1302e3, 0xbd919f89, 0x3de0ace2, 0xbdce1c4c,
|
||||
0x3f00d3ed, 0x3e44b7fc, 0x3c5d8b2c, 0xbe3c5a47,
|
||||
0x3ed44f30, 0xbcdc07a0, 0xbda0113b, 0xbf28a42d,
|
||||
0xbcf9e8c0, 0x3d8b5d77, 0x3ca7fbc9, 0xbea45b4b,
|
||||
0xbf01a24d, 0xbe8ab044, 0xbd4b8dc5, 0xbd80245f,
|
||||
0x3f0cac2c, 0x3dbd7a82, 0xbe0eadca, 0x3ec2b8d1,
|
||||
0x3da11fcc, 0xbe37d763, 0xbd094b8c, 0x3f21c421,
|
||||
0xbf2d2b56, 0x3dea1353, 0x3e302fec, 0xbf2d42e2,
|
||||
0x3dedfa0c, 0xbe8b0bb0, 0xbe54e5ae, 0x3f4ac262,
|
||||
0x3e80cecd, 0x3bc34925, 0xbda29e73, 0xbec211a9,
|
||||
0x3d652b45, 0xbe9dbb85, 0xbd918a4f, 0x3e10c271,
|
||||
0x3eca541b, 0x3f0d4c9a, 0x3daf42f7, 0x3f07496a,
|
||||
0xbc0ac3d2, 0x3e5efb3e, 0xbf00284c, 0x3f4a26ac,
|
||||
0xbdc0df81, 0xbda2c723, 0x3da76baf, 0xbed53fb5,
|
||||
0xbe944864, 0xbc4f9c64, 0x3ee27a29, 0x3eca8cee,
|
||||
0x3e9b6497, 0x3f161071, 0x3e8bd133, 0x3e92af0e,
|
||||
0x3d989d6d, 0xbde2d213, 0xbe8a4b34, 0xbe97e4a5,
|
||||
0xbdd73877, 0x3e937707, 0x3e44f1b0, 0x3f0b3daf,
|
||||
0x3e435a39, 0xbd41e4d1, 0xbdae63c9, 0x3dae76f2,
|
||||
0xbefe642f, 0xbf51245c, 0x3ecf7d8e, 0x3e1cf991,
|
||||
0xbc2c4702, 0xbef90c81, 0xbe81ee81, 0x3e47ab60,
|
||||
0xbf13b9f2, 0x3ef54366, 0x3e1a4124, 0xbe015233,
|
||||
0x3ee107e3, 0x3e22cc6c, 0xbd9cfb71, 0x3eaa6968,
|
||||
0x3f79ae34, 0x3eecca27, 0x3ddeb128, 0x3f32a81e,
|
||||
0x3e73bd1b, 0xbf3ea1ac, 0x3d30cfb1, 0x3e62a641,
|
||||
0x3d803173, 0xbdee641d, 0x3dfd3329, 0xbf708e36,
|
||||
0x3d74d922, 0x3da6fe3c, 0x3e9f5e3f, 0x3cfcfcfd,
|
||||
0xbe8a6bf8, 0xbecad955, 0x3cb302a4, 0x3c253d76,
|
||||
0x3ee2aa05, 0xbe22c5b5, 0x3f43d02b, 0xbe86c8d7,
|
||||
0x3cfe2d3e, 0x3c451897, 0xbf4a2220, 0x3f13ceb4,
|
||||
0xbeb3e5e3, 0x3ec282c7, 0xbc82e53a, 0x3d32f6f7,
|
||||
0xbd280d9c, 0x3e61ef34, 0xbf27c8b0, 0xbd197fff,
|
||||
0x3da3ee62, 0x3e41d3a6, 0x3e189007, 0x3dabbed0,
|
||||
0x3def46c0, 0x3e3710ab, 0x3eb1d4cf, 0xbee5e1b7,
|
||||
0xbf0b1447, 0x3e07acdf, 0x3cbed9fa, 0x3e99990e,
|
||||
0xbd63c141, 0xbf154c43, 0xbec1955c, 0x3e82cc3d,
|
||||
0xbf16ad99, 0x3dd1d63f, 0xbe2c3c24, 0x3e577b5d,
|
||||
0xbecd2f77, 0x3e0d798a, 0x3e00d309, 0x3ebdfff5,
|
||||
0xbeda21c9, 0xbeda842e, 0x3eb06370, 0xbee491bb,
|
||||
0x3ef104b8, 0x3c5305de, 0xbe8978b9, 0x3e23f943,
|
||||
0x3e18bc9a, 0x3e225c02, 0xbefcbcf8, 0x3e1f5491,
|
||||
0xbe349b3d, 0x3e8a3a9c, 0x3f178eeb, 0x3e70277a,
|
||||
0xbf0c133b, 0x3e716787, 0xbf4c8a05, 0x3f06cf8a,
|
||||
0xbe459b4b, 0x3e752a31, 0xbe077185, 0xbe937eaa,
|
||||
0xbe1d5971, 0xbe6edad0, 0xbe6559c3, 0x3f1544cf,
|
||||
0x3e126af6, 0xbd99693d, 0x3d928e81, 0xbf048c0d,
|
||||
0x3aa8d505, 0x3ea0d19d, 0xbd14d14b, 0xbf0fb4e3,
|
||||
0x3e1da0d2, 0xbf0e07d2, 0x3a933a83, 0xbc54288e,
|
||||
0xbeefe8a3, 0x3d53daeb, 0x3db60bcd, 0xbdc411ac,
|
||||
0xbe9bba1b, 0xbdbaeea9, 0x3edb223b, 0x3d9aa2b6,
|
||||
0xbe911a70, 0xbee057f6, 0x3bdff3b0, 0xbe7a6ffa,
|
||||
0x3f06643e, 0x3ee54601, 0xbedb0374, 0x3d844045,
|
||||
0x3e6c7cc6, 0xbec212e3, 0x3ebd58d8, 0xbf33e2e1,
|
||||
0xbdb169e2, 0x3f21eab7, 0xbea3a7f1, 0xbee392c5,
|
||||
0x3dca0484, 0x3e9177f6, 0x3eaf7c43, 0x3d01b724,
|
||||
0xbe9a1cb7, 0x3f22a6fb, 0x3e7ffab2, 0x3dbe27ac,
|
||||
0x3f47026f, 0x3e9d3376, 0x3e86beb1, 0x3d0a76c9,
|
||||
0x3eba7f75, 0xbe3dc9db, 0xbcc3cd49, 0xbbb68807,
|
||||
0xbee38df5, 0x3f08f9b9, 0x3e8bd602, 0xbf29dd24,
|
||||
0x3f04eaf8, 0x3c84ffff, 0x3bc3527b, 0x3f0c8aaf,
|
||||
0x3eb36991, 0xbf12dd6c, 0x3c9436d9, 0x3da1089e,
|
||||
0xbea988c8, 0x3e808bd5, 0xbc0c17bc, 0xbe2238a2,
|
||||
0xbe609ee3, 0xbe9cda02, 0x3f2bb82b, 0xbc1265fa,
|
||||
0x3d95e72a, 0x3ec21291, 0x3ec7085d, 0x3d93a71f,
|
||||
0x3e33fc9e, 0x3e652296, 0xbe46373e, 0x3e981c93,
|
||||
0xbf55e5ff, 0x3a501a27, 0xbdbd36d6, 0x3e6e8ffd,
|
||||
0xbd97176d, 0x3e2b7889, 0xbde7fa58, 0x3e6bb1a6,
|
||||
0xbd22cf1d, 0x3d1b91ec, 0x3dce62af, 0xbedbda9f,
|
||||
0x3dc4ecbe, 0xbf222ba0, 0xbc772d9c, 0x3e838e96,
|
||||
0xbce173a9, 0x3d27120c, 0xbddc9ba8, 0xbf353898,
|
||||
0x3e114d87, 0xbe3dab47, 0xbe5037fb, 0x3ea773f0,
|
||||
0x3e91d7da, 0x3e834dc8, 0x3dbd7686, 0xbf4865e4
|
||||
};
|
||||
|
||||
static const uint32_t in_entropy[75] = {
|
||||
0x3e0ea458, 0x3e795925, 0x3f1e00a1, 0x3e4f7780,
|
||||
0x3db87026, 0x3e4f3a51, 0x3d9f777b, 0x3e308756,
|
||||
|
@ -176,7 +254,7 @@ static const uint32_t in_entropy[75] = {
|
|||
0x3dd6b355, 0x3e303cfd, 0x3d8844cc
|
||||
};
|
||||
|
||||
static const q15_t in_entropy_dim[11] = {
|
||||
static const uint16_t in_entropy_dim[11] = {
|
||||
0x000A, 0x0003, 0x0008, 0x0009, 0x000C, 0x0003, 0x0008, 0x0009,
|
||||
0x000C, 0x0003, 0x0008
|
||||
};
|
||||
|
@ -203,7 +281,7 @@ static const uint32_t in_logsumexp[75] = {
|
|||
0x3d0227b4, 0x3da99d58, 0x3de9c121
|
||||
};
|
||||
|
||||
static const q15_t in_logsumexp_dim[11] = {
|
||||
static const uint16_t in_logsumexp_dim[11] = {
|
||||
0x000A, 0x0003, 0x0008, 0x0009, 0x000C, 0x0003, 0x0008, 0x0009,
|
||||
0x000C, 0x0003, 0x0008
|
||||
};
|
||||
|
@ -252,7 +330,7 @@ static const uint32_t in_kl2[75] = {
|
|||
0x3e43c6a2, 0x3d2f3871, 0x3d184fc4
|
||||
};
|
||||
|
||||
static const q15_t in_kl_dim[11] = {
|
||||
static const uint16_t in_kl_dim[11] = {
|
||||
0x000A, 0x0003, 0x0008, 0x0009, 0x000C, 0x0003, 0x0008, 0x0009,
|
||||
0x000C, 0x0003, 0x0008
|
||||
};
|
||||
|
@ -301,7 +379,7 @@ static const uint32_t in_logsumexp_dp2[75] = {
|
|||
0xc0071029, 0xbfbec850, 0xbfb3688d
|
||||
};
|
||||
|
||||
static const q15_t in_logsumexp_dp_dim[11] = {
|
||||
static const uint16_t in_logsumexp_dp_dim[11] = {
|
||||
0x000A, 0x0003, 0x0008, 0x0009, 0x000C, 0x0003, 0x0008, 0x0009,
|
||||
0x000C, 0x0003, 0x0008
|
||||
};
|
||||
|
@ -310,7 +388,7 @@ static const uint32_t ref_max_val[3] = {
|
|||
0x3dfc25f1, 0x3eb17541, 0x3f190cff
|
||||
};
|
||||
|
||||
static const q15_t ref_max_idx[3] = {
|
||||
static const uint16_t ref_max_idx[3] = {
|
||||
0x0002, 0x0004, 0x0008
|
||||
};
|
||||
|
||||
|
@ -318,10 +396,26 @@ static const uint32_t ref_min_val[3] = {
|
|||
0xbec16557, 0xbf196cae, 0xbf196cae
|
||||
};
|
||||
|
||||
static const q15_t ref_min_idx[3] = {
|
||||
static const uint16_t ref_min_idx[3] = {
|
||||
0x0000, 0x0005, 0x0005
|
||||
};
|
||||
|
||||
static const uint32_t ref_absmax_val[3] = {
|
||||
0x3f800000, 0x3f800000, 0x3f800000
|
||||
};
|
||||
|
||||
static const uint16_t ref_absmax_idx[3] = {
|
||||
0x0002, 0x0002, 0x0002
|
||||
};
|
||||
|
||||
static const uint32_t ref_absmin_val[3] = {
|
||||
0x3df2ff46, 0x3de5c8d5, 0x3b924435
|
||||
};
|
||||
|
||||
static const uint16_t ref_absmin_idx[3] = {
|
||||
0x0001, 0x0007, 0x000A
|
||||
};
|
||||
|
||||
static const uint32_t ref_mean[4] = {
|
||||
0x3e929d51, 0x3e91006a, 0x3e97c39e, 0x3e807cf8
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue