1.4.2.72 DSP_VectorExp Function

Computes the EXP (e^x) of the first N elements of inVector, and stores the result in outVector.

Description

void DSP_VectorExp(_Q16 *outVector, _Q16 *inVector, int N);

Computes the Exp value, e to the power of X, on the first N elements of inVector. The output is stored to outVector. Both vectors are _Q16 format, which is 32-bit data with 15 bits for the integer and 16 bits for the fractional portion. If values exceed maximum or minimum they will saturate to the maximum or zero respectively.

Preconditions

The pointers outdata and indata must be aligned on 4-byte boundaries. This function uses the Exp and Div functions from the LibQ library. That library must be compiled as part of the project.

Parameters

outdata pointer to destination array of elements (_Q16)

indata pointer to source array of elements (_Q16)

N number of samples (int)

Returns

None.

Remarks

Inclusion of the LibQ header file and library is mandatory to use this function.

Example

int expNum = 4;

_Q16 inExpVec[8] = {0x00010000, 0xffff0000,0x00020000,0x00030000,0x00038000,

0x00040000,0xfffe0000,0x00058000};

_// 1.0, -1.0, 2.0, 3.0, 3.5, 4.0, -2.0, 5.5_

_Q16 outExpVec[8] = {0};

DSP_VectorExp(outExpVec, inExpVec, expNum);

_// outExpVec = 0x0002B7E1, 0x00005E2D, 0x00076399, 0x001415E6, 0, 0, 0, 0_

_// 2.71828, 0.26787, 7.3891, 20.0855, 0, 0, 0, 0_

C

void  DSP_VectorExp (_Q16 * outVector , _Q16 * inVector , int  N );