Complex 16Bit Vector API#
 group vect_complex_s16_api
Functions

headroom_t vect_complex_s16_add(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#
Add one complex 16bit vector to another.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
,b_imag[]
,c_real[]
andc_imag[]
.length
is the number of elements in each of the vectors.b_shr
andc_shr
are the signed arithmetic rightshifts applied to each element of \(\bar b\) and \(\bar c\) respectively. Operation Performed:
 \[\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{16}(\lfloor b_k \cdot 2^{b\_shr} \rfloor) \\ & c_k' \leftarrow sat_{16}(\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\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) and \(\bar c\) are the complex 16bit 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 16bit 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_s16_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\).
See also
 Parameters:
a_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
b_shr – [in] Rightshift applied to \(\bar b\)
c_shr – [in] Rightshift applied to \(\bar c\)
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of output vector \(\bar a\).

headroom_t vect_complex_s16_add_scalar(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const complex_s16_t c, const unsigned length, const right_shift_t b_shr)#
Add a scalar to a complex 16bit vector.
a[]
andb[]
represent the complex 16bit mantissa vectors \(\bar a\) and \(\bar b\) respectively. Each must begin at a wordaligned address. This operation can be performed safely inplace onb[]
.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 rightshift applied to each element 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'\} + Re\{c\} \\ & Im\{a_k\} \leftarrow Im\{b_k'\} + Im\{c\} \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If elements of \(\bar b\) are the complex mantissas of BFP vector \( \bar{b} \cdot 2^{b\_exp}\), and \(c\) is the mantissa of floatingpoint 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_s16_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_s16_add_scalar_prepare()
, but is not a parameter to this function. The \(c\_shr\) produced byvect_complex_s16_add_scalar_prepare()
is to be applied by the user, and the result passed as inputc
.
See also
 Parameters:
a_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of 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] Rightshift applied to \(\bar b\)
 Throws ET_LOAD_STORE:
Raised if
a
orb
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of output vector \(\bar a\).

headroom_t vect_complex_s16_conj_mul(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t a_shr)#
Multiply one complex 16bit vector elementwise by the complex conjugate of another.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
,b_imag[]
,c_real[]
andc_imag[]
.length
is the number of elements in each of the vectors.a_shr
is the unsigned arithmetic rightshift applied to the 32bit accumulators holding the penultimate results. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k = \leftarrow Re\{b_k\} \cdot Re\{c_k\} + Im\{b_k\} \cdot Im\{c_k\} \\ & s_k = \leftarrow Im\{b_k\} \cdot Re\{c_k\}  Re\{b_k\} \cdot Im\{c_k\} \\ & Re\{a_k\} \leftarrow round( sat_{16}( v_k \cdot 2^{a\_shr} ) ) \\ & Im\{a_k\} \leftarrow round( sat_{16}( s_k \cdot 2^{a\_shr} ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint
If \(\bar b\) are the complex 16bit mantissas of a BFP vector \(\bar{b} \cdot 2^{b\_exp}\) and \(c\) is the complex 16bit mantissa of floatingpoint 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_s16_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\).
See also
 Parameters:
a_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
a_shr – [in] Rightshift applied to 32bit intermediate results.
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_headroom(const int16_t b_real[], const int16_t b_imag[], const unsigned length)#
Calculate the headroom of a complex 16bit array.
The headroom of an Nbit integer is the number of bits that the integer’s value may be leftshifted without any information being lost. Equivalently, it is one less than the number of leading sign bits.
The headroom of a
complex_s16_t
struct is the minimum of the headroom of each of its 16bit fields,re
andim
.The headroom of a
complex_s16_t
array is the minimum of the headroom of each of itscomplex_s16_t
elements.This function efficiently traverses the elements of \(\bar x\) to determine its headroom.
b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\).length
is the number of elements inb_real[]
andb_imag[]
. Operation Performed:
 \[\begin{flalign*} min\!\{ HR_{16}\left(x_0\right), HR_{16}\left(x_1\right), ..., HR_{16}\left(x_{length1}\right) \} && \end{flalign*}\]
 Parameters:
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
length – [in] Number of elements in \(\bar x\)
 Returns:
Headroom of vector \(\bar x\)

headroom_t vect_complex_s16_mag(int16_t a[], const int16_t b_real[], const int16_t b_imag[], const unsigned length, const right_shift_t b_shr, const int16_t *rot_table, const unsigned table_rows)#
Compute the magnitude of each element of a complex 16bit vector.
a[]
represents the real 16bit output mantissa vector \(\bar a\).b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
orb_imag[]
.length
is the number of elements in each of the vectors.b_shr
is the signed arithmetic rightshift applied to elements of \(\bar b\).rot_table
must point to a precomputed 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_table16_rows; const extern complex_s16_t rot_table16[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.
 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\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \( \bar{b} \cdot 2^{b\_exp} \), then the resulting vector \(\bar a\) are the real 16bit mantissas of BFP vector \(\bar{a} \cdot 2^{a\_exp}\), where \(a\_exp = b\_exp + b\_shr\).
The function vect_complex_s16_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\).
See also
 Parameters:
a – [out] Real output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imag part of complex input vector \(\bar b\)
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
b_shr – [in] Rightshift appled to \(\bar b\)
rot_table – [in] Precomputed rotation table required for calculating magnitudes
table_rows – [in] Number of rows in
rot_table
 Throws ET_LOAD_STORE:
Raised if
a
,b_real
orb_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\).

headroom_t vect_complex_s16_macc(int16_t acc_real[], int16_t acc_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t acc_shr, const right_shift_t bc_sat)#
Multiply one complex 16bit vector elementwise by another, and add the result to an accumulator.
acc_real[]
andacc_imag[]
together represent the complex 16bit accumulator mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isacc_real[k]
, and each \(Im\{a_k\}\) isacc_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address.
length
is the number of elements in each of the vectors.acc_shr
is the signed arithmetic rightshift applied to the accumulators \(a_k\).bc_sat
is the unsigned arithmetic rightshift applied to the product of \(b_k\) and \(c_k\) before being added to the accumulator. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k \leftarrow Re\{b_k\} \cdot Re\{c_k\}  Im\{b_k\} \cdot Im\{c_k\} \\ & s_k \leftarrow Im\{b_k\} \cdot Re\{c_k\} + Re\{b_k\} \cdot Im\{c_k\} \\ & \hat{a}_k \leftarrow sat_{16}( a_k \cdot 2^{acc\_shr} ) \\ & Re\{a_k\} \leftarrow sat_{16}( Re\{\hat{a}_k\} + round( sat_{16}( v_k \cdot 2^{bc\_sat} ) ) ) \\ & Im\{a_k\} \leftarrow sat_{16}( Im\{\hat{a}_k\} + round( sat_{16}( s_k \cdot 2^{bc\_sat} ) ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

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 + bc\_sat \).
The function vect_complex_s16_macc_prepare() can be used to obtain values for \(a\_exp\), \(acc\_shr\) and \(bc\_sat\) based on the input exponents \(a\_exp\), \(b\_exp\) and \(c\_exp\) and the input headrooms \(a\_hr\), \(b\_hr\) and \(c\_hr\).
See also
 Parameters:
acc_real – [inout] Real part of complex accumulator \(\bar a\)
acc_imag – [inout] Imaginary aprt of complex accumulator \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
acc_shr – [in] Signed arithmetic rightshift applied to accumulator elements.
bc_sat – [in] Unsigned arithmetic rightshift applied to the products of elements \(b_k\) and \(c_k\)
 Throws ET_LOAD_STORE:
Raised if
acc_real
,acc_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_nmacc(int16_t acc_real[], int16_t acc_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t acc_shr, const right_shift_t bc_sat)#
Multiply one complex 16bit vector elementwise by another, and subtract the result from an accumulator.
acc_real[]
andacc_imag[]
together represent the complex 16bit accumulator mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isacc_real[k]
, and each \(Im\{a_k\}\) isacc_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address.
length
is the number of elements in each of the vectors.acc_shr
is the signed arithmetic rightshift applied to the accumulators \(a_k\).bc_sat
is the unsigned arithmetic rightshift applied to the product of \(b_k\) and \(c_k\) before being subtracted from the accumulator. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k \leftarrow Re\{b_k\} \cdot Re\{c_k\}  Im\{b_k\} \cdot Im\{c_k\} \\ & s_k \leftarrow Im\{b_k\} \cdot Re\{c_k\} + Re\{b_k\} \cdot Im\{c_k\} \\ & \hat{a}_k \leftarrow sat_{16}( a_k \cdot 2^{acc\_shr} ) \\ & Re\{a_k\} \leftarrow sat_{16}( Re\{\hat{a}_k\}  round( sat_{16}( v_k \cdot 2^{bc\_sat} ) ) ) \\ & Im\{a_k\} \leftarrow sat_{16}( Im\{\hat{a}_k\}  round( sat_{16}( s_k \cdot 2^{bc\_sat} ) ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

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 + bc\_sat \).
The function vect_complex_s16_nmacc_prepare() can be used to obtain values for \(a\_exp\), \(acc\_shr\) and \(bc\_sat\) based on the input exponents \(a\_exp\), \(b\_exp\) and \(c\_exp\) and the input headrooms \(a\_hr\), \(b\_hr\) and \(c\_hr\).
See also
 Parameters:
acc_real – [inout] Real part of complex accumulator \(\bar a\)
acc_imag – [inout] Imaginary aprt of complex accumulator \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
acc_shr – [in] Signed arithmetic rightshift applied to accumulator elements.
bc_sat – [in] Unsigned arithmetic rightshift applied to the products of elements \(b_k\) and \(c_k\)
 Throws ET_LOAD_STORE:
Raised if
acc_real
,acc_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_conj_macc(int16_t acc_real[], int16_t acc_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t acc_shr, const right_shift_t bc_sat)#
Multiply one complex 16bit vector elementwise by the complex conjugate of another, and add the result to an accumulator.
acc_real[]
andacc_imag[]
together represent the complex 16bit accumulator mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isacc_real[k]
, and each \(Im\{a_k\}\) isacc_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address.
length
is the number of elements in each of the vectors.acc_shr
is the signed arithmetic rightshift applied to the accumulators \(a_k\).bc_sat
is the unsigned arithmetic rightshift applied to the product of \(b_k\) and \(c_k^*\) before being added to the accumulator. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k \leftarrow Re\{b_k\} \cdot Re\{c_k\} + Im\{b_k\} \cdot Im\{c_k\} \\ & s_k \leftarrow Im\{b_k\} \cdot Re\{c_k\}  Re\{b_k\} \cdot Im\{c_k\} \\ & \hat{a}_k \leftarrow sat_{16}( a_k \cdot 2^{acc\_shr} ) \\ & Re\{a_k\} \leftarrow sat_{16}( Re\{\hat{a}_k\} + round( sat_{16}( v_k \cdot 2^{bc\_sat} ) ) ) \\ & Im\{a_k\} \leftarrow sat_{16}( Im\{\hat{a}_k\} + round( sat_{16}( s_k \cdot 2^{bc\_sat} ) ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

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 + bc\_sat \).
The function vect_complex_s16_macc_prepare() can be used to obtain values for \(a\_exp\), \(acc\_shr\) and \(bc\_sat\) based on the input exponents \(a\_exp\), \(b\_exp\) and \(c\_exp\) and the input headrooms \(a\_hr\), \(b\_hr\) and \(c\_hr\).
See also
 Parameters:
acc_real – [inout] Real part of complex accumulator \(\bar a\)
acc_imag – [inout] Imaginary aprt of complex accumulator \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
acc_shr – [in] Signed arithmetic rightshift applied to accumulator elements.
bc_sat – [in] Unsigned arithmetic rightshift applied to the products of elements \(b_k\) and \(c_k^*\)
 Throws ET_LOAD_STORE:
Raised if
acc_real
,acc_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_conj_nmacc(int16_t acc_real[], int16_t acc_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t acc_shr, const right_shift_t bc_sat)#
Multiply one complex 16bit vector elementwise by the complex conjugate of another, and subtract the result from an accumulator.
acc_real[]
andacc_imag[]
together represent the complex 16bit accumulator mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isacc_real[k]
, and each \(Im\{a_k\}\) isacc_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address.
length
is the number of elements in each of the vectors.acc_shr
is the signed arithmetic rightshift applied to the accumulators \(a_k\).bc_sat
is the unsigned arithmetic rightshift applied to the product of \(b_k\) and \(c_k^*\) before being subtracted from the accumulator. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k \leftarrow Re\{b_k\} \cdot Re\{c_k\} + Im\{b_k\} \cdot Im\{c_k\} \\ & s_k \leftarrow Im\{b_k\} \cdot Re\{c_k\}  Re\{b_k\} \cdot Im\{c_k\} \\ & \hat{a}_k \leftarrow sat_{16}( a_k \cdot 2^{acc\_shr} ) \\ & Re\{a_k\} \leftarrow sat_{16}( Re\{\hat{a}_k\}  round( sat_{16}( v_k \cdot 2^{bc\_sat} ) ) ) \\ & Im\{a_k\} \leftarrow sat_{16}( Im\{\hat{a}_k\}  round( sat_{16}( s_k \cdot 2^{bc\_sat} ) ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

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 + bc\_sat \).
The function vect_complex_s16_macc_prepare() can be used to obtain values for \(a\_exp\), \(acc\_shr\) and \(bc\_sat\) based on the input exponents \(a\_exp\), \(b\_exp\) and \(c\_exp\) and the input headrooms \(a\_hr\), \(b\_hr\) and \(c\_hr\).
See also
 Parameters:
acc_real – [inout] Real part of complex accumulator \(\bar a\)
acc_imag – [inout] Imaginary aprt of complex accumulator \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
acc_shr – [in] Signed arithmetic rightshift applied to accumulator elements.
bc_sat – [in] Unsigned arithmetic rightshift applied to the products of elements \(b_k\) and \(c_k^*\)
 Throws ET_LOAD_STORE:
Raised if
acc_real
,acc_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_mul(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t a_shr)#
Multiply one complex 16bit vector elementwise by another.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
,b_imag[]
,c_real[]
andc_imag[]
.length
is the number of elements in each of the vectors.a_shr
is the unsigned arithmetic rightshift applied to the 32bit accumulators holding intermediate results. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k = \leftarrow Re\{b_k\} \cdot Re\{c_k\}  Im\{b_k\} \cdot Im\{c_k\} \\ & s_k = \leftarrow Im\{b_k\} \cdot Re\{c_k\} + Re\{b_k\} \cdot Im\{c_k\} \\ & Re\{a_k\} \leftarrow round( sat_{16}( v_k \cdot 2^{a\_shr} ) ) \\ & Im\{a_k\} \leftarrow round( sat_{16}( s_k \cdot 2^{a\_shr} ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint
If \(\bar b\) are the complex 16bit mantissas of a BFP vector \(\bar{b} \cdot 2^{b\_exp}\) and \(c\) is the complex 16bit mantissa of floatingpoint 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_s16_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\).
See also
 Parameters:
a_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
a_shr – [in] Rightshift applied to 32bit intermediate results.
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_real_mul(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const unsigned length, const right_shift_t a_shr)#
Multiply a complex 16bit vector elementwise by a real 16bit vector.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
represents the real 16bit input mantissa vector \(\bar c\).Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
,b_imag[]
andc_real[]
.length
is the number of elements in each of the vectors.a_shr
is the unsigned arithmetic rightshift applied to the 32bit accumulators holding the penultimate results. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k = \leftarrow Re\{b_k\} \cdot c_k \\ & s_k = \leftarrow Im\{b_k\} \cdot c_k \\ & Re\{a_k\} \leftarrow round( sat_{16}( v_k \cdot 2^{a\_shr} ) ) \\ & Im\{a_k\} \leftarrow round( sat_{16}( s_k \cdot 2^{a\_shr} ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \( \bar{b} \cdot 2^{b\_exp} \) and \(c\) is the complex 16bit mantissa of floatingpoint 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_s16_real_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\).
See also
 Parameters:
a_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
a_shr – [in] Rightshift applied to 32bit intermediate results.
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
,b_imag
orc_real
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\).

headroom_t vect_complex_s16_real_scale(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c, const unsigned length, const right_shift_t a_shr)#
Multiply a complex 16bit vector by a real scalar.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
andb_imag[]
.c
is the real 16bit input mantissa \(c\).length
is the number of elements in each of the vectors.a_shr
is an unsigned arithmetic rightshift applied to the 32bit accumulators holding the penultimate results. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k = \leftarrow Re\{b_k\} \cdot c \\ & s_k = \leftarrow Im\{b_k\} \cdot c \\ & Re\{a_k\} \leftarrow round( sat_{16}( v_k \cdot 2^{a\_shr} ) ) \\ & Im\{a_k\} \leftarrow round( sat_{16}( s_k \cdot 2^{a\_shr} ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \( \bar{b} \cdot 2^{b\_exp} \) and \(c\) is the complex 16bit mantissa of floatingpoint 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_s16_real_scale_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_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c – [in] Real input scalar \(c\)
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
a_shr – [in] Rightshift applied to 32bit intermediate results.
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
,b_imag
orc
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\).

headroom_t vect_complex_s16_scale(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real, const int16_t c_imag, const unsigned length, const right_shift_t a_shr)#
Multiply a complex 16bit vector by a complex 16bit scalar.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
andb_imag[]
.c_real
andc_imag
are the real and imaginary parts of the complex 16bit input mantissa \(c\).length
is the number of elements in each of the vectors.a_shr
is the unsigned arithmetic rightshift applied to the 32bit accumulators holding the penultimate results. Operation Performed:
 \[\begin{split}\begin{flalign*} & v_k = \leftarrow Re\{b_k\} \cdot Re\{c\}  Im\{b_k\} \cdot Im\{c\} \\ & s_k = \leftarrow Im\{b_k\} \cdot Re\{c\} + Re\{b_k\} \cdot Im\{c\} \\ & Re\{a_k\} \leftarrow round( sat_{16}( v_k \cdot 2^{a\_shr} ) ) \\ & Im\{a_k\} \leftarrow round( sat_{16}( s_k \cdot 2^{a\_shr} ) ) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \( \bar{b} \cdot 2^{b\_exp} \) and \(c\) is the complex 16bit mantissa of floatingpoint 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_s16_scale_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_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input scalar \(c\)
c_imag – [in] Imaginary part of complex input scalar \(c\)
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
a_shr – [in] Rightshift applied to 32bit intermediate results
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\).

void vect_complex_s16_set(int16_t a_real[], int16_t a_imag[], const int16_t b_real, const int16_t b_imag, const unsigned length)#
Set each element of a complex 16bit vector to a specified value.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
. Each must begin at a wordaligned address.b_real
andb_imag
are the real and imaginary parts of the complex 16bit input mantissa \(b\). Eacha_real[k]
will be set tob_real
. Eacha_imag[k]
will be set tob_imag
.length
is the number of elements ina_real[]
anda_imag[]
. Operation Performed:
 \[\begin{split}\begin{flalign*} & Re\{a_k\} \leftarrow Re\{b\} \\ & Im\{a_k\} \leftarrow Im\{b\} \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(b\) is the mantissa of floatingpoint 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_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input scalar \(b\)
b_imag – [in] Imaginary part of complex input scalar \(b\)
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
 Throws ET_LOAD_STORE:
Raised if
a_real
ora_imag
is not wordaligned (See Note: Vector Alignment)

headroom_t vect_complex_s16_shl(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const unsigned length, const left_shift_t b_shl)#
Leftshift each element of a complex 16bit vector by a specified number of bits.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
andb_imag[]
.length
is the number of elements in \(\bar a\) and \(\bar b\).b_shl
is the signed arithmetic leftshift applied to each element of \(\bar b\). Operation Performed:
 \[\begin{split}\begin{flalign*} & Re\{a_k\} \leftarrow sat_{16}(\lfloor Re\{b_k\} \cdot 2^{b\_shl} \rfloor) \\ & Im\{a_k\} \leftarrow sat_{16}(\lfloor Im\{b_k\} \cdot 2^{b\_shl} \rfloor) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \( \bar{b} \cdot 2^{b\_exp} \), then the resulting vector \(\bar a\) are the complex 16bit 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_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
b_shl – [in] Leftshift applied to \(\bar b\)
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
orb_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_shr(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const unsigned length, const right_shift_t b_shr)#
Rightshift each element of a complex 16bit vector by a specified number of bits.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
andb_imag[]
.length
is the number of elements in \(\bar a\) and \(\bar b\).b_shr
is the signed arithmetic rightshift applied to each element of \(\bar b\). Operation Performed:
 \[\begin{split}\begin{flalign*} & Re\{a_k\} \leftarrow sat_{16}(\lfloor Re\{b_k\} \cdot 2^{b\_shr} \rfloor) \\ & Im\{a_k\} \leftarrow sat_{16}(\lfloor Im\{b_k\} \cdot 2^{b\_shr} \rfloor) \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \( \bar{b} \cdot 2^{b\_exp} \), then the resulting vector \(\bar a\) are the complex 16bit 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_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
b_shr – [in] Rightshift applied to \(\bar b\)
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
orb_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of the output vector \(\bar a\)

headroom_t vect_complex_s16_squared_mag(int16_t a[], const int16_t b_real[], const int16_t b_imag[], const unsigned length, const right_shift_t a_shr)#
Get the squared magnitudes of elements of a complex 16bit vector.
a[]
represents the real 16bit output mantissa vector \(\bar a\).b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.Each of the input vectors must begin at a wordaligned address.
length
is the number of elements in each of the vectors.a_shr
is the unsigned arithmetic rightshift applied to the 32bit accumulators holding the penultimate results. Operation Performed:
 \[\begin{split}\begin{flalign*} & a_k \leftarrow ((Re\{b_k'\})^2 + (Im\{b_k'\})^2)\cdot 2^{a\_shr} \\ & \qquad\text{ for }k\in 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \( \bar{b} \cdot 2^{b\_exp} \), then the resulting vector \(\bar a\) are the real 16bit mantissas of BFP vector \(\bar{a} \cdot 2^{a\_exp}\), where \(a\_exp = 2 \cdot b\_exp + a\_shr\).
The function vect_complex_s16_squared_mag_prepare() can be used to obtain values for \(a\_exp\) and \(a\_shr\) based on the input exponent \(b\_exp\) and headroom \(b\_hr\).
See also
 Parameters:
a – [out] Real output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
a_shr – [in] Rightshift appled to 32bit intermediate results
 Throws ET_LOAD_STORE:
Raised if
a
,b_real
orb_imag
is not wordaligned (See Note: Vector Alignment)

headroom_t vect_complex_s16_sub(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#
Subtract one complex 16bit vector from another.
a_real[]
anda_imag[]
together represent the complex 16bit output mantissa vector \(\bar a\). Each \(Re\{a_k\}\) isa_real[k]
, and each \(Im\{a_k\}\) isa_imag[k]
.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.c_real[]
andc_imag[]
together represent the complex 16bit input mantissa vector \(\bar c\). Each \(Re\{c_k\}\) isc_real[k]
, and each \(Im\{c_k\}\) isc_imag[k]
.Each of the input vectors must begin at a wordaligned address. This operation can be performed safely inplace on inputs
b_real[]
,b_imag[]
,c_real[]
andc_imag[]
.length
is the number of elements in each of the vectors.b_shr
andc_shr
are the signed arithmetic rightshifts applied to each element of \(\bar b\) and \(\bar c\) respectively. Operation Performed:
 \[\begin{split}\begin{flalign*} & b_k' \leftarrow sat_{16}(\lfloor b_k \cdot 2^{b\_shr} \rfloor) \\ & c_k' \leftarrow sat_{16}(\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\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) and \(\bar c\) are the complex 16bit 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 16bit 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_s16_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\).
See also
 Parameters:
a_real – [out] Real part of complex output vector \(\bar a\)
a_imag – [out] Imaginary aprt of complex output vector \(\bar a\)
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
c_real – [in] Real part of complex input vector \(\bar c\)
c_imag – [in] Imaginary part of complex input vector \(\bar c\)
length – [in] Number of elements in vectors \(\bar a\), \(\bar b\) and \(\bar c\)
b_shr – [in] Rightshift applied to \(\bar b\)
c_shr – [in] Rightshift applied to \(\bar c\)
 Throws ET_LOAD_STORE:
Raised if
a_real
,a_imag
,b_real
,b_imag
,c_real
orc_imag
is not wordaligned (See Note: Vector Alignment) Returns:
Headroom of output vector \(\bar a\).

complex_s32_t vect_complex_s16_sum(const int16_t b_real[], const int16_t b_imag[], const unsigned length)#
Get the sum of elements of a complex 16bit vector.
b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\), and must both begin at a wordaligned address. Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.length
is the number of elements in \(\bar b\). Operation Performed:
 \[\begin{split}\begin{flalign*} & Re\{a\} \leftarrow \sum_{k=0}^{length1} \left( Re\{b_k\} \right) \\ & Im\{a\} \leftarrow \sum_{k=0}^{length1} \left( Im\{b_k\} \right) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the mantissas of BFP vector \(\bar{b} \cdot 2^{b\_exp}\), then the returned value \(a\) is the complex 32bit mantissa of floatingpoint value \(a \cdot 2^{a\_exp}\), where \(a\_exp = b\_exp\).
 Parameters:
b_real – [in] Real part of complex input vector \(\bar b\)
b_imag – [in] Imaginary part of complex input vector \(\bar b\)
length – [in] Number of elements in vector \(\bar b\).
 Throws ET_LOAD_STORE:
Raised if
b_real
orb_imag
is not wordaligned (See Note: Vector Alignment) Returns:
\(a\), the 32bit complex sum of elements in \(\bar b\).

void vect_complex_s16_to_vect_complex_s32(complex_s32_t a[], const int16_t b_real[], const int16_t b_imag[], const unsigned length)#
Convert a complex 16bit vector into a complex 32bit vector.
a[]
represents the complex 32bit output vector \(\bar a\). It must begin at a double word (8byte) aligned address.b_real[]
andb_imag[]
together represent the complex 16bit input mantissa vector \(\bar b\). Each \(Re\{b_k\}\) isb_real[k]
, and each \(Im\{b_k\}\) isb_imag[k]
.The parameter
length
is the number of elements in each of the vectors.length
is the number of elements in each of the vectors. 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 0\ ...\ (length1) && \end{flalign*}\end{split}\]
 Block FloatingPoint

If \(\bar b\) are the complex 16bit mantissas of a BFP vector \(\bar{b} \cdot 2^{b\_exp}\), then the resulting vector \(\bar a\) are the complex 32bit mantissas of BFP vector \(\bar{a} \cdot 2^{a\_exp}\), where \(a\_exp = b\_exp\).
 Notes
The headroom of output vector \(\bar a\) is not returned by this function. The headroom of the output is always 16 bits greater than the headroom of the input.
 Parameters:
a – [out] Complex output vector \(\bar a\).
b_real – [in] Real part of complex input vector \(\bar b\).
b_imag – [in] Imaginary part of complex input vector \(\bar b\).
length – [in] Number of elements in vectors \(\bar a\) and \(\bar b\)
 Throws ET_LOAD_STORE:
Raised if
a
is not doublewordaligned (See Note: Vector Alignment)

headroom_t vect_complex_s16_add(int16_t a_real[], int16_t a_imag[], const int16_t b_real[], const int16_t b_imag[], const int16_t c_real[], const int16_t c_imag[], const unsigned length, const right_shift_t b_shr, const right_shift_t c_shr)#