# Complex 32-Bit Vector API#

group vect_complex_s32_api

Functions

headroom_t vect_complex_s32_add(complex_s32_t a[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#

Add one complex 32-bit vector to another.

a[], b[] and c[] represent the complex 32-bit mantissa vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$ respectively. Each must begin at a word-aligned address. This operation can be performed safely in-place on b[] or c[].

length is the number of elements in each of the vectors.

b_shr and c_shr are the signed arithmetic right-shifts applied to each element of $$\bar b$$ and $$\bar c$$ respectively.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & c_k' \leftarrow sat_{32}(\lfloor c_k \cdot 2^{-c\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow Re\{b_k'\} + Re\{c_k'\} \\ & Im\{a_k\} \leftarrow Im\{b_k'\} + Im\{c_k'\} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ and $$\bar c$$ are the complex 32-bit mantissas of BFP vectors $$\bar{b} \cdot 2^{b\_exp}$$ and $$\bar{c} \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the complex 32-bit mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$.

In this case, $$b\_shr$$ and $$c\_shr$$ must be chosen so that $$a\_exp = b\_exp + b\_shr = c\_exp + c\_shr$$. Adding or subtracting mantissas only makes sense if they are associated with the same exponent.

The function vect_complex_s32_add_prepare() can be used to obtain values for $$a\_exp$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$

• b_shr[in] Right-shift applied to $$\bar b$$

• c_shr[in] Right-shift applied to $$\bar c$$

Raised if a, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of output vector $$\bar a$$.

headroom_t vect_complex_s32_add_scalar(complex_s32_t a[], const complex_s32_t b[], const complex_s32_t c, const unsigned length, const right_shift_t b_shr)#

Add a scalar to a complex 32-bit vector.

a[] and b[]represent the complex 32-bit mantissa vectors $$\bar a$$ and $$\bar b$$ respectively. Each must begin at a word-aligned address. This operation can be performed safely in-place on b[].

c is the complex scalar $$c$$to be added to each element of $$\bar b$$.

length is the number of elements in each of the vectors.

b_shr is the signed arithmetic right-shift applied to each element of $$\bar b$$.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow Re\{b_k'\} + Re\{c\} \\ & Im\{a_k\} \leftarrow Im\{b_k'\} + Im\{c\} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If elements of $$\bar b$$ are the complex mantissas of BFP vector $$\bar{b} \cdot 2^{b\_exp}$$, and $$c$$ is the mantissa of floating-point value $$c \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$.

In this case, $$b\_shr$$ and $$c\_shr$$ must be chosen so that $$a\_exp = b\_exp + b\_shr = c\_exp + c\_shr$$. Adding or subtracting mantissas only makes sense if they are associated with the same exponent.

The function vect_complex_s32_add_scalar_prepare() can be used to obtain values for $$a\_exp$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Note that $$c\_shr$$ is an output of vect_complex_s32_add_scalar_prepare(), but is not a parameter to this function. The $$c\_shr$$ produced by vect_complex_s32_add_scalar_prepare() is to be applied by the user, and the result passed as input c.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input scalar $$c$$

• length[in] Number of elements in vectors $$\bar a$$ and $$\bar b$$

• b_shr[in] Right-shift applied to $$\bar b$$

Raised if a or b is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of output vector $$\bar a$$.

headroom_t vect_complex_s32_conj_mul(complex_s32_t a[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply one complex 32-bit vector element-wise by the complex conjugate of another.

a[], b[] and c[] represent the 32-bit mantissa vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$ respectively. Each must begin at a word-aligned address. This operation can be performed safely in-place on b[] or c[].

length is the number of elements in each of the vectors.

b_shr and c_shr are the signed arithmetic right-shifts applied to each element of $$\bar b$$ and $$\bar c$$ respectively.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & c_k' \leftarrow sat_{32}(\lfloor c_k \cdot 2^{-c\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow \left( Re\{b_k'\} \cdot Re\{c_k'\} + Im\{b_k'\} \cdot Im\{c_k'\} \right) \cdot 2^{-30} \\ & Im\{a_k\} \leftarrow \left( Im\{b_k'\} \cdot Re\{c_k'\} - Re\{b_k'\} \cdot Im\{c_k'\} \right) \cdot 2^{-30} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$ and $$c$$ is the complex 32-bit mantissa of floating-point value $$c \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + c\_exp + a\_shr$$.

The function vect_complex_s32_conj_mul_prepare() can be used to obtain values for $$a\_exp$$ and $$a\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$

• b_shr[in] Right-shift applied to elements of $$\bar b$$.

• c_shr[in] Right-shift applied to elements of $$\bar c$$.

Raised if a, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

Calculate the headroom of a complex 32-bit array.

The headroom of an N-bit integer is the number of bits that the integer’s value may be left-shifted without any information being lost. Equivalently, it is one less than the number of leading sign bits.

The headroom of a complex_s32_t struct is the minimum of the headroom of each of its 32-bit fields, re and im.

The headroom of a complex_s32_t array is the minimum of the headroom of each of its complex_s32_t elements.

This function efficiently traverses the elements of $$\bar x$$ to determine its headroom.

x[] represents the complex 32-bit vector $$\bar x$$. x[] must begin at a word-aligned address.

length is the number of elements in x[].

Operation Performed:

\begin{flalign*} min\!\{ HR_{32}\left(x_0\right), HR_{32}\left(x_1\right), ..., HR_{32}\left(x_{length-1}\right) \} && \end{flalign*}

Parameters:
• x[in] Complex input vector $$\bar x$$

• length[in] Number of elements in $$\bar x$$

Raised if x is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of vector $$\bar x$$

headroom_t vect_complex_s32_macc(complex_s32_t acc[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t acc_shr, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply one complex 32-bit vector element-wise by another, and add the result to an accumulator.

acc[] represents the complex 32-bit accumulator mantissa vector $$\bar a$$. Each $$a_k$$ is acc[k].

b[] and c[] represent the complex 32-bit input mantissa vectors $$\bar b$$ and $$\bar c$$, where each $$b_k$$ is b[k] and each $$c_k$$ is c[k].

Each of the input vectors must begin at a word-aligned address.

length is the number of elements in each of the vectors.

acc_shr, b_shr and c_shr are the signed arithmetic right-shifts applied to input elements $$a_k$$, $$b_k$$ and $$c_k$$.

Operation Performed:

\begin{split}\begin{flalign*} & \tilde{b}_k \leftarrow sat_{32}( b_k \cdot 2^{-b\_shr} ) \\ & \tilde{c}_k \leftarrow sat_{32}( c_k \cdot 2^{-c\_shr} ) \\ & \tilde{a}_k \leftarrow sat_{32}( a_k \cdot 2^{-acc\_shr} ) \\ & v_k \leftarrow round( sat_{32}( ( Re\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} - Im\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & s_k \leftarrow round( sat_{32}( ( Im\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} + Re\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & Re\{a_k\} \leftarrow sat_{32}( Re\{\tilde{a}_k\} + v_k ) \\ & Im\{a_k\} \leftarrow sat_{32}( Im\{\tilde{a}_k\} + s_k ) \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If inputs $$\bar b$$ and $$\bar c$$ are the mantissas of BFP vectors $$\bar{b} \cdot 2^{b\_exp}$$ and $$\bar{c} \cdot 2^{c\_exp}$$, and input $$\bar a$$ is the accumulator BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, then the output values of $$\bar a$$ have the exponent $$2^{a\_exp + acc\_shr}$$.

For accumulation to make sense mathematically, $$bc\_sat$$ must be chosen such that $$a\_exp + acc\_shr = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_macc_prepare() can be used to obtain values for $$a\_exp$$, $$acc\_shr$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$a\_exp$$, $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$a\_hr$$, $$b\_hr$$ and $$c\_hr$$.

Parameters:
• acc[inout] Complex accumulator $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$

• acc_shr[in] Signed arithmetic right-shift applied to accumulator elements.

• b_shr[in] Signed arithmetic right-shift applied to elements of $$\bar b$$

• c_shr[in] Signed arithmetic right-shift applied to elements of $$\bar c$$

Raised if acc, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

headroom_t vect_complex_s32_nmacc(complex_s32_t acc[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t acc_shr, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply one complex 32-bit vector element-wise by another, and subtract the result from an accumulator.

acc[] represents the complex 32-bit accumulator mantissa vector $$\bar a$$. Each $$a_k$$ is acc[k].

b[] and c[] represent the complex 32-bit input mantissa vectors $$\bar b$$ and $$\bar c$$, where each $$b_k$$ is b[k] and each $$c_k$$ is c[k].

Each of the input vectors must begin at a word-aligned address.

length is the number of elements in each of the vectors.

acc_shr, b_shr and c_shr are the signed arithmetic right-shifts applied to input elements $$a_k$$, $$b_k$$ and $$c_k$$.

Operation Performed:

\begin{split}\begin{flalign*} & \tilde{b}_k \leftarrow sat_{32}( b_k \cdot 2^{-b\_shr} ) \\ & \tilde{c}_k \leftarrow sat_{32}( c_k \cdot 2^{-c\_shr} ) \\ & \tilde{a}_k \leftarrow sat_{32}( a_k \cdot 2^{-acc\_shr} ) \\ & v_k \leftarrow round( sat_{32}( ( Re\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} - Im\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & s_k \leftarrow round( sat_{32}( ( Im\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} + Re\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & Re\{a_k\} \leftarrow sat_{32}( Re\{\tilde{a}_k\} - v_k ) \\ & Im\{a_k\} \leftarrow sat_{32}( Im\{\tilde{a}_k\} - s_k ) \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If inputs $$\bar b$$ and $$\bar c$$ are the mantissas of BFP vectors $$\bar{b} \cdot 2^{b\_exp}$$ and $$\bar{c} \cdot 2^{c\_exp}$$, and input $$\bar a$$ is the accumulator BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, then the output values of $$\bar a$$ have the exponent $$2^{a\_exp + acc\_shr}$$.

For accumulation to make sense mathematically, $$bc\_sat$$ must be chosen such that $$a\_exp + acc\_shr = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_macc_prepare() can be used to obtain values for $$a\_exp$$, $$acc\_shr$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$a\_exp$$, $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$a\_hr$$, $$b\_hr$$ and $$c\_hr$$.

Parameters:
• acc[inout] Complex accumulator $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$

• acc_shr[in] Signed arithmetic right-shift applied to accumulator elements.

• b_shr[in] Signed arithmetic right-shift applied to elements of $$\bar b$$

• c_shr[in] Signed arithmetic right-shift applied to elements of $$\bar c$$

Raised if acc, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

headroom_t vect_complex_s32_conj_macc(complex_s32_t acc[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t acc_shr, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply one complex 32-bit vector element-wise by the complex conjugate of another, and add the result to an accumulator.

acc[] represents the complex 32-bit accumulator mantissa vector $$\bar a$$. Each $$a_k$$ is acc[k].

b[] and c[] represent the complex 32-bit input mantissa vectors $$\bar b$$ and $$\bar c$$, where each $$b_k$$ is b[k] and each $$c_k$$ is c[k].

Each of the input vectors must begin at a word-aligned address.

length is the number of elements in each of the vectors.

acc_shr, b_shr and c_shr are the signed arithmetic right-shifts applied to input elements $$a_k$$, $$b_k$$ and $$c_k$$.

Operation Performed:

\begin{split}\begin{flalign*} & \tilde{b}_k \leftarrow sat_{32}( b_k \cdot 2^{-b\_shr} ) \\ & \tilde{c}_k \leftarrow sat_{32}( c_k \cdot 2^{-c\_shr} ) \\ & \tilde{a}_k \leftarrow sat_{32}( a_k \cdot 2^{-acc\_shr} ) \\ & v_k \leftarrow round( sat_{32}( ( Re\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} + Im\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & s_k \leftarrow round( sat_{32}( ( Im\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} - Re\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & Re\{a_k\} \leftarrow sat_{32}( Re\{\tilde{a}_k\} + v_k ) \\ & Im\{a_k\} \leftarrow sat_{32}( Im\{\tilde{a}_k\} + s_k ) \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If inputs $$\bar b$$ and $$\bar c$$ are the mantissas of BFP vectors $$\bar{b} \cdot 2^{b\_exp}$$ and $$\bar{c} \cdot 2^{c\_exp}$$, and input $$\bar a$$ is the accumulator BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, then the output values of $$\bar a$$ have the exponent $$2^{a\_exp + acc\_shr}$$.

For accumulation to make sense mathematically, $$bc\_sat$$ must be chosen such that $$a\_exp + acc\_shr = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_conj_macc_prepare() can be used to obtain values for $$a\_exp$$, $$acc\_shr$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$a\_exp$$, $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$a\_hr$$, $$b\_hr$$ and $$c\_hr$$.

Parameters:
• acc[inout] Complex accumulator $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$

• acc_shr[in] Signed arithmetic right-shift applied to accumulator elements.

• b_shr[in] Signed arithmetic right-shift applied to elements of $$\bar b$$

• c_shr[in] Signed arithmetic right-shift applied to elements of $$\bar c$$

Raised if acc, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

headroom_t vect_complex_s32_conj_nmacc(complex_s32_t acc[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t acc_shr, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply one complex 32-bit vector element-wise by the complex conjugate of another, and subtract the result from an accumulator.

acc[] represents the complex 32-bit accumulator mantissa vector $$\bar a$$. Each $$a_k$$ is acc[k].

b[] and c[] represent the complex 32-bit input mantissa vectors $$\bar b$$ and $$\bar c$$, where each $$b_k$$ is b[k] and each $$c_k$$ is c[k].

Each of the input vectors must begin at a word-aligned address.

length is the number of elements in each of the vectors.

acc_shr, b_shr and c_shr are the signed arithmetic right-shifts applied to input elements $$a_k$$, $$b_k$$ and $$c_k$$.

Operation Performed:

\begin{split}\begin{flalign*} & \tilde{b}_k \leftarrow sat_{32}( b_k \cdot 2^{-b\_shr} ) \\ & \tilde{c}_k \leftarrow sat_{32}( c_k \cdot 2^{-c\_shr} ) \\ & \tilde{a}_k \leftarrow sat_{32}( a_k \cdot 2^{-acc\_shr} ) \\ & v_k \leftarrow round( sat_{32}( ( Re\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} + Im\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & s_k \leftarrow round( sat_{32}( ( Im\{\tilde{b}_k\} \cdot Re\{\tilde{c}_k\} - Re\{\tilde{b}_k\} \cdot Im\{\tilde{c}_k\} ) \cdot 2^{-30}) ) \\ & Re\{a_k\} \leftarrow sat_{32}( Re\{\tilde{a}_k\} - v_k ) \\ & Im\{a_k\} \leftarrow sat_{32}( Im\{\tilde{a}_k\} - s_k ) \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If inputs $$\bar b$$ and $$\bar c$$ are the mantissas of BFP vectors $$\bar{b} \cdot 2^{b\_exp}$$ and $$\bar{c} \cdot 2^{c\_exp}$$, and input $$\bar a$$ is the accumulator BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, then the output values of $$\bar a$$ have the exponent $$2^{a\_exp + acc\_shr}$$.

For accumulation to make sense mathematically, $$bc\_sat$$ must be chosen such that $$a\_exp + acc\_shr = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_conj_nmacc_prepare() can be used to obtain values for $$a\_exp$$, $$acc\_shr$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$a\_exp$$, $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$a\_hr$$, $$b\_hr$$ and $$c\_hr$$.

Parameters:
• acc[inout] Complex accumulator $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$

• acc_shr[in] Signed arithmetic right-shift applied to accumulator elements.

• b_shr[in] Signed arithmetic right-shift applied to elements of $$\bar b$$

• c_shr[in] Signed arithmetic right-shift applied to elements of $$\bar c$$

Raised if acc, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

headroom_t vect_complex_s32_mag(int32_t a[], const complex_s32_t b[], const unsigned length, const right_shift_t b_shr, const complex_s32_t *rot_table, const unsigned table_rows)#

Compute the magnitude of each element of a complex 32-bit vector.

a[] represents the real 32-bit output mantissa vector $$\bar a$$.

b[] represents the complex 32-bit input mantissa vector $$\bar b$$.

a[] and b[] must each begin at a word-aligned address.

length is the number of elements in each of the vectors.

b_shr is the signed arithmetic right-shift applied to elements of $$\bar b$$.

rot_table must point to a pre-computed table of complex vectors used in calculating the magnitudes. table_rows is the number of rows in the table. This library is distributed with a default version of the required rotation table. The following symbols can be used to refer to it in user code:

const extern unsigned rot_table32_rows;
const extern complex_s32_t rot_table32[30][4];


Faster computation (with reduced precision) can be achieved by generating a smaller version of the table. A python script is provided to generate this table.

Todo:

Point to documentation page on generating this table.

Operation Performed:

\begin{split}\begin{flalign*} & v_k \leftarrow b_k \cdot 2^{-b\_shr} \\ & a_k \leftarrow \sqrt { {\left( Re\{v_k\} \right)}^2 + {\left( Im\{v_k\} \right)}^2 } & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$, then the resulting vector $$\bar a$$ are the real 32-bit mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + b\_shr$$.

The function vect_complex_s32_mag_prepare() can be used to obtain values for $$a\_exp$$ and $$b\_shr$$ based on the input exponent $$b\_exp$$ and headroom $$b\_hr$$.

Parameters:
• a[out] Real output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• length[in] Number of elements in vectors $$\bar a$$ and $$\bar b$$

• b_shr[in] Right-shift appled to $$\bar b$$

• rot_table[in] Pre-computed rotation table required for calculating magnitudes

• table_rows[in] Number of rows in rot_table

Raised if a or b is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$.

headroom_t vect_complex_s32_mul(complex_s32_t a[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply one complex 32-bit vector element-wise by another.

a[], b[] and c[] represent the 32-bit mantissa vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$ respectively. Each must begin at a word-aligned address. This operation can be performed safely in-place on b[] or c[].

length is the number of elements in each of the vectors.

b_shr and c_shr are the signed arithmetic right-shifts applied to each element of $$\bar b$$ and $$\bar c$$ respectively.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & c_k' \leftarrow sat_{32}(\lfloor c_k \cdot 2^{-c\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow \left( Re\{b_k'\} \cdot Re\{c_k'\} - Im\{b_k'\} \cdot Im\{c_k'\} \right) \cdot 2^{-30} \\ & Im\{a_k\} \leftarrow \left( Im\{b_k'\} \cdot Re\{c_k'\} + Re\{b_k'\} \cdot Im\{c_k'\} \right) \cdot 2^{-30} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$ and $$c$$ is the complex 32-bit mantissa of floating-point value $$c \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_mul_prepare() can be used to obtain values for $$a\_exp$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$, and $$\bar c$$

• b_shr[in] Right-shift appled to $$\bar b$$

• c_shr[in] Right-shift appled to $$\bar c$$

Raised if a, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

headroom_t vect_complex_s32_real_mul(complex_s32_t a[], const complex_s32_t b[], const int32_t c[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply a complex 32-bit vector element-wise by a real 32-bit vector.

a[] and b[] represent the complex 32-bit mantissa vectors $$\bar a$$ and $$\bar b$$ respectively.

c[] represents the real 32-bit mantissa vector $$\bar c$$.

a[], b[], and c[] each must begin at a word-aligned address. This operation can be performed safely in-place on b[].

length is the number of elements in each of the vectors.

b_shr and c_shr are the signed arithmetic right-shifts applied to each element of $$\bar b$$ and $$\bar c$$ respectively.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & c_k' \leftarrow sat_{32}(\lfloor c_k \cdot 2^{-c\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow \left( Re\{b_k'\} \cdot c_k' \right) \cdot 2^{-30} \\ & Im\{a_k\} \leftarrow \left( Im\{b_k'\} \cdot c_k' \right) \cdot 2^{-30} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$ and $$c$$ is the complex 32-bit mantissa of floating-point value $$c \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_real_mul_prepare() can be used to obtain values for $$a\_exp$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$.

• b[in] Complex input vector $$\bar b$$.

• c[in] Real input vector $$\bar c$$.

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$, and $$\bar c$$.

• b_shr[in] Right-shift appled to $$\bar b$$.

• c_shr[in] Right-shift appled to $$\bar c$$.

Raised if a, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$.

headroom_t vect_complex_s32_real_scale(complex_s32_t a[], const complex_s32_t b[], const int32_t c, const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply a complex 32-bit vector by a real scalar.

a[] and b[] represent the complex 32-bit mantissa vectors $$\bar a$$ and $$\bar b$$ respectively.

c represents the real 32-bit scale factor $$c$$.

a[] and b[] each must begin at a word-aligned address. This operation can be performed safely in-place on b[].

length is the number of elements in each of the vectors.

b_shr and c_shr are the signed arithmetic right-shift applied to each element of $$\bar b$$ and to $$c$$.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow Re\{b_k'\} \cdot c \\ & Im\{a_k\} \leftarrow Im\{b_k'\} \cdot c \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 16-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$ and $$c$$ is the complex 16-bit mantissa of floating-point value $$c \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_real_scale_prepare() can be used to obtain values for $$a\_exp$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$, and $$\bar c$$

• b_shr[in] Right-shift applied to $$\bar b$$

• c_shr[in] Right-shift applied to $$c$$

Raised if a or b is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$.

headroom_t vect_complex_s32_scale(complex_s32_t a[], const complex_s32_t b[], const int32_t c_real, const int32_t c_imag, const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#

Multiply a complex 32-bit vector by a complex 32-bit scalar.

a[] and b[] represent the complex 32-bit mantissa vectors $$\bar a$$ and $$\bar b$$ respectively.

c represents the complex 32-bit scale factor $$c$$.

a[] and b[] each must begin at a word-aligned address. This operation can be performed safely in-place on b[].

length is the number of elements in each of the vectors.

b_shr and c_shr are the signed arithmetic right-shifts applied to each element of $$\bar b$$ and to $$c$$.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow \left( Re\{v_k\} \cdot Re\{c\} - Im\{v_k\} \cdot Im\{c\} \right) \cdot 2^{-30} \\ & Im\{a_k\} \leftarrow \left( Re\{v_k\} \cdot Im\{c\} + Im\{v_k\} \cdot Re\{c\} \right) \cdot 2^{-30} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$ and $$c$$ is the complex 32-bit mantissa of floating-point value $$c \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + c\_exp + b\_shr + c\_shr$$.

The function vect_complex_s32_mul_prepare() can be used to obtain values for $$a\_exp$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$.

• b[in] Complex input vector $$\bar b$$.

• c_real[in] Real part of $$c$$

• c_imag[in] Imaginary part of $$c$$

• length[in] Number of elements in vectors $$\bar a$$ and $$\bar b$$.

• b_shr[in] Right-shift appled to $$\bar b$$.

• c_shr[in] Right-shift applied to $$c$$.

Raised if a or b is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$.

void vect_complex_s32_set(complex_s32_t a[], const int32_t b_real, const int32_t b_imag, const unsigned length)#

Set each element of a complex 32-bit vector to a specified value.

a[] represents a complex 32-bit vector $$\bar a$$. a[] must begin at a word-aligned address.

b_real and b_imag are the real and imaginary parts to which each element will be set.

length is the number of elements in a[].

Operation Performed:

\begin{split}\begin{flalign*} & a_k \leftarrow b\_real + j\cdot b\_imag \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) \\ & \qquad\text{ where } j^2 = -1 && \end{flalign*}\end{split}

Block Floating-Point

If $$b$$ is the mantissa of floating-point value $$b \cdot 2^{b\_exp}$$, then the output vector $$\bar a$$ are the mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b_real[in] Value to set real part of elements of $$\bar a$$ to

• b_imag[in] Value to set imaginary part of elements of $$\bar a$$ to

• length[in] Number of elements in $$\bar a$$

Raised if a is not word-aligned (See Note: Vector Alignment)

headroom_t vect_complex_s32_shl(complex_s32_t a[], const complex_s32_t b[], const unsigned length, const left_shift_t b_shl)#

Left-shift each element of a complex 32-bit vector by a specified number of bits.

a[] and b[] represent the complex 32-bit mantissa vectors $$\bar a$$ and $$\bar b$$ respectively. Each must begin at a word-aligned address. This operation can be performed safely in-place on b[].

length is the number of elements in $$\bar a$$ and $$\bar b$$.

b_shl is the signed arithmetic left-shift applied to each element of $$\bar b$$.

Operation Performed:

\begin{split}\begin{flalign*} & Re\{a_k\} \leftarrow sat_{32}(\lfloor Re\{b_k\} \cdot 2^{b\_shl} \rfloor) \\ & Im\{a_k\} \leftarrow sat_{32}(\lfloor Im\{b_k\} \cdot 2^{b\_shl} \rfloor) \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$, then the resulting vector $$\bar a$$ are the complex 32-bit mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$\bar{a} = \bar{b} \cdot 2^{b\_shl}$$ and $$a\_exp = b\_exp$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• length[in] Number of elements in vector $$\bar b$$

• b_shl[in] Left-shift applied to $$\bar b$$

Raised if a or b is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

headroom_t vect_complex_s32_shr(complex_s32_t a[], const complex_s32_t b[], const unsigned length, const right_shift_t b_shr)#

Right-shift each element of a complex 32-bit vector by a specified number of bits.

a[] and b[] represent the complex 32-bit mantissa vectors $$\bar a$$ and $$\bar b$$ respectively. Each must begin at a word-aligned address. This operation can be performed safely in-place on b[].

length is the number of elements in $$\bar a$$ and $$\bar b$$.

b_shr is the signed arithmetic right-shift applied to each element of $$\bar b$$.

Operation Performed:

\begin{split}\begin{flalign*} & Re\{a_k\} \leftarrow sat_{32}(\lfloor Re\{b_k\} \cdot 2^{-b\_shr} \rfloor) \\ & Im\{a_k\} \leftarrow sat_{32}(\lfloor Im\{b_k\} \cdot 2^{-b\_shr} \rfloor) \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$, then the resulting vector $$\bar a$$ are the complex 32-bit mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$\bar{a} = \bar{b} \cdot 2^{-b\_shr}$$ and $$a\_exp = b\_exp$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• length[in] Number of elements in vector $$\bar b$$

• b_shr[in] Right-shift applied to $$\bar b$$

Raised if a or b is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$

headroom_t vect_complex_s32_squared_mag(int32_t a[], const complex_s32_t b[], const unsigned length, const right_shift_t b_shr)#

Computes the squared magnitudes of elements of a complex 32-bit vector.

a[] represents the complex 32-bit mantissa vector $$\bar a$$. b[] represents the real 32-bit mantissa vector $$\bar b$$. Each must begin at a word-aligned address.

length is the number of elements in each of the vectors.

b_shr is the signed arithmetic right-shift appled to each element of $$\bar b$$.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & a_k \leftarrow ((Re\{b_k'\})^2 + (Im\{b_k'\})^2)\cdot 2^{-30} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$, then the resulting vector $$\bar a$$ are the real 32-bit mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = 2 \cdot (b\_exp + b\_shr)$$.

The function vect_complex_s32_squared_mag_prepare() can be used to obtain values for $$a\_exp$$ and $$b\_shr$$ based on the input exponent $$b\_exp$$ and headroom $$b\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• length[in] Number of elements in vectors $$\bar a$$ and $$\bar b$$

• b_shr[in] Right-shift appled to $$\bar b$$

Raised if a is not double word-aligned or b is not word-aligned (See Note: Vector Alignment)

headroom_t vect_complex_s32_sub(complex_s32_t a[], const complex_s32_t b[], const complex_s32_t c[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#

Subtract one complex 32-bit vector from another.

a[], b[] and c[] represent the complex 32-bit mantissa vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$ respectively. Each must begin at a word-aligned address. This operation can be performed safely in-place on b[] or c[].

length is the number of elements in each of the vectors.

b_shr and c_shr are the signed arithmetic right-shifts applied to each element of $$\bar b$$ and $$\bar c$$ respectively.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{32}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & c_k' \leftarrow sat_{32}(\lfloor c_k \cdot 2^{-c\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow Re\{b_k'\} - Re\{c_k'\} \\ & Im\{a_k\} \leftarrow Im\{b_k'\} - Im\{c_k'\} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ and $$\bar c$$ are the complex 32-bit mantissas of BFP vectors $$\bar{b} \cdot 2^{b\_exp}$$ and $$\bar{c} \cdot 2^{c\_exp}$$, then the resulting vector $$\bar a$$ are the complex 32-bit mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$.

In this case, $$b\_shr$$ and $$c\_shr$$ must be chosen so that $$a\_exp = b\_exp + b\_shr = c\_exp + c\_shr$$. Adding or subtracting mantissas only makes sense if they are associated with the same exponent.

The function vect_complex_s32_sub_prepare() can be used to obtain values for $$a\_exp$$, $$b\_shr$$ and $$c\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Parameters:
• a[out] Complex output vector $$\bar a$$

• b[in] Complex input vector $$\bar b$$

• c[in] Complex input vector $$\bar c$$

• length[in] Number of elements in vectors $$\bar a$$, $$\bar b$$ and $$\bar c$$

• b_shr[in] Right-shift applied to $$\bar b$$

• c_shr[in] Right-shift applied to $$\bar c$$

Raised if a, b or c is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of output vector $$\bar a$$.

void vect_complex_s32_sum(complex_s64_t *a, const complex_s32_t b[], const unsigned length, const right_shift_t b_shr)#

Compute the sum of elements of a complex 32-bit vector.

a is the complex 64-bit mantissa of the resulting sum.

b[] represents the complex 32-bit mantissa vector $$\bar b$$. b[] must begin at a word-aligned address.

length is the number of elements in $$\bar b$$.

b_shr is the unsigned arithmetic right-shift appled to each element of $$\bar b$$. b_shr cannot be negative.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow b_k \cdot 2^{-b\_shr} \\ & Re\{a\} \leftarrow \sum_{k=0}^{length-1} \left( Re\{b_k'\} \right) \\ & Im\{a\} \leftarrow \sum_{k=0}^{length-1} \left( Im\{b_k'\} \right) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the mantissas of BFP vector $$\bar{b} \cdot 2^{b\_exp}$$, then $$a$$ is the complex 64-bit mantissa of floating-point value $$a \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + b\_shr$$.

The function vect_complex_s32_sum_prepare() can be used to obtain values for $$a\_exp$$ and $$b\_shr$$ based on the input exponents $$b\_exp$$ and $$c\_exp$$ and the input headrooms $$b\_hr$$ and $$c\_hr$$.

Internally the sum accumulates into four separate complex 40-bit accumulators. These accumulators apply symmetric 40-bit saturation logic (with bounds $$\pm 2^{39}-1$$) with each added element. At the end, the 4 accumulators are summed together into the 64-bit fields of a. No saturation logic is applied at this final step.

In the most extreme case, each $$b_k$$ may be $$-2^{31}$$. $$256$$ of these added into the same accumulator is $$-2^{39}$$ which would saturate to $$-2^{39}+1$$, introducing 1 LSb of error (which may or may not be acceptable given a particular circumstance). The final result for each part then may be as large as $$4\cdot(-2^{39}+1) = -2^{41}+4$$, each fitting into a 42-bit signed integer.

Parameters:
• a[out] Complex sum $$a$$

• b[in] Complex input vector $$\bar b$$.

• length[in] Number of elements in vector $$\bar b$$.

• b_shr[in] Right-shift appled to $$\bar b$$.

Raised if b is not word-aligned (See Note: Vector Alignment)

void vect_complex_s32_tail_reverse(complex_s32_t x[], const unsigned length)#

Reverses the order of the tail of a complex 32-bit vector.

Reverses the order of elements in the tail of the complex 32-bit vector $$\bar x$$. The tail of $$\bar x$$, in this context, is all elements of $$\bar x$$ except for $$x_0$$. In other words, the first element $$x_0$$ remains where it is, and the remaining $$length-1$$ elements are rearranged to have their order reversed.

This function is used when performing a forward or inverse FFT on a single sequence of real values (i.e. the mono FFT), and operates in-place on x[].

Parameter Details

x[] represents the complex 32-bit vector $$\bar x$$, which is both an input to and an output of this function. x[] must begin at a word-aligned address.

length is the number of elements in $$\bar x$$.

Operation Performed:

\begin{split}\begin{flalign*} & x_0 \leftarrow x_0 \\ & x_k \leftarrow x_{length - k} \\ & \qquad\text{ for }k\in 1\ ...\ (length-1) && \end{flalign*}\end{split}

Parameters:
• x[inout] Complex vector to have its tail reversed.

• length[in] Number of elements in $$\bar x$$

Raised if x is not word-aligned (See Note: Vector Alignment)

headroom_t vect_complex_s32_conjugate(complex_s32_t a[], const complex_s32_t b[], const unsigned length)#

Get the complex conjugate of a complex 32-bit vector.

The complex conjugate of a complex scalar $$z = x + yi$$ is $$z^* = x - yi$$. This function computes the complex conjugate of each element of $$\bar b$$ (negates the imaginary part of each element) and places the result in $$\bar a$$.

a[] is the complex 32-bit output vector $$\bar a$$.

b[] is the complex 32-bit input vector $$\bar b$$.

Both a and b must point to word-aligned addresses.

length is the number of elements in $$\bar a$$ and $$\bar b$$.

Operation Performed:

\begin{split}\begin{flalign*} & Re\{a_k\} \leftarrow Re\{b_k\} \\ & Im\{a_k\} \leftarrow - Im\{b_k\} \\ & \qquad\text{ for }k\in 1\ ...\ (length-1) && \end{flalign*}\end{split}

Parameters:
• a[out] Complex 32-bit output vector $$\bar a$$

• b[in] Complex 32-bit input vector $$\bar b$$

• length[in] Number of elements in vectors $$\bar a$$ and $$\bar b$$

Raised if a or b is not word-aligned (See Note: Vector Alignment)

Returns:

Headroom of the output vector $$\bar a$$.

void vect_complex_s32_to_vect_complex_s16(int16_t a_real[], int16_t a_imag[], const complex_s32_t b[], const unsigned length, const right_shift_t b_shr)#

Convert a complex 32-bit vector into a complex 16-bit vector.

This function converts a complex 32-bit mantissa vector $$\bar b$$ into a complex 16-bit mantissa vector $$\bar a$$. Conceptually, the output BFP vector $$\bar{a}\cdot 2^{a\_exp}$$ represents the same value as the input BFP vector $$\bar{b}\cdot 2^{b\_exp}$$, only with a reduced bit-depth.

In most cases $$b\_shr$$ should be $$16 - b\_hr$$, where $$b\_hr$$ is the headroom of the 32-bit input mantissa vector $$\bar b$$. The output exponent $$a\_exp$$ will then be given by

$$a\_exp = b\_exp + b\_shr$$

Parameter Details

a_real[] and a_imag[] together represent the complex 16-bit output mantissa vector $$\bar a$$, with the real part of each $$a_k$$ going in a_real[] and the imaginary part going in a_imag[].

b[] represents the complex 32-bit mantissa vector $$\bar b$$.

a_real[], a_imag[] and b[] must each begin at a word-aligned address.

length is the number of elements in each of the vectors.

b_shr is the signed arithmetic right-shift applied to elements of $$\bar b$$.

Operation Performed:

\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{16}(\lfloor b_k \cdot 2^{-b\_shr} \rfloor) \\ & Re\{a_k\} \leftarrow Re\{b_k'\} \\ & Im\{a_k\} \leftarrow Im\{b_k'\} \\ & \qquad\text{ for }k\in 0\ ...\ (length-1) && \end{flalign*}\end{split}

Block Floating-Point

If $$\bar b$$ are the complex 32-bit mantissas of a BFP vector $$\bar{b} \cdot 2^{b\_exp}$$, then the resulting vector $$\bar a$$ are the complex 16-bit mantissas of BFP vector $$\bar{a} \cdot 2^{a\_exp}$$, where $$a\_exp = b\_exp + b\_shr$$.

Parameters:
• a_real[out] Real part of complex output vector $$\bar a$$.

• a_imag[out] Imaginary part of complex output vector $$\bar a$$.

• b[in] Complex input vector $$\bar b$$.

• length[in] Number of elements in vectors $$\bar a$$ and $$\bar b$$

• b_shr[in] Right-shift appled to $$\bar b$$.

Raised if a_real, a_imag or b are not word-aligned (See Note: Vector Alignment)