sof/test/cmocka/include/power_tables.h

156 lines
9.6 KiB
C
Raw Normal View History

/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2021 Intel Corporation. All rights reserved.
*
* Author: Shriram Shastry <malladi.sastry@linux.intel.com>
*/
/* Include Files */
#include <string.h>
/* Reference table generated by Matlab power() */
static const double power_table[64][6] = {
{-1.0000000000000000, 1.0000000000000000, -1.0000000000000000
, -1.0000000000000000, 1.0000000000000000, -1.0000000000000000},
{-0.5000000000000000, 0.2500000000000000, -0.1250000000000000
, -2.0000000000000000, 4.0000000000000000, -8.0000000000000000},
{-0.3333333333333333, 0.1111111111111111, -0.0370370370370370
, -3.0000000000000000, 9.0000000000000000, -27.0000000000000000},
{-0.2500000000000000, 0.0625000000000000, -0.0156250000000000
, -4.0000000000000000, 16.0000000000000000, -64.0000000000000000},
{-0.2000000000000000, 0.0400000000000000, -0.0080000000000000
, -5.0000000000000000, 25.0000000000000000, -125.0000000000000000},
{-0.1666666666666667, 0.0277777777777778, -0.0046296296296296
, -6.0000000000000000, 36.0000000000000000, -216.0000000000000000},
{-0.1428571428571428, 0.0204081632653061, -0.0029154518950437
, -7.0000000000000000, 49.0000000000000000, -343.0000000000000000},
{-0.1250000000000000, 0.0156250000000000, -0.0019531250000000
, -8.0000000000000000, 64.0000000000000000, -512.0000000000000000},
{-0.1111111111111111, 0.0123456790123457, -0.0013717421124829
, -9.0000000000000000, 81.0000000000000000, -729.0000000000000000},
{-0.1000000000000000, 0.0100000000000000, -0.0010000000000000
, -10.0000000000000000, 100.0000000000000000, -1000.0000000000000000},
{-0.0909090909090909, 0.0082644628099174, -0.0007513148009016
, -11.0000000000000000, 121.0000000000000000, -1331.0000000000000000},
{-0.0833333333333333, 0.0069444444444444, -0.0005787037037037
, -12.0000000000000000, 144.0000000000000000, -1728.0000000000000000},
{-0.0769230769230769, 0.0059171597633136, -0.0004551661356395
, -13.0000000000000000, 169.0000000000000000, -2197.0000000000000000},
{-0.0714285714285714, 0.0051020408163265, -0.0003644314868805
, -14.0000000000000000, 196.0000000000000000, -2744.0000000000000000},
{-0.0666666666666667, 0.0044444444444444, -0.0002962962962963
, -15.0000000000000000, 225.0000000000000000, -3375.0000000000000000},
{-0.0625000000000000, 0.0039062500000000, -0.0002441406250000
, -16.0000000000000000, 256.0000000000000000, -4096.0000000000000000},
{-0.0588235294117647, 0.0034602076124567, -0.0002035416242622
, -17.0000000000000000, 289.0000000000000000, -4913.0000000000000000},
{-0.0555555555555556, 0.0030864197530864, -0.0001714677640604
, -18.0000000000000000, 324.0000000000000000, -5832.0000000000000000},
{-0.0526315789473684, 0.0027700831024931, -0.0001457938474996
, -19.0000000000000000, 361.0000000000000000, -6859.0000000000000000},
{-0.0500000000000000, 0.0025000000000000, -0.0001250000000000
, -20.0000000000000000, 400.0000000000000000, -8000.0000000000000000},
{-0.0476190476190476, 0.0022675736961451, -0.0001079796998164
, -21.0000000000000000, 441.0000000000000000, -9261.0000000000000000},
{-0.0454545454545455, 0.0020661157024793, -0.0000939143501127
, -22.0000000000000000, 484.0000000000000000, -10648.0000000000000000},
{-0.0434782608695652, 0.0018903591682420, -0.0000821895290540
, -23.0000000000000000, 529.0000000000000000, -12167.0000000000000000},
{-0.0416666666666667, 0.0017361111111111, -0.0000723379629630
, -24.0000000000000000, 576.0000000000000000, -13824.0000000000000000},
{-0.0400000000000000, 0.0016000000000000, -0.0000640000000000
, -25.0000000000000000, 625.0000000000000000, -15625.0000000000000000},
{-0.0384615384615385, 0.0014792899408284, -0.0000568957669549
, -26.0000000000000000, 676.0000000000000000, -17576.0000000000000000},
{-0.0370370370370370, 0.0013717421124829, -0.0000508052634253
, -27.0000000000000000, 729.0000000000000000, -19683.0000000000000000},
{-0.0357142857142857, 0.0012755102040816, -0.0000455539358601
, -28.0000000000000000, 784.0000000000000000, -21952.0000000000000000},
{-0.0344827586206897, 0.0011890606420927, -0.0000410020911066
, -29.0000000000000000, 841.0000000000000000, -24389.0000000000000000},
{-0.0333333333333333, 0.0011111111111111, -0.0000370370370370
, -30.0000000000000000, 900.0000000000000000, -27000.0000000000000000},
{-0.0322580645161290, 0.0010405827263267, -0.0000335671847202
, -31.0000000000000000, 961.0000000000000000, -29791.0000000000000000},
{-0.0312500000000000, 0.0009765625000000, -0.0000305175781250
, -32.0000000000000000, 1024.0000000000000000, -32768.0000000000000000},
{1.0000000000000000, 1.0000000000000000, 1.0000000000000000
, 1.0000000000000000, 1.0000000000000000, 1.0000000000000000},
{0.5000000000000000, 0.2500000000000000, 0.1250000000000000
, 2.0000000000000000, 4.0000000000000000, 8.0000000000000000},
{0.3333333333333333, 0.1111111111111111, 0.0370370370370370
, 3.0000000000000000, 9.0000000000000000, 27.0000000000000000},
{0.2500000000000000, 0.0625000000000000, 0.0156250000000000
, 4.0000000000000000, 16.0000000000000000, 64.0000000000000000},
{0.2000000000000000, 0.0400000000000000, 0.0080000000000000
, 5.0000000000000000, 25.0000000000000000, 125.0000000000000000},
{0.1666666666666667, 0.0277777777777778, 0.0046296296296296
, 6.0000000000000000, 36.0000000000000000, 216.0000000000000000},
{0.1428571428571428, 0.0204081632653061, 0.0029154518950437
, 7.0000000000000000, 49.0000000000000000, 343.0000000000000000},
{0.1250000000000000, 0.0156250000000000, 0.0019531250000000
, 8.0000000000000000, 64.0000000000000000, 512.0000000000000000},
{0.1111111111111111, 0.0123456790123457, 0.0013717421124829
, 9.0000000000000000, 81.0000000000000000, 729.0000000000000000},
{0.1000000000000000, 0.0100000000000000, 0.0010000000000000
, 10.0000000000000000, 100.0000000000000000, 1000.0000000000000000},
{0.0909090909090909, 0.0082644628099174, 0.0007513148009016
, 11.0000000000000000, 121.0000000000000000, 1331.0000000000000000},
{0.0833333333333333, 0.0069444444444444, 0.0005787037037037
, 12.0000000000000000, 144.0000000000000000, 1728.0000000000000000},
{0.0769230769230769, 0.0059171597633136, 0.0004551661356395
, 13.0000000000000000, 169.0000000000000000, 2197.0000000000000000},
{0.0714285714285714, 0.0051020408163265, 0.0003644314868805
, 14.0000000000000000, 196.0000000000000000, 2744.0000000000000000},
{0.0666666666666667, 0.0044444444444444, 0.0002962962962963
, 15.0000000000000000, 225.0000000000000000, 3375.0000000000000000},
{0.0625000000000000, 0.0039062500000000, 0.0002441406250000
, 16.0000000000000000, 256.0000000000000000, 4096.0000000000000000},
{0.0588235294117647, 0.0034602076124567, 0.0002035416242622
, 17.0000000000000000, 289.0000000000000000, 4913.0000000000000000},
{0.0555555555555556, 0.0030864197530864, 0.0001714677640604
, 18.0000000000000000, 324.0000000000000000, 5832.0000000000000000},
{0.0526315789473684, 0.0027700831024931, 0.0001457938474996
, 19.0000000000000000, 361.0000000000000000, 6859.0000000000000000},
{0.0500000000000000, 0.0025000000000000, 0.0001250000000000
, 20.0000000000000000, 400.0000000000000000, 8000.0000000000000000},
{0.0476190476190476, 0.0022675736961451, 0.0001079796998164
, 21.0000000000000000, 441.0000000000000000, 9261.0000000000000000},
{0.0454545454545455, 0.0020661157024793, 0.0000939143501127
, 22.0000000000000000, 484.0000000000000000, 10648.0000000000000000},
{0.0434782608695652, 0.0018903591682420, 0.0000821895290540
, 23.0000000000000000, 529.0000000000000000, 12167.0000000000000000},
{0.0416666666666667, 0.0017361111111111, 0.0000723379629630
, 24.0000000000000000, 576.0000000000000000, 13824.0000000000000000},
{0.0400000000000000, 0.0016000000000000, 0.0000640000000000
, 25.0000000000000000, 625.0000000000000000, 15625.0000000000000000},
{0.0384615384615385, 0.0014792899408284, 0.0000568957669549
, 26.0000000000000000, 676.0000000000000000, 17576.0000000000000000},
{0.0370370370370370, 0.0013717421124829, 0.0000508052634253
, 27.0000000000000000, 729.0000000000000000, 19683.0000000000000000},
{0.0357142857142857, 0.0012755102040816, 0.0000455539358601
, 28.0000000000000000, 784.0000000000000000, 21952.0000000000000000},
{0.0344827586206897, 0.0011890606420927, 0.0000410020911066
, 29.0000000000000000, 841.0000000000000000, 24389.0000000000000000},
{0.0333333333333333, 0.0011111111111111, 0.0000370370370370
, 30.0000000000000000, 900.0000000000000000, 27000.0000000000000000},
{0.0322580645161290, 0.0010405827263267, 0.0000335671847202
, 31.0000000000000000, 961.0000000000000000, 29791.0000000000000000},
{0.0312500000000000, 0.0009765625000000, 0.0000305175781250
, 32.0000000000000000, 1024.0000000000000000, 32768.0000000000000000}};
/* base testvector */
static const int32_t b[64] = {
-33554432, -67108864, -100663296, -134217728, -167772160, -201326592, -234881024,
-268435456, -301989888, -335544320, -369098752, -402653184, -436207616, -469762048,
-503316480, -536870912, -570425344, -603979776, -637534208, -671088640, -704643072,
-738197504, -771751936, -805306368, -838860800, -872415232, -905969664, -939524096,
-973078528, -1006632960, -1040187392, -1073741824, 33554432, 67108864, 100663296,
134217728, 167772160, 201326592, 234881024, 268435456, 301989888, 335544320,
369098752, 402653184, 436207616, 469762048, 503316480, 536870912, 570425344,
603979776, 637534208, 671088640, 704643072, 738197504, 771751936, 805306368,
838860800, 872415232, 905969664, 939524096, 973078528, 1006632960, 1040187392,
1073741824};
/* exponent testvector */
static const int32_t e[6] = {-536870912, -1073741824, -1610612736,
536870912, 1073741824, 1610612736};