CMSIS-DSP: Scalar version for arm_vlog_q31

Added scalar version of arm_vlog_q15

Updated PythonWrapper with vlog q31 and q15
Corrected small compilation issue with AC5 compiler.
pull/19/head
Christophe Favergeon 5 years ago
parent 3879adccd7
commit 840a233053

@ -148,6 +148,31 @@ extern "C"
float32_t * pDst,
uint32_t blockSize);
/**
* @brief q31 vector of log values.
* @param[in] pSrc points to the input vector in q31
* @param[out] pDst points to the output vector in q5.26
* @param[in] blockSize number of samples in each vector
* @return none
*/
void arm_vlog_q31(const q31_t * pSrc,
q31_t * pDst,
uint32_t blockSize);
/**
* @brief q15 vector of log values.
* @param[in] pSrc points to the input vector in q15
* @param[out] pDst points to the output vector in q4.11
* @param[in] blockSize number of samples in each vector
* @return none
*/
void arm_vlog_q15(const q15_t * pSrc,
q15_t * pDst,
uint32_t blockSize);
/**
@brief Floating-point vector of exp values.
@param[in] pSrc points to the input vector

@ -66,6 +66,17 @@ Now, you can install the cmsisdsp package in editable mode:
Then you can copy the scripts testdsp.py and example.py and try to run them from this virtual environment. example.y is requiring a data file to be downloaded from the web. See below in this document for the link.
It is also possible to compile and install directly from a Jupyter notebook by doing something like:
!pip install git+https://github.com/ARM-software/
CMSIS_5.git@5.8.0#egg=CMSISDSP\&subdirectory=CMSIS/DSP/PythonWrapper
This will download, compile and install the PythonWrapper from the version 5.8.0 of the CMSIS-DSP (so not from the develop branch).
It will work only if the compiler can be found and run from Jupyter.
Note that due to the great number of possible configurations (OS, Compiler, Python), we can't give any support if you have problems compiling the PythonWrapper on your specific configuration. But, generally people manage to do it and solve all the problems.
# Usage
You can look at testdsp.py and example.py for some examples.

@ -9867,6 +9867,37 @@ cmsis_arm_abs_q15(PyObject *obj, PyObject *args)
return(NULL);
}
static PyObject *
cmsis_arm_vlog_q15(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q15_t *pSrc_converted=NULL; // input
q15_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT16,int16_t,int16_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q15_t)*blockSize);
arm_vlog_q15(pSrc_converted,pDst,blockSize);
INT16ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
static PyObject *
cmsis_arm_abs_q31(PyObject *obj, PyObject *args)
@ -9899,6 +9930,37 @@ cmsis_arm_abs_q31(PyObject *obj, PyObject *args)
return(NULL);
}
static PyObject *
cmsis_arm_vlog_q31(PyObject *obj, PyObject *args)
{
PyObject *pSrc=NULL; // input
q31_t *pSrc_converted=NULL; // input
q31_t *pDst=NULL; // output
uint32_t blockSize; // input
if (PyArg_ParseTuple(args,"O",&pSrc))
{
GETARGUMENT(pSrc,NPY_INT32,int32_t,int32_t);
blockSize = arraySizepSrc ;
pDst=PyMem_Malloc(sizeof(q31_t)*blockSize);
arm_vlog_q31(pSrc_converted,pDst,blockSize);
INT32ARRAY1(pDstOBJ,blockSize,pDst);
PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);
FREEARGUMENT(pSrc_converted);
Py_DECREF(pDstOBJ);
return(pythonResult);
}
return(NULL);
}
#define FLOATDIST(NAME) \
static PyObject * \
cmsis_arm_##NAME##_f32(PyObject *obj, PyObject *args) \
@ -13700,21 +13762,25 @@ cmsis_arm_sin_cos_f32(PyObject *obj, PyObject *args)
{
float32_t theta; // input
PyObject *pSinVal=NULL; // input
float32_t *pSinVal_converted=NULL; // input
PyObject *pCosVal=NULL; // input
float32_t *pCosVal_converted=NULL; // input
float32_t pS;
float32_t pC;
if (PyArg_ParseTuple(args,"fOO",&theta,&pSinVal,&pCosVal))
if (PyArg_ParseTuple(args,"f",&theta))
{
GETARGUMENT(pSinVal,NPY_DOUBLE,double,float32_t);
GETARGUMENT(pCosVal,NPY_DOUBLE,double,float32_t);
arm_sin_cos_f32(theta,pSinVal_converted,pCosVal_converted);
FREEARGUMENT(pSinVal_converted);
FREEARGUMENT(pCosVal_converted);
Py_RETURN_NONE;
arm_sin_cos_f32(theta,&pS,&pC);
PyObject* retS=Py_BuildValue("f",pS);
PyObject* retC=Py_BuildValue("f",pC);
PyObject *pythonResult = Py_BuildValue("OO",retS,retC);
Py_DECREF(retS);
Py_DECREF(retC);
return(pythonResult);
}
return(NULL);
@ -13726,21 +13792,23 @@ cmsis_arm_sin_cos_q31(PyObject *obj, PyObject *args)
{
q31_t theta; // input
PyObject *pSinVal=NULL; // input
q31_t *pSinVal_converted=NULL; // input
PyObject *pCosVal=NULL; // input
q31_t *pCosVal_converted=NULL; // input
q31_t pS;
q31_t pC;
if (PyArg_ParseTuple(args,"iOO",&theta,&pSinVal,&pCosVal))
if (PyArg_ParseTuple(args,"i",&theta))
{
GETARGUMENT(pSinVal,NPY_INT32,int32_t,int32_t);
GETARGUMENT(pCosVal,NPY_INT32,int32_t,int32_t);
arm_sin_cos_q31(theta,&pS,&pC);
PyObject* retS=Py_BuildValue("i",pS);
PyObject* retC=Py_BuildValue("i",pC);
arm_sin_cos_q31(theta,pSinVal_converted,pCosVal_converted);
FREEARGUMENT(pSinVal_converted);
FREEARGUMENT(pCosVal_converted);
Py_RETURN_NONE;
PyObject *pythonResult = Py_BuildValue("OO",retS,retC);
Py_DECREF(retS);
Py_DECREF(retC);
return(pythonResult);
}
return(NULL);
@ -14686,23 +14754,21 @@ cmsis_arm_sqrt_f32(PyObject *obj, PyObject *args)
{
float32_t in; // input
float32_t *pOut=NULL; // output
float32_t pOut; // output
if (PyArg_ParseTuple(args,"f",&in))
{
pOut=PyMem_Malloc(sizeof(float32_t)*1);
arm_status returnValue = arm_sqrt_f32(in,pOut);
arm_status returnValue = arm_sqrt_f32(in,&pOut);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pOutOBJ=Py_BuildValue("f",*pOut);
PyObject* pOutOBJ=Py_BuildValue("f",pOut);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pOutOBJ);
Py_DECREF(theReturnOBJ);
Py_DECREF(pOutOBJ);
return(pythonResult);
}
@ -14715,18 +14781,17 @@ cmsis_arm_sqrt_q31(PyObject *obj, PyObject *args)
{
q31_t in; // input
q31_t *pOut=NULL; // output
q31_t pOut; // output
if (PyArg_ParseTuple(args,"i",&in))
{
pOut=PyMem_Malloc(sizeof(q31_t)*1);
arm_status returnValue = arm_sqrt_q31(in,pOut);
arm_status returnValue = arm_sqrt_q31(in,&pOut);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pOutOBJ=Py_BuildValue("i",*pOut);
PyObject* pOutOBJ=Py_BuildValue("i",pOut);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pOutOBJ);
@ -14744,18 +14809,16 @@ cmsis_arm_sqrt_q15(PyObject *obj, PyObject *args)
{
q15_t in; // input
q15_t *pOut=NULL; // output
q15_t pOut; // output
if (PyArg_ParseTuple(args,"h",&in))
{
pOut=PyMem_Malloc(sizeof(q15_t)*1);
arm_status returnValue = arm_sqrt_q15(in,pOut);
arm_status returnValue = arm_sqrt_q15(in,&pOut);
PyObject* theReturnOBJ=Py_BuildValue("i",returnValue);
PyObject* pOutOBJ=Py_BuildValue("h",*pOut);
PyObject* pOutOBJ=Py_BuildValue("h",pOut);
PyObject *pythonResult = Py_BuildValue("OO",theReturnOBJ,pOutOBJ);
@ -16931,6 +16994,8 @@ static PyMethodDef CMSISMLMethods[] = {
{"arm_abs_f32", cmsis_arm_abs_f32, METH_VARARGS,""},
{"arm_abs_q15", cmsis_arm_abs_q15, METH_VARARGS,""},
{"arm_abs_q31", cmsis_arm_abs_q31, METH_VARARGS,""},
{"arm_vlog_q15", cmsis_arm_vlog_q15, METH_VARARGS,""},
{"arm_vlog_q31", cmsis_arm_vlog_q31, METH_VARARGS,""},
{"arm_dot_prod_f32", cmsis_arm_dot_prod_f32, METH_VARARGS,""},
{"arm_dot_prod_q7", cmsis_arm_dot_prod_q7, METH_VARARGS,""},
{"arm_dot_prod_q15", cmsis_arm_dot_prod_q15, METH_VARARGS,""},

@ -0,0 +1,53 @@
import cmsisdsp as dsp
import numpy as np
import fixedpoint as f
# Test vlog q31 and q15
x = np.array([0.9,0.5,2**-16])
r=dsp.arm_vlog_q15(f.toQ15(x))
print(f.Q15toF32(r)*16.0)
print(np.log(x))
print("")
# Test sin_cos
t=20
sinRef=np.sin(t * np.pi / 180)
cosRef=np.cos(t * np.pi / 180)
print(sinRef)
print(cosRef)
s,c=dsp.arm_sin_cos_f32(t)
print(s)
print(c)
s,c=dsp.arm_sin_cos_q31(f.toQ31(t/180.0))
print(f.Q31toF32(s))
print(f.Q31toF32(c))
print("")
# Test sqrt
a=0.6
print(np.sqrt(a))
err,r=dsp.arm_sqrt_f32(a)
print(err,r)
err,r=dsp.arm_sqrt_q31(f.toQ31(a))
print(err,f.Q31toF32(r))
err,r=dsp.arm_sqrt_q15(f.toQ15(a))
print(err,f.Q15toF32(r))
err,r=dsp.arm_sqrt_f32(-a)
print(err,r)
err,r=dsp.arm_sqrt_q31(f.toQ31(-a))
print(err,f.Q31toF32(r))
err,r=dsp.arm_sqrt_q15(f.toQ15(-a))
print(err,f.Q15toF32(r))

@ -5,7 +5,6 @@ project(CMSISDSPFastMath)
include(configLib)
include(configDsp)
file(GLOB SRC "./*_*.c")
add_library(CMSISDSPFastMath STATIC)
configLib(CMSISDSPFastMath ${ROOT})
@ -47,6 +46,10 @@ target_sources(CMSISDSPFastMath PRIVATE arm_sqrt_q31.c)
target_sources(CMSISDSPFastMath PRIVATE arm_vlog_f32.c)
target_sources(CMSISDSPFastMath PRIVATE arm_vexp_f32.c)
target_sources(CMSISDSPFastMath PRIVATE arm_vlog_q31.c)
target_sources(CMSISDSPFastMath PRIVATE arm_vlog_q15.c)
if ((NOT ARMAC5) AND (NOT DISABLEFLOAT16))
target_sources(CMSISDSPFastMath PRIVATE arm_vlog_f16.c)
target_sources(CMSISDSPFastMath PRIVATE arm_vexp_f16.c)

@ -59,4 +59,7 @@
#include "arm_vexp_f32.c"
#include "arm_vlog_f32.c"
#include "arm_divide_q15.c"
#include "arm_vlog_q31.c"
#include "arm_vlog_q15.c"

@ -33,6 +33,15 @@
#include "arm_common_tables.h"
#include "arm_vec_math_f16.h"
/**
@ingroup groupFastMath
*/
/**
@addtogroup vlog
@{
*/
void arm_vlog_f16(
const float16_t * pSrc,
float16_t * pDst,
@ -76,5 +85,10 @@ void arm_vlog_f16(
}
}
/**
@} end of vlog group
*/
#endif /* #if defined(ARM_FLOAT16_SUPPORTED) */

@ -29,6 +29,24 @@
#include "dsp/fast_math_functions.h"
#include "arm_common_tables.h"
/**
@ingroup groupFastMath
*/
/**
@defgroup vlog Vector Log
Compute the log values of a vector of samples.
*/
/**
@addtogroup vlog
@{
*/
#if (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM) || defined(ARM_MATH_NEON) || defined(ARM_MATH_NEON_EXPERIMENTAL)) && !defined(ARM_MATH_AUTOVECTORIZE)
#include "arm_vec_math.h"
#endif
@ -95,3 +113,7 @@ void arm_vlog_f32(
blkCnt--;
}
}
/**
@} end of vlog group
*/

@ -0,0 +1,172 @@
/* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_vlog_q15
* Description: Q15 vector log
*
* $Date: 19 July 2021
* $Revision: V1.10.0
*
* Target Processor: Cortex-M and Cortex-A cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
This is a first attempt at implement a log in Q15
without using an interpolation table since there are
already too many tables in CMSIS-DSP.
But the accuracy is not that great for very small values ...
*/
#include "dsp/fast_math_functions.h"
#define LOG_Q15_ACCURACY 15
/* Bit to represent the normalization factor
It is Ceiling[Log2[LOG_Q15_ACCURACY]] of the previous value.
The Log2 algorithm is assuming that the value x is
1 <= x < 2.
But input value could be as small a 2^-LOG_Q15_ACCURACY
which would give an integer part of -15.
*/
#define LOG_Q15_INTEGER_PART 4
/* 2.0 in Q14 or 0.5 in Q16 */
#define LOQ_Q15_THRESHOLD (1u << LOG_Q15_ACCURACY)
#define LOQ_Q15_Q16_HALF LOQ_Q15_THRESHOLD
#define LOQ_Q15_Q14_HALF (LOQ_Q15_Q16_HALF >> 2)
/* 1.0 / Log2[Exp[1]] in Q15 */
#define LOG_Q15_INVLOG2EXP 0x58b9u
/* Clay Turner algorithm */
static uint16_t arm_scalar_log_q15(uint16_t src)
{
int i;
int32_t c = __CLZ(src)-16;
int16_t normalization=0;
//printf("x q15 = %08X, c = %d\n",src,c);
/* 0.5 in q16 */
uint16_t inc = LOQ_Q15_Q16_HALF;
/* Will compute y = log2(x) for 1 <= x < 2.0 */
uint32_t x;
/* q16 */
uint16_t y=0;
/* q4.24 */
int32_t tmp;
/* Normalize and convert to q314 format */
x = src;
if ((c-1) < 0)
{
x = x >> (1-c);
}
else
{
x = x << (c-1);
}
normalization = c;
//printf("normalization = %d\n",normalization);
//printf("x normalized q14 = %08X\n",x);
/* Compute the Log2. Result is in Q16
because we know 0 <= y < 1.0
*/
for(i = 0; i < LOG_Q15_ACCURACY ; i++)
{
x = ((x*x) + LOQ_Q15_Q14_HALF) >> (LOG_Q15_ACCURACY - 1);
if (x >= LOQ_Q15_THRESHOLD)
{
y += inc ;
x = x >> 1;
}
inc = inc >> 1;
}
//printf("Log2 q16 = %04X\n",y);
/*
Convert the Log2 to Log and apply normalization.
We compute (y - normalisation) * (1 / Log2[e]).
*/
/* q16 */
tmp = y - ((int32_t)normalization << (LOG_Q15_ACCURACY + 1));
//printf("Log2 q16 with normalization = %08X\n",tmp);
/* q12 * q15 -> q27 */
tmp = (tmp>>LOG_Q15_INTEGER_PART) * (int32_t)LOG_Q15_INVLOG2EXP ;
//printf("Log10 q27 = %08X\n",tmp);
/* q4.11 */
y = tmp >> 16;
//printf("Log10 q11 = %04X\n",y);
return(y);
}
/**
@ingroup groupFastMath
*/
/**
@addtogroup vlog
@{
*/
/**
@brief q15 vector of log values.
@param[in] pSrc points to the input vector in q15
@param[out] pDst points to the output vector in q4.11
@param[in] blockSize number of samples in each vector
@return none
*/
void arm_vlog_q15(
const q15_t * pSrc,
q15_t * pDst,
uint32_t blockSize)
{
uint32_t i;
for(i=0;i < blockSize; i++)
{
pDst[i]=arm_scalar_log_q15(pSrc[i]);
}
}
/**
@} end of vlog group
*/

@ -0,0 +1,173 @@
/* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_vlog_q31
* Description: Q31 vector log
*
* $Date: 19 July 2021
* $Revision: V1.10.0
*
* Target Processor: Cortex-M and Cortex-A cores
* -------------------------------------------------------------------- */
/*
* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
This is a first attempt at implement a log in Q31
without using an interpolation table since there are
already too many tables in CMSIS-DSP.
But the accuracy is not that great for very small values ...
*/
#include "dsp/fast_math_functions.h"
#define LOG_Q31_ACCURACY 31
/* Bit to represent the normalization factor
It is Ceiling[Log2[LOG_Q31_ACCURACY]] of the previous value.
The Log2 algorithm is assuming that the value x is
1 <= x < 2.
But input value could be as small a 2^-LOG_Q31_ACCURACY
which would give an integer part of -31.
*/
#define LOG_Q31_INTEGER_PART 5
/* 2.0 in Q30 or 0.5 in Q32 */
#define LOQ_Q31_THRESHOLD (1u << LOG_Q31_ACCURACY)
#define LOQ_Q31_Q32_HALF LOQ_Q31_THRESHOLD
#define LOQ_Q31_Q30_HALF (LOQ_Q31_Q32_HALF >> 2)
/* 1.0 / Log2[Exp[1]] in Q31 */
#define LOG_Q31_INVLOG2EXP 0x58b90bfbuL
/* Clay Turner algorithm */
static uint32_t arm_scalar_log_q31(uint32_t src)
{
int i;
int32_t c = __CLZ(src);
int32_t normalization=0;
//printf("x q31 = %08X\n",src);
/* 0.5 in q32 */
uint32_t inc = LOQ_Q31_Q32_HALF;
/* Will compute y = log2(x) for 1 <= x < 2.0 */
uint64_t x;
/* q32 */
uint32_t y=0;
/* q5.58 */
int64_t tmp;
/* Normalize and convert to q30 format */
x = src;
if ((c-1) < 0)
{
x = x >> (1-c);
}
else
{
x = x << (c-1);
}
normalization = c;
//printf("normalization = %d\n",normalization);
//printf("x normalized q30 = %08llX\n",x);
/* Compute the Log2. Result is in Q32
because we know 0 <= y < 1.0
*/
for(i = 0; i < LOG_Q31_ACCURACY ; i++)
{
x = ((x*x) + LOQ_Q31_Q30_HALF) >> (LOG_Q31_ACCURACY - 1);
if (x >= LOQ_Q31_THRESHOLD)
{
y += inc ;
x = x >> 1;
}
inc = inc >> 1;
}
//printf("Log2 q32 = %08X\n",y);
/*
Convert the Log2 to Log and apply normalization.
We compute (y - normalisation) * (1 / Log2[e]).
*/
/* q32 */
tmp = y - ((int64_t)normalization << (LOG_Q31_ACCURACY + 1));
//printf("Log2 q32 with normalization = %016llX\n",tmp);
/* q27 * q31 -> q58 */
tmp = (tmp>>LOG_Q31_INTEGER_PART) * (int64_t)LOG_Q31_INVLOG2EXP ;
//printf("Log10 q58 = %016llX\n",tmp);
/* q5.26 */
y = tmp >> 32;
//printf("Log10 q25 = %08X\n",y);
return(y);
}
/**
@ingroup groupFastMath
*/
/**
@addtogroup vlog
@{
*/
/**
@brief q31 vector of log values.
@param[in] pSrc points to the input vector in q31
@param[out] pDst points to the output vector q5.26
@param[in] blockSize number of samples in each vector
@return none
*/
void arm_vlog_q31(
const q31_t * pSrc,
q31_t * pDst,
uint32_t blockSize)
{
uint32_t i;
for(i=0;i < blockSize; i++)
{
pDst[i]=arm_scalar_log_q31(pSrc[i]);
}
}
/**
@} end of vlog group
*/

@ -46,6 +46,23 @@ def divide(f,r):
k = k + 1
return(a/b,k)
def initLogValues(format):
if format == Tools.Q15:
exps = -np.linspace(0,15,num=125)
else:
exps = -np.linspace(0,31,num=125)
basis=2.0*np.ones(exps.size)
vals=np.float_power(basis,exps)
ref=np.log(vals)
if format==Tools.Q31 :
# Format must be Q5.26
ref = ref / 32.0
if format == Tools.Q15:
# Format must be Q4.11
ref = ref / 16.0
return(vals,ref)
def writeTests(config,format):
config.setOverwrite(False)
@ -79,7 +96,6 @@ def writeTests(config,format):
samples = np.abs(Tools.normalize(samples))
config.writeInput(1, samples,"Samples")
config.setOverwrite(True)
numerator=np.linspace(-0.9,0.9)
denominator=np.linspace(-0.9,0.9)
@ -95,6 +111,11 @@ def writeTests(config,format):
config.writeInput(1, denominator,"Denominator")
config.writeReference(1, resultValue,"DivisionValue")
config.writeReferenceS16(1, resultShift,"DivisionShift")
config.setOverwrite(True)
vals,ref=initLogValues(format)
config.writeInput(1, vals,"LogInput")
config.writeReference(1, ref,"Log")
config.setOverwrite(False)
@ -111,11 +132,14 @@ def writeTestsFloat(config,format):
data1 = data1 + 1e-3 # To avoid zero values
data1 = Tools.normalize(data1)
samples=np.concatenate((np.array([0.1,0.3,0.5,1.0,2.0]) , data1))
config.setOverwrite(True)
samples,v=initLogValues(format)
config.writeInput(1, samples,"LogInput")
v = np.log(samples)
config.writeReference(1, v,"Log")
config.setOverwrite(False)
samples=np.concatenate((np.array([0.0,1.0]),np.linspace(-0.4,0.4)))
config.writeInput(1, samples,"ExpInput")
v = np.exp(samples)
@ -129,7 +153,7 @@ def writeTestsFloat(config,format):
v = 1.0 / samples
config.writeReference(1, v,"Inverse")
config.setOverwrite(True)
config.setOverwrite(False)
@ -144,10 +168,9 @@ def generatePatterns():
configq31=Tools.Config(PATTERNDIR,PARAMDIR,"q31")
configq15=Tools.Config(PATTERNDIR,PARAMDIR,"q15")
#writeTestsFloat(configf32,0)
#writeTestsFloat(configf16,16)
#writeTests(configq31,31)
writeTestsFloat(configf32,0)
writeTestsFloat(configf16,16)
writeTests(configq31,31)
writeTests(configq15,15)

@ -1,52 +1,252 @@
H
25
// -2.302585
0xc09b
// -1.203973
0xbcd1
// -0.693147
0xb98c
// 0.000000
0x0
// 0.693147
0x398c
// -2.516839
0xc109
125
// 0.000000
0x0
// -5.908962
0xc5e9
// -1.345933
0xbd62
// -0.923815
0xbb64
// -4.046497
0xc40c
// -2.530234
0xc10f
// -0.724334
0xb9cb
// -1.436949
0xbdbf
// -1.327187
0xbd4f
// -1.741553
0xbef7
// -0.066722
0xac45
// -0.616041
0xb8ee
// -0.822195
0xba94
// -1.579204
0xbe51
// -1.333689
0xbd56
// -0.860545
0xbae2
// -1.080309
0xbc52
// -1.977120
0xbfe9
// -1.877663
0xbf83
// -0.173287
0xb18c
// -0.346574
0xb58c
// -0.519860
0xb829
// -0.693147
0xb98c
// -0.866434
0xbaee
// -1.039721
0xbc29
// -1.213008
0xbcda
// -1.386294
0xbd8c
// -1.559581
0xbe3d
// -1.732868
0xbeee
// -1.906155
0xbfa0
// -2.079442
0xc029
// -2.252728
0xc081
// -2.426015
0xc0da
// -2.599302
0xc133
// -2.772589
0xc18c
// -2.945876
0xc1e4
// -3.119162
0xc23d
// -3.292449
0xc296
// -3.465736
0xc2ee
// -3.639023
0xc347
// -3.812309
0xc3a0
// -3.985596
0xc3f9
// -4.158883
0xc429
// -4.332170
0xc455
// -4.505457
0xc481
// -4.678743
0xc4ae
// -4.852030
0xc4da
// -5.025317
0xc506
// -5.198604
0xc533
// -5.371891
0xc55f
// -5.545177
0xc58c
// -5.718464
0xc5b8
// -5.891751
0xc5e4
// -6.065038
0xc611
// -6.238325
0xc63d
// -6.411611
0xc669
// -6.584898
0xc696
// -6.758185
0xc6c2
// -6.931472
0xc6ee
// -7.104759
0xc71b
// -7.278045
0xc747
// -7.451332
0xc774
// -7.624619
0xc7a0
// -7.797906
0xc7cc
// -7.971193
0xc7f9
// -8.144479
0xc812
// -8.317766
0xc829
// -8.491053
0xc83f
// -8.664340
0xc855
// -8.837627
0xc86b
// -9.010913
0xc881
// -9.184200
0xc898
// -9.357487
0xc8ae
// -9.530774
0xc8c4
// -9.704061
0xc8da
// -9.877347
0xc8f0
// -10.050634
0xc906
// -10.223921
0xc91d
// -10.397208
0xc933
// -10.570495
0xc949
// -10.743781
0xc95f
// -10.917068
0xc975
// -11.090355
0xc98c
// -11.263642
0xc9a2
// -11.436928
0xc9b8
// -11.610215
0xc9ce
// -11.783502
0xc9e4
// -11.956789
0xc9fa
// -12.130076
0xca11
// -12.303362
0xca27
// -12.476649
0xca3d
// -12.649936
0xca53
// -12.823223
0xca69
// -12.996510
0xca80
// -13.169796
0xca96
// -13.343083
0xcaac
// -13.516370
0xcac2
// -13.689657
0xcad8
// -13.862944
0xcaee
// -14.036230
0xcb05
// -14.209517
0xcb1b
// -14.382804
0xcb31
// -14.556091
0xcb47
// -14.729378
0xcb5d
// -14.902664
0xcb74
// -15.075951
0xcb8a
// -15.249238
0xcba0
// -15.422525
0xcbb6
// -15.595812
0xcbcc
// -15.769098
0xcbe2
// -15.942385
0xcbf9
// -16.115672
0xcc07
// -16.288959
0xcc12
// -16.462246
0xcc1e
// -16.635532
0xcc29
// -16.808819
0xcc34
// -16.982106
0xcc3f
// -17.155393
0xcc4a
// -17.328680
0xcc55
// -17.501966
0xcc60
// -17.675253
0xcc6b
// -17.848540
0xcc76
// -18.021827
0xcc81
// -18.195113
0xcc8c
// -18.368400
0xcc98
// -18.541687
0xcca3
// -18.714974
0xccae
// -18.888261
0xccb9
// -19.061547
0xccc4
// -19.234834
0xcccf
// -19.408121
0xccda
// -19.581408
0xcce5
// -19.754695
0xccf0
// -19.927981
0xccfb
// -20.101268
0xcd06
// -20.274555
0xcd12
// -20.447842
0xcd1d
// -20.621129
0xcd28
// -20.794415
0xcd33
// -20.967702
0xcd3e
// -21.140989
0xcd49
// -21.314276
0xcd54
// -21.487563
0xcd5f

@ -1,52 +1,252 @@
H
25
// 0.100000
0x2e66
// 0.300000
0x34cd
// 0.500000
0x3800
// 1.000000
0x3c00
// 2.000000
0x4000
// 0.080714
0x2d2a
125
// 1.000000
0x3c00
// 0.002715
0x198f
// 0.260297
0x342a
// 0.397001
0x365a
// 0.017484
0x247a
// 0.079640
0x2d19
// 0.484647
0x37c1
// 0.237652
0x339b
// 0.265222
0x343e
// 0.175248
0x319c
// 0.935456
0x3b7c
// 0.540078
0x3852
// 0.439466
0x3708
// 0.206139
0x3299
// 0.263503
0x3437
// 0.422932
0x36c4
// 0.339491
0x356f
// 0.138467
0x306e
// 0.152947
0x30e5
// 0.840896
0x3aba
// 0.707107
0x39a8
// 0.594604
0x38c2
// 0.500000
0x3800
// 0.420448
0x36ba
// 0.353553
0x35a8
// 0.297302
0x34c2
// 0.250000
0x3400
// 0.210224
0x32ba
// 0.176777
0x31a8
// 0.148651
0x30c2
// 0.125000
0x3000
// 0.105112
0x2eba
// 0.088388
0x2da8
// 0.074325
0x2cc2
// 0.062500
0x2c00
// 0.052556
0x2aba
// 0.044194
0x29a8
// 0.037163
0x28c2
// 0.031250
0x2800
// 0.026278
0x26ba
// 0.022097
0x25a8
// 0.018581
0x24c2
// 0.015625
0x2400
// 0.013139
0x22ba
// 0.011049
0x21a8
// 0.009291
0x20c2
// 0.007812
0x2000
// 0.006570
0x1eba
// 0.005524
0x1da8
// 0.004645
0x1cc2
// 0.003906
0x1c00
// 0.003285
0x1aba
// 0.002762
0x19a8
// 0.002323
0x18c2
// 0.001953
0x1800
// 0.001642
0x16ba
// 0.001381
0x15a8
// 0.001161
0x14c2
// 0.000977
0x1400
// 0.000821
0x12ba
// 0.000691
0x11a8
// 0.000581
0x10c2
// 0.000488
0x1000
// 0.000411
0xeba
// 0.000345
0xda8
// 0.000290
0xcc2
// 0.000244
0xc00
// 0.000205
0xaba
// 0.000173
0x9a8
// 0.000145
0x8c2
// 0.000122
0x800
// 0.000103
0x6ba
// 0.000086
0x5a8
// 0.000073
0x4c2
// 0.000061
0x400
// 0.000051
0x35d
// 0.000043
0x2d4
// 0.000036
0x261
// 0.000031
0x200
// 0.000026
0x1af
// 0.000022
0x16a
// 0.000018
0x130
// 0.000015
0x100
// 0.000013
0xd7
// 0.000011
0xb5
// 0.000009
0x98
// 0.000008
0x80
// 0.000006
0x6c
// 0.000005
0x5b
// 0.000005
0x4c
// 0.000004
0x40
// 0.000003
0x36
// 0.000003
0x2d
// 0.000002
0x26
// 0.000002
0x20
// 0.000002
0x1b
// 0.000001
0x17
// 0.000001
0x13
// 0.000001
0x10
// 0.000001
0xd
// 0.000001
0xb
// 0.000001
0xa
// 0.000000
0x8
// 0.000000
0x7
// 0.000000
0x6
// 0.000000
0x5
// 0.000000
0x4
// 0.000000
0x3
// 0.000000
0x3
// 0.000000
0x2
// 0.000000
0x2
// 0.000000
0x2
// 0.000000
0x1
// 0.000000
0x1
// 0.000000
0x1
// 0.000000
0x1
// 0.000000
0x1
// 0.000000
0x1
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0
// 0.000000
0x0

@ -1,52 +1,252 @@
W
25
// -2.302585
0xc0135d8e
// -1.203973
0xbf9a1bc8
// -0.693147
0xbf317218
// 0.000000
0x0
// 0.693147
0x3f317218
// -1.258305
0xbfa11023
// -0.211878
0xbe58f684
// -3.346797
0xc05631ec
// -0.864421
0xbf5d4aaa
// -0.528881
0xbf0764bd
// -2.065025
0xc0042960
// -1.015645
0xbf8200a4
// -3.186949
0xc04bf6f8
// -2.768101
0xc0312891
// -0.817783
0xbf515a37
125
// 0.000000
0x0
// -0.232006
0xbe6d92ea
// -2.148373
0xc0097ef2
// -1.354070
0xbfad522a
// -1.254477
0xbfa092b3
// -0.561254
0xbf0fae5f
// -1.254320
0xbfa08d8f
// -0.727112
0xbf3a23ff
// -0.089110
0xbdb67f69
// -0.392518
0xbec8f819
// -0.173287
0xbe317218
// -0.346574
0xbeb17218
// -0.519860
0xbf051592
// -0.693147
0xbf317218
// -0.866434
0xbf5dce9e
// -1.039721
0xbf851592
// -1.213008
0xbf9b43d5
// -1.386294
0xbfb17218
// -1.559581
0xbfc7a05b
// -1.732868
0xbfddce9e
// -1.906155
0xbff3fce1
// -2.079442
0xc0051592
// -2.252728
0xc0102cb3
// -2.426015
0xc01b43d5
// -2.599302
0xc0265af6
// -2.772589
0xc0317218
// -2.945876
0xc03c8939
// -3.119162
0xc047a05b
// -3.292449
0xc052b77c
// -3.465736
0xc05dce9e
// -3.639023
0xc068e5bf
// -3.812309
0xc073fce1
// -3.985596
0xc07f1402
// -4.158883
0xc0851592
// -4.332170
0xc08aa123
// -4.505457
0xc0902cb3
// -4.678743
0xc095b844
// -4.852030
0xc09b43d5
// -5.025317
0xc0a0cf66
// -5.198604
0xc0a65af6
// -5.371891
0xc0abe687
// -5.545177
0xc0b17218
// -5.718464
0xc0b6fda9
// -5.891751
0xc0bc8939
// -6.065038
0xc0c214ca
// -6.238325
0xc0c7a05b
// -6.411611
0xc0cd2bec
// -6.584898
0xc0d2b77c
// -6.758185
0xc0d8430d
// -6.931472
0xc0ddce9e
// -7.104759
0xc0e35a2f
// -7.278045
0xc0e8e5bf
// -7.451332
0xc0ee7150
// -7.624619
0xc0f3fce1
// -7.797906
0xc0f98872
// -7.971193
0xc0ff1402
// -8.144479
0xc1024fca
// -8.317766
0xc1051592
// -8.491053
0xc107db5a
// -8.664340
0xc10aa123
// -8.837627
0xc10d66eb
// -9.010913
0xc1102cb3
// -9.184200
0xc112f27c
// -9.357487
0xc115b844
// -9.530774
0xc1187e0d
// -9.704061
0xc11b43d5
// -9.877347
0xc11e099d
// -10.050634
0xc120cf66
// -10.223921
0xc123952e
// -10.397208
0xc1265af6
// -10.570495
0xc12920bf
// -10.743781
0xc12be687
// -10.917068
0xc12eac50
// -11.090355
0xc1317218
// -11.263642
0xc13437e0
// -11.436928
0xc136fda9
// -11.610215
0xc139c371
// -11.783502
0xc13c8939
// -11.956789
0xc13f4f02
// -12.130076
0xc14214ca
// -12.303362
0xc144da93
// -12.476649
0xc147a05b
// -12.649936
0xc14a6623
// -12.823223
0xc14d2bec
// -12.996510
0xc14ff1b4
// -13.169796
0xc152b77c
// -13.343083
0xc1557d45
// -13.516370
0xc158430d
// -13.689657
0xc15b08d6
// -13.862944
0xc15dce9e
// -14.036230
0xc1609466
// -14.209517
0xc1635a2f
// -14.382804
0xc1661ff7
// -14.556091
0xc168e5bf
// -14.729378
0xc16bab88
// -14.902664
0xc16e7150
// -15.075951
0xc1713719
// -15.249238
0xc173fce1
// -15.422525
0xc176c2a9
// -15.595812
0xc1798872
// -15.769098
0xc17c4e3a
// -15.942385
0xc17f1402
// -16.115672
0xc180ece5
// -16.288959
0xc1824fca
// -16.462246
0xc183b2ae
// -16.635532
0xc1851592
// -16.808819
0xc1867876
// -16.982106
0xc187db5a
// -17.155393
0xc1893e3f
// -17.328680
0xc18aa123
// -17.501966
0xc18c0407
// -17.675253
0xc18d66eb
// -17.848540
0xc18ec9cf
// -18.021827
0xc1902cb3
// -18.195113
0xc1918f98
// -18.368400
0xc192f27c
// -18.541687
0xc1945560
// -18.714974
0xc195b844
// -18.888261
0xc1971b28
// -19.061547
0xc1987e0d
// -19.234834
0xc199e0f1
// -19.408121
0xc19b43d5
// -19.581408
0xc19ca6b9
// -19.754695
0xc19e099d
// -19.927981
0xc19f6c82
// -20.101268
0xc1a0cf66
// -20.274555
0xc1a2324a
// -20.447842
0xc1a3952e
// -20.621129
0xc1a4f812
// -20.794415
0xc1a65af6
// -20.967702
0xc1a7bddb
// -21.140989
0xc1a920bf
// -21.314276
0xc1aa83a3
// -21.487563
0xc1abe687

@ -1,52 +1,252 @@
W
25
// 0.100000
0x3dcccccd
// 0.300000
0x3e99999a
// 0.500000
0x3f000000
// 1.000000
0x3f800000
// 2.000000
0x40000000
// 0.284135
0x3e917a2c
// 0.809063
0x3f4f1ec9
// 0.035197
0x3d102aa2
// 0.421296
0x3ed7b40f
// 0.589264
0x3f16da02
// 0.126815
0x3e01dbd0
// 0.362169
0x3eb96e34
// 0.041298
0x3d2927c5
// 0.062781
0x3d809363
// 0.441409
0x3ee20064
125
// 1.000000
0x3f800000
// 0.792942
0x3f4afe38
// 0.116674
0x3deef2af
// 0.258187
0x3e843120
// 0.285225
0x3e920903
// 0.570493
0x3f120bd4
// 0.285270
0x3e920ee1
// 0.483303
0x3ef7737a
// 0.914745
0x3f6a2cb6
// 0.675354
0x3f2ce405
// 0.840896
0x3f5744fd
// 0.707107
0x3f3504f3
// 0.594604
0x3f1837f0
// 0.500000
0x3f000000
// 0.420448
0x3ed744fd
// 0.353553
0x3eb504f3
// 0.297302
0x3e9837f0
// 0.250000
0x3e800000
// 0.210224
0x3e5744fd
// 0.176777
0x3e3504f3
// 0.148651
0x3e1837f0
// 0.125000
0x3e000000
// 0.105112
0x3dd744fd
// 0.088388
0x3db504f3
// 0.074325
0x3d9837f0
// 0.062500
0x3d800000
// 0.052556
0x3d5744fd
// 0.044194
0x3d3504f3
// 0.037163
0x3d1837f0
// 0.031250
0x3d000000
// 0.026278
0x3cd744fd
// 0.022097
0x3cb504f3
// 0.018581
0x3c9837f0
// 0.015625
0x3c800000
// 0.013139
0x3c5744fd
// 0.011049
0x3c3504f3
// 0.009291
0x3c1837f0
// 0.007812
0x3c000000
// 0.006570
0x3bd744fd
// 0.005524
0x3bb504f3
// 0.004645
0x3b9837f0
// 0.003906
0x3b800000
// 0.003285
0x3b5744fd
// 0.002762
0x3b3504f3
// 0.002323
0x3b1837f0
// 0.001953
0x3b000000
// 0.001642
0x3ad744fd
// 0.001381
0x3ab504f3
// 0.001161
0x3a9837f0
// 0.000977
0x3a800000
// 0.000821
0x3a5744fd
// 0.000691
0x3a3504f3
// 0.000581
0x3a1837f0
// 0.000488
0x3a000000
// 0.000411
0x39d744fd
// 0.000345
0x39b504f3
// 0.000290
0x399837f0
// 0.000244
0x39800000
// 0.000205
0x395744fd
// 0.000173
0x393504f3
// 0.000145
0x391837f0
// 0.000122
0x39000000
// 0.000103
0x38d744fd
// 0.000086
0x38b504f3
// 0.000073
0x389837f0
// 0.000061
0x38800000
// 0.000051
0x385744fd
// 0.000043
0x383504f3
// 0.000036
0x381837f0
// 0.000031
0x38000000
// 0.000026
0x37d744fd
// 0.000022
0x37b504f3
// 0.000018
0x379837f0
// 0.000015
0x37800000
// 0.000013
0x375744fd
// 0.000011
0x373504f3
// 0.000009
0x371837f0
// 0.000008
0x37000000
// 0.000006
0x36d744fd
// 0.000005
0x36b504f3
// 0.000005
0x369837f0
// 0.000004
0x36800000
// 0.000003
0x365744fd
// 0.000003
0x363504f3
// 0.000002
0x361837f0
// 0.000002
0x36000000
// 0.000002
0x35d744fd
// 0.000001
0x35b504f3
// 0.000001
0x359837f0
// 0.000001
0x35800000
// 0.000001
0x355744fd
// 0.000001
0x353504f3
// 0.000001
0x351837f0
// 0.000000
0x35000000
// 0.000000
0x34d744fd
// 0.000000
0x34b504f3
// 0.000000
0x349837f0
// 0.000000
0x34800000
// 0.000000
0x345744fd
// 0.000000
0x343504f3
// 0.000000
0x341837f0
// 0.000000
0x34000000
// 0.000000
0x33d744fd
// 0.000000
0x33b504f3
// 0.000000
0x339837f0
// 0.000000
0x33800000
// 0.000000
0x335744fd
// 0.000000
0x333504f3
// 0.000000
0x331837f0
// 0.000000
0x33000000
// 0.000000
0x32d744fd
// 0.000000
0x32b504f3
// 0.000000
0x329837f0
// 0.000000
0x32800000
// 0.000000
0x325744fd
// 0.000000
0x323504f3
// 0.000000
0x321837f0
// 0.000000
0x32000000
// 0.000000
0x31d744fd
// 0.000000
0x31b504f3
// 0.000000
0x319837f0
// 0.000000
0x31800000
// 0.000000
0x315744fd
// 0.000000
0x313504f3
// 0.000000
0x311837f0
// 0.000000
0x31000000
// 0.000000
0x30d744fd
// 0.000000
0x30b504f3
// 0.000000
0x309837f0
// 0.000000
0x30800000
// 0.000000
0x305744fd
// 0.000000
0x303504f3
// 0.000000
0x301837f0
// 0.000000
0x30000000

@ -0,0 +1,252 @@
H
125
// 0.000000
0x0000
// -0.005241
0xFF54
// -0.010481
0xFEA9
// -0.015722
0xFDFD
// -0.020962
0xFD51
// -0.026203
0xFCA5
// -0.031443
0xFBFA
// -0.036684
0xFB4E
// -0.041924
0xFAA2
// -0.047165
0xF9F7
// -0.052405
0xF94B
// -0.057646
0xF89F
// -0.062886
0xF7F3
// -0.068127
0xF748
// -0.073367
0xF69C
// -0.078608
0xF5F0
// -0.083848
0xF544
// -0.089089
0xF499
// -0.094330
0xF3ED
// -0.099570
0xF341
// -0.104811
0xF296
// -0.110051
0xF1EA
// -0.115292
0xF13E
// -0.120532
0xF092
// -0.125773
0xEFE7
// -0.131013
0xEF3B
// -0.136254
0xEE8F
// -0.141494
0xEDE4
// -0.146735
0xED38
// -0.151975
0xEC8C
// -0.157216
0xEBE0
// -0.162456
0xEB35
// -0.167697
0xEA89
// -0.172937
0xE9DD
// -0.178178
0xE931
// -0.183418
0xE886
// -0.188659
0xE7DA
// -0.193900
0xE72E
// -0.199140
0xE683
// -0.204381
0xE5D7
// -0.209621
0xE52B
// -0.214862
0xE47F
// -0.220102
0xE3D4
// -0.225343
0xE328
// -0.230583
0xE27C
// -0.235824
0xE1D1
// -0.241064
0xE125
// -0.246305
0xE079
// -0.251545
0xDFCD
// -0.256786
0xDF22
// -0.262026
0xDE76
// -0.267267
0xDDCA
// -0.272507
0xDD1E
// -0.277748
0xDC73
// -0.282989
0xDBC7
// -0.288229
0xDB1B
// -0.293470
0xDA70
// -0.298710
0xD9C4
// -0.303951
0xD918
// -0.309191
0xD86C
// -0.314432
0xD7C1
// -0.319672
0xD715
// -0.324913
0xD669
// -0.330153
0xD5BE
// -0.335394
0xD512
// -0.340634
0xD466
// -0.345875
0xD3BA
// -0.351115
0xD30F
// -0.356356
0xD263
// -0.361596
0xD1B7
// -0.366837
0xD10B
// -0.372077
0xD060
// -0.377318
0xCFB4
// -0.382559
0xCF08
// -0.387799
0xCE5D
// -0.393040
0xCDB1
// -0.398280
0xCD05
// -0.403521
0xCC59
// -0.408761
0xCBAE
// -0.414002
0xCB02
// -0.419242
0xCA56
// -0.424483
0xC9AB
// -0.429723
0xC8FF
// -0.434964
0xC853
// -0.440204
0xC7A7
// -0.445445
0xC6FC
// -0.450685
0xC650
// -0.455926
0xC5A4
// -0.461166
0xC4F8
// -0.466407
0xC44D
// -0.471648
0xC3A1
// -0.476888
0xC2F5
// -0.482129
0xC24A
// -0.487369
0xC19E
// -0.492610
0xC0F2
// -0.497850
0xC046
// -0.503091
0xBF9B
// -0.508331
0xBEEF
// -0.513572
0xBE43
// -0.518812
0xBD98
// -0.524053
0xBCEC
// -0.529293
0xBC40
// -0.534534
0xBB94
// -0.539774
0xBAE9
// -0.545015
0xBA3D
// -0.550255
0xB991
// -0.555496
0xB8E6
// -0.560737
0xB83A
// -0.565977
0xB78E
// -0.571218
0xB6E2
// -0.576458
0xB637
// -0.581699
0xB58B
// -0.586939
0xB4DF
// -0.592180
0xB433
// -0.597420
0xB388
// -0.602661
0xB2DC
// -0.607901
0xB230
// -0.613142
0xB185
// -0.618382
0xB0D9
// -0.623623
0xB02D
// -0.628863
0xAF81
// -0.634104
0xAED6
// -0.639344
0xAE2A
// -0.644585
0xAD7E
// -0.649825
0xACD3

@ -0,0 +1,252 @@
H
125
// 1.000000
0x7FFF
// 0.919571
0x75B4
// 0.845610
0x6C3D
// 0.777598
0x6388
// 0.715056
0x5B87
// 0.657545
0x542A
// 0.604659
0x4D65
// 0.556027
0x472C
// 0.511306
0x4172
// 0.470182
0x3C2F
// 0.432365
0x3758
// 0.397590
0x32E4
// 0.365612
0x2ECC
// 0.336206
0x2B09
// 0.309166
0x2793
// 0.284300
0x2464
// 0.261434
0x2177
// 0.240407
0x1EC6
// 0.221071
0x1C4C
// 0.203290
0x1A05
// 0.186940
0x17EE
// 0.171904
0x1601
// 0.158078
0x143C
// 0.145364
0x129B
// 0.133672
0x111C
// 0.122921
0x0FBC
// 0.113035
0x0E78
// 0.103943
0x0D4E
// 0.095583
0x0C3C
// 0.087896
0x0B40
// 0.080826
0x0A59
// 0.074325
0x0983
// 0.068347
0x08C0
// 0.062850
0x080B
// 0.057795
0x0766
// 0.053147
0x06CE
// 0.048872
0x0641
// 0.044942
0x05C1
// 0.041327
0x054A
// 0.038003
0x04DD
// 0.034946
0x0479
// 0.032136
0x041D
// 0.029551
0x03C8
// 0.027174
0x037A
// 0.024989
0x0333
// 0.022979
0x02F1
// 0.021131
0x02B4
// 0.019431
0x027D
// 0.017868
0x024A
// 0.016431
0x021A
// 0.015110
0x01EF
// 0.013894
0x01C7
// 0.012777
0x01A3
// 0.011749
0x0181
// 0.010804
0x0162
// 0.009935
0x0146
// 0.009136
0x012B
// 0.008401
0x0113
// 0.007726
0x00FD
// 0.007104
0x00E9
// 0.006533
0x00D6
// 0.006007
0x00C5
// 0.005524
0x00B5
// 0.005080
0x00A6
// 0.004671
0x0099
// 0.004296
0x008D
// 0.003950
0x0081
// 0.003632
0x0077
// 0.003340
0x006D
// 0.003072
0x0065
// 0.002825
0x005D
// 0.002597
0x0055
// 0.002389
0x004E
// 0.002196
0x0048
// 0.002020
0x0042
// 0.001857
0x003D
// 0.001708
0x0038
// 0.001571
0x0033
// 0.001444
0x002F
// 0.001328
0x002C
// 0.001221
0x0028
// 0.001123
0x0025
// 0.001033
0x0022
// 0.000950
0x001F
// 0.000873
0x001D
// 0.000803
0x001A
// 0.000738
0x0018
// 0.000679
0x0016
// 0.000624
0x0014
// 0.000574
0x0013
// 0.000528
0x0011
// 0.000486
0x0010
// 0.000447
0x000F
// 0.000411
0x000D
// 0.000378
0x000C
// 0.000347
0x000B
// 0.000319
0x000A
// 0.000294
0x000A
// 0.000270
0x0009
// 0.000248
0x0008
// 0.000228
0x0007
// 0.000210
0x0007
// 0.000193
0x0006
// 0.000178
0x0006
// 0.000163
0x0005
// 0.000150
0x0005
// 0.000138
0x0005
// 0.000127
0x0004
// 0.000117
0x0004
// 0.000107
0x0004
// 0.000099
0x0003
// 0.000091
0x0003
// 0.000083
0x0003
// 0.000077
0x0003
// 0.000071
0x0002
// 0.000065
0x0002
// 0.000060
0x0002
// 0.000055
0x0002
// 0.000050
0x0002
// 0.000046
0x0002
// 0.000043
0x0001
// 0.000039
0x0001
// 0.000036
0x0001
// 0.000033
0x0001
// 0.000031
0x0001

@ -0,0 +1,252 @@
W
125
// 0.000000
0x00000000
// -0.005415
0xFF4E8DE8
// -0.010830
0xFE9D1BD0
// -0.016246
0xFDEBA9B8
// -0.021661
0xFD3A37A0
// -0.027076
0xFC88C588
// -0.032491
0xFBD75370
// -0.037906
0xFB25E158
// -0.043322
0xFA746F40
// -0.048737
0xF9C2FD28
// -0.054152
0xF9118B10
// -0.059567
0xF86018F8
// -0.064983
0xF7AEA6E0
// -0.070398
0xF6FD34C8
// -0.075813
0xF64BC2B0
// -0.081228
0xF59A5098
// -0.086643
0xF4E8DE81
// -0.092059
0xF4376C69
// -0.097474
0xF385FA51
// -0.102889
0xF2D48839
// -0.108304
0xF2231621
// -0.113719
0xF171A409
// -0.119135
0xF0C031F1
// -0.124550
0xF00EBFD9
// -0.129965
0xEF5D4DC1
// -0.135380
0xEEABDBA9
// -0.140796
0xEDFA6991
// -0.146211
0xED48F779
// -0.151626
0xEC978561
// -0.157041
0xEBE61349
// -0.162456
0xEB34A131
// -0.167872
0xEA832F19
// -0.173287
0xE9D1BD01
// -0.178702
0xE9204AE9
// -0.184117
0xE86ED8D1
// -0.189532
0xE7BD66B9
// -0.194948
0xE70BF4A1
// -0.200363
0xE65A8289
// -0.205778
0xE5A91071
// -0.211193
0xE4F79E59
// -0.216608
0xE4462C41
// -0.222024
0xE394BA29
// -0.227439
0xE2E34811
// -0.232854
0xE231D5F9
// -0.238269
0xE18063E1
// -0.243685
0xE0CEF1C9
// -0.249100
0xE01D7FB1
// -0.254515
0xDF6C0D9A
// -0.259930
0xDEBA9B82
// -0.265345
0xDE09296A
// -0.270761
0xDD57B752
// -0.276176
0xDCA6453A
// -0.281591
0xDBF4D322
// -0.287006
0xDB43610A
// -0.292421
0xDA91EEF2
// -0.297837
0xD9E07CDA
// -0.303252
0xD92F0AC2
// -0.308667
0xD87D98AA
// -0.314082
0xD7CC2692
// -0.319498
0xD71AB47A
// -0.324913
0xD6694262
// -0.330328
0xD5B7D04A
// -0.335743
0xD5065E32
// -0.341158
0xD454EC1A
// -0.346574
0xD3A37A02
// -0.351989
0xD2F207EA
// -0.357404
0xD24095D2
// -0.362819
0xD18F23BA
// -0.368234
0xD0DDB1A2
// -0.373650
0xD02C3F8A
// -0.379065
0xCF7ACD72
// -0.384480
0xCEC95B5A
// -0.389895
0xCE17E942
// -0.395311
0xCD66772A
// -0.400726
0xCCB50512
// -0.406141
0xCC0392FA
// -0.411556
0xCB5220E2
// -0.416971
0xCAA0AECA
// -0.422387
0xC9EF3CB2
// -0.427802
0xC93DCA9B
// -0.433217
0xC88C5883
// -0.438632
0xC7DAE66B
// -0.444047
0xC7297453
// -0.449463
0xC678023B
// -0.454878
0xC5C69023
// -0.460293
0xC5151E0B
// -0.465708
0xC463ABF3
// -0.471123
0xC3B239DB
// -0.476539
0xC300C7C3
// -0.481954
0xC24F55AB
// -0.487369
0xC19DE393
// -0.492784
0xC0EC717B
// -0.498200
0xC03AFF63
// -0.503615
0xBF898D4B
// -0.509030
0xBED81B33
// -0.514445
0xBE26A91B
// -0.519860
0xBD753703
// -0.525276
0xBCC3C4EB
// -0.530691
0xBC1252D3
// -0.536106
0xBB60E0BB
// -0.541521
0xBAAF6EA3
// -0.546936
0xB9FDFC8B
// -0.552352
0xB94C8A73
// -0.557767
0xB89B185B
// -0.563182
0xB7E9A643
// -0.568597
0xB738342B
// -0.574013
0xB686C213
// -0.579428
0xB5D54FFB
// -0.584843
0xB523DDE3
// -0.590258
0xB4726BCB
// -0.595673
0xB3C0F9B4
// -0.601089
0xB30F879C
// -0.606504
0xB25E1584
// -0.611919
0xB1ACA36C
// -0.617334
0xB0FB3154
// -0.622749
0xB049BF3C
// -0.628165
0xAF984D24
// -0.633580
0xAEE6DB0C
// -0.638995
0xAE3568F4
// -0.644410
0xAD83F6DC
// -0.649825
0xACD284C4
// -0.655241
0xAC2112AC
// -0.660656
0xAB6FA094
// -0.666071
0xAABE2E7C
// -0.671486
0xAA0CBC64

@ -0,0 +1,252 @@
W
125
// 1.000000
0x7FFFFFFF
// 0.840896
0x6BA27E65
// 0.707107
0x5A82799A
// 0.594604
0x4C1BF829
// 0.500000
0x40000000
// 0.420448
0x35D13F33
// 0.353553
0x2D413CCD
// 0.297302
0x260DFC14
// 0.250000
0x20000000
// 0.210224
0x1AE89F99
// 0.176777
0x16A09E66
// 0.148651
0x1306FE0A
// 0.125000
0x10000000
// 0.105112
0x0D744FCD
// 0.088388
0x0B504F33
// 0.074325
0x09837F05
// 0.062500
0x08000000
// 0.052556
0x06BA27E6
// 0.044194
0x05A8279A
// 0.037163
0x04C1BF83
// 0.031250
0x04000000
// 0.026278
0x035D13F3
// 0.022097
0x02D413CD
// 0.018581
0x0260DFC1
// 0.015625
0x02000000
// 0.013139
0x01AE89FA
// 0.011049
0x016A09E6
// 0.009291
0x01306FE1
// 0.007812
0x01000000
// 0.006570
0x00D744FD
// 0.005524
0x00B504F3
// 0.004645
0x009837F0
// 0.003906
0x00800000
// 0.003285
0x006BA27E
// 0.002762
0x005A827A
// 0.002323
0x004C1BF8
// 0.001953
0x00400000
// 0.001642
0x0035D13F
// 0.001381
0x002D413D
// 0.001161
0x00260DFC
// 0.000977
0x00200000
// 0.000821
0x001AE8A0
// 0.000691
0x0016A09E
// 0.000581
0x001306FE
// 0.000488
0x00100000
// 0.000411
0x000D7450
// 0.000345
0x000B504F
// 0.000290
0x0009837F
// 0.000244
0x00080000
// 0.000205
0x0006BA28
// 0.000173
0x0005A828
// 0.000145
0x0004C1C0
// 0.000122
0x00040000
// 0.000103
0x00035D14
// 0.000086
0x0002D414
// 0.000073
0x000260E0
// 0.000061
0x00020000
// 0.000051
0x0001AE8A
// 0.000043
0x00016A0A
// 0.000036
0x00013070
// 0.000031
0x00010000
// 0.000026
0x0000D745
// 0.000022
0x0000B505
// 0.000018
0x00009838
// 0.000015
0x00008000
// 0.000013
0x00006BA2
// 0.000011
0x00005A82
// 0.000009
0x00004C1C
// 0.000008
0x00004000
// 0.000006
0x000035D1
// 0.000005
0x00002D41
// 0.000005
0x0000260E
// 0.000004
0x00002000
// 0.000003
0x00001AE9
// 0.000003
0x000016A1
// 0.000002
0x00001307
// 0.000002
0x00001000
// 0.000002
0x00000D74
// 0.000001
0x00000B50
// 0.000001
0x00000983
// 0.000001
0x00000800
// 0.000001
0x000006BA
// 0.000001
0x000005A8
// 0.000001
0x000004C2
// 0.000000
0x00000400
// 0.000000
0x0000035D
// 0.000000
0x000002D4
// 0.000000
0x00000261
// 0.000000
0x00000200
// 0.000000
0x000001AF
// 0.000000
0x0000016A
// 0.000000
0x00000130
// 0.000000
0x00000100
// 0.000000
0x000000D7
// 0.000000
0x000000B5
// 0.000000
0x00000098
// 0.000000
0x00000080
// 0.000000
0x0000006C
// 0.000000
0x0000005B
// 0.000000
0x0000004C
// 0.000000
0x00000040
// 0.000000
0x00000036
// 0.000000
0x0000002D
// 0.000000
0x00000026
// 0.000000
0x00000020
// 0.000000
0x0000001B
// 0.000000
0x00000017
// 0.000000
0x00000013
// 0.000000
0x00000010
// 0.000000
0x0000000D
// 0.000000
0x0000000B
// 0.000000
0x0000000A
// 0.000000
0x00000008
// 0.000000
0x00000007
// 0.000000
0x00000006
// 0.000000
0x00000005
// 0.000000
0x00000004
// 0.000000
0x00000003
// 0.000000
0x00000003
// 0.000000
0x00000002
// 0.000000
0x00000002
// 0.000000
0x00000002
// 0.000000
0x00000001
// 0.000000
0x00000001
// 0.000000
0x00000001

@ -7,7 +7,7 @@
#include "Test.h"
#define SNR_THRESHOLD 120
#define SNR_THRESHOLD 119
/*
Reference patterns are generated with

@ -14,7 +14,24 @@ a double precision computation.
*/
#define ABS_ERROR ((q15_t)10)
#define LOG_ABS_ERROR ((q15_t)1000)
void FastMathQ15::test_vlog_q15()
{
const q15_t *inp = input.ptr();
q15_t *outp = output.ptr();
//printf("Nb samples = %lu\n",ref.nbSamples());
arm_vlog_q15(inp,outp,ref.nbSamples());
//arm_vlog_q15(inp,outp,1);
//printf("in = %08X\n",inp[124]);
//printf("out = %08X\n",outp[124]);
//ASSERT_SNR(ref,output,(float32_t)SNR_THRESHOLD);
ASSERT_NEAR_EQ(ref,output,LOG_ABS_ERROR);
ASSERT_EMPTY_TAIL(output);
}
void FastMathQ15::test_division_q15()
{
@ -135,6 +152,42 @@ a double precision computation.
}
break;
case FastMathQ15::TEST_VLOG_Q15_5:
{
input.reload(FastMathQ15::LOGINPUT1_Q15_ID,mgr);
ref.reload(FastMathQ15::LOG1_Q15_ID,mgr);
output.create(ref.nbSamples(),FastMathQ15::OUT_Q15_ID,mgr);
}
break;
case FastMathQ15::TEST_VLOG_Q15_6:
{
input.reload(FastMathQ15::LOGINPUT1_Q15_ID,mgr,7);
ref.reload(FastMathQ15::LOG1_Q15_ID,mgr,7);
output.create(ref.nbSamples(),FastMathQ15::OUT_Q15_ID,mgr);
}
break;
case FastMathQ15::TEST_VLOG_Q15_7:
{
input.reload(FastMathQ15::LOGINPUT1_Q15_ID,mgr,16);
ref.reload(FastMathQ15::LOG1_Q15_ID,mgr,16);
output.create(ref.nbSamples(),FastMathQ15::OUT_Q15_ID,mgr);
}
break;
case FastMathQ15::TEST_VLOG_Q15_8:
{
input.reload(FastMathQ15::LOGINPUT1_Q15_ID,mgr,23);
ref.reload(FastMathQ15::LOG1_Q15_ID,mgr,23);
output.create(ref.nbSamples(),FastMathQ15::OUT_Q15_ID,mgr);
}
break;
}
}

@ -13,7 +13,36 @@ a double precision computation.
*/
#define ABS_ERROR ((q31_t)2200)
/*
The error bounds is 0.014 and it is big
but the test is really extreme with input values as small
as 2^-31 !
The error is clearly diverging for the very small values.
So, we have an error converging to 0.014 for outputs around -21.
*/
#define LOG_ABS_ERROR ((q31_t)30000000)
void FastMathQ31::test_vlog_q31()
{
const q31_t *inp = input.ptr();
q31_t *outp = output.ptr();
//printf("Nb samples = %lu\n",ref.nbSamples());
arm_vlog_q31(inp,outp,ref.nbSamples());
//arm_vlog_q31(inp+124,outp+124,1);
//printf("in = %08X\n",inp[124]);
//printf("out = %08X\n",outp[124]);
//ASSERT_SNR(ref,output,(float32_t)SNR_THRESHOLD);
ASSERT_NEAR_EQ(ref,output,LOG_ABS_ERROR);
ASSERT_EMPTY_TAIL(output);
}
void FastMathQ31::test_cos_q31()
{
@ -97,6 +126,42 @@ a double precision computation.
}
break;
case FastMathQ31::TEST_VLOG_Q31_4:
{
input.reload(FastMathQ31::LOGINPUT1_Q31_ID,mgr);
ref.reload(FastMathQ31::LOG1_Q31_ID,mgr);
output.create(ref.nbSamples(),FastMathQ31::OUT_Q31_ID,mgr);
}
break;
case FastMathQ31::TEST_VLOG_Q31_5:
{
input.reload(FastMathQ31::LOGINPUT1_Q31_ID,mgr,3);
ref.reload(FastMathQ31::LOG1_Q31_ID,mgr,3);
output.create(ref.nbSamples(),FastMathQ31::OUT_Q31_ID,mgr);
}
break;
case FastMathQ31::TEST_VLOG_Q31_6:
{
input.reload(FastMathQ31::LOGINPUT1_Q31_ID,mgr,8);
ref.reload(FastMathQ31::LOG1_Q31_ID,mgr,8);
output.create(ref.nbSamples(),FastMathQ31::OUT_Q31_ID,mgr);
}
break;
case FastMathQ31::TEST_VLOG_Q31_7:
{
input.reload(FastMathQ31::LOGINPUT1_Q31_ID,mgr,11);
ref.reload(FastMathQ31::LOG1_Q31_ID,mgr,11);
output.create(ref.nbSamples(),FastMathQ31::OUT_Q31_ID,mgr);
}
break;
}
}

@ -1402,9 +1402,11 @@ group Root {
Pattern ANGLES1_Q31_ID : Angles1_q31.txt
Pattern SQRTINPUT1_Q31_ID : SqrtInput1_q31.txt
Pattern LOGINPUT1_Q31_ID : LogInput1_q31.txt
Pattern COS1_Q31_ID : Cos1_q31.txt
Pattern SIN1_Q31_ID : Sin1_q31.txt
Pattern SQRT1_Q31_ID : Sqrt1_q31.txt
Pattern LOG1_Q31_ID : Log1_q31.txt
Output OUT_Q31_ID : Output
@ -1413,6 +1415,10 @@ group Root {
test_cos_q31:test_cos_q31
test_sin_q31:test_sin_q31
test_sqrt_q31:test_sqrt_q31
test_vlog_q31:test_vlog_q31
test_vlog_q31 nb=3:test_vlog_q31
test_vlog_q31 nb=4n:test_vlog_q31
test_vlog_q31 nb=4n+1:test_vlog_q31
}
}
@ -1422,9 +1428,11 @@ group Root {
Pattern ANGLES1_Q15_ID : Angles1_q15.txt
Pattern SQRTINPUT1_Q15_ID : SqrtInput1_q15.txt
Pattern LOGINPUT1_Q15_ID : LogInput1_q15.txt
Pattern COS1_Q15_ID : Cos1_q15.txt
Pattern SIN1_Q15_ID : Sin1_q15.txt
Pattern SQRT1_Q15_ID : Sqrt1_q15.txt
Pattern LOG1_Q15_ID : Log1_q15.txt
Pattern NUMERATOR_Q15_ID : Numerator1_q15.txt
Pattern DENOMINATOR_Q15_ID : Denominator1_q15.txt
@ -1440,6 +1448,10 @@ group Root {
test_sin_q15:test_sin_q15
test_sqrt_q15:test_sqrt_q15
test_division_q15:test_division_q15
test_vlog_q15:test_vlog_q15
test_vlog_q15 nb=3:test_vlog_q15
test_vlog_q15 nb=4n:test_vlog_q15
test_vlog_q15 nb=4n+1:test_vlog_q15
}
}
}

Loading…
Cancel
Save