XCORE SDK
XCORE Software Development Kit
xs3_vect_complex_s32.h
1 // Copyright 2020-2021 XMOS LIMITED.
2 // This Software is subject to the terms of the XMOS Public Licence: Version 1.
3 
4 #pragma once
5 
6 #include "xs3_math_conf.h"
7 #include "xs3_math_types.h"
8 #include "xs3_util.h"
9 
10 #ifdef __XC__
11 extern "C" {
12 #endif
13 
14 
78 C_API
80  complex_s32_t a[],
81  const complex_s32_t b[],
82  const complex_s32_t c[],
83  const unsigned length,
84  const right_shift_t b_shr,
85  const right_shift_t c_shr);
86 
87 
100 #define xs3_vect_complex_s32_add_prepare xs3_vect_s32_add_prepare
101 
102 
158 C_API
160  complex_s32_t a[],
161  const complex_s32_t b[],
162  const complex_s32_t c,
163  const unsigned length,
164  const right_shift_t b_shr);
165 
166 
180 #define xs3_vect_complex_s32_add_scalar_prepare xs3_vect_s32_add_prepare
181 
229 C_API
231  complex_s32_t a[],
232  const complex_s32_t b[],
233  const complex_s32_t c[],
234  const unsigned length,
235  const right_shift_t b_shr,
236  const right_shift_t c_shr);
237 
238 
251 #define xs3_vect_complex_s32_conj_mul_prepare xs3_vect_complex_s32_mul_prepare
252 
253 
289 C_API
291  const complex_s32_t x[],
292  const unsigned length);
293 
294 
362 C_API
364  complex_s32_t acc[],
365  const complex_s32_t b[],
366  const complex_s32_t c[],
367  const unsigned length,
368  const right_shift_t acc_shr,
369  const right_shift_t b_shr,
370  const right_shift_t c_shr);
371 
372 
440 C_API
442  complex_s32_t acc[],
443  const complex_s32_t b[],
444  const complex_s32_t c[],
445  const unsigned length,
446  const right_shift_t acc_shr,
447  const right_shift_t b_shr,
448  const right_shift_t c_shr);
449 
450 
518 C_API
520  complex_s32_t acc[],
521  const complex_s32_t b[],
522  const complex_s32_t c[],
523  const unsigned length,
524  const right_shift_t acc_shr,
525  const right_shift_t b_shr,
526  const right_shift_t c_shr);
527 
528 
596 C_API
598  complex_s32_t acc[],
599  const complex_s32_t b[],
600  const complex_s32_t c[],
601  const unsigned length,
602  const right_shift_t acc_shr,
603  const right_shift_t b_shr,
604  const right_shift_t c_shr);
605 
606 
688 C_API
690  exponent_t* new_acc_exp,
691  right_shift_t* acc_shr,
692  right_shift_t* b_shr,
693  right_shift_t* c_shr,
694  const exponent_t acc_exp,
695  const exponent_t b_exp,
696  const exponent_t c_exp,
697  const exponent_t acc_hr,
698  const headroom_t b_hr,
699  const headroom_t c_hr);
700 
701 
714 #define xs3_vect_complex_s32_nmacc_prepare xs3_vect_complex_s32_macc_prepare
715 
716 
730 #define xs3_vect_complex_s32_conj_macc_prepare xs3_vect_complex_s32_macc_prepare
731 
732 
746 #define xs3_vect_complex_s32_conj_nmacc_prepare xs3_vect_complex_s32_macc_prepare
747 
748 
807 C_API
809  int32_t a[],
810  const complex_s32_t b[],
811  const unsigned length,
812  const right_shift_t b_shr,
813  const complex_s32_t* rot_table,
814  const unsigned table_rows);
815 
861 C_API
863  exponent_t* a_exp,
864  right_shift_t* b_shr,
865  const exponent_t b_exp,
866  const headroom_t b_hr);
867 
868 
917 C_API
919  complex_s32_t a[],
920  const complex_s32_t b[],
921  const complex_s32_t c[],
922  const unsigned length,
923  const right_shift_t b_shr,
924  const right_shift_t c_shr);
925 
926 
991 C_API
993  exponent_t* a_exp,
994  right_shift_t* b_shr,
995  right_shift_t* c_shr,
996  const exponent_t b_exp,
997  const exponent_t c_exp,
998  const headroom_t b_hr,
999  const headroom_t c_hr);
1000 
1001 
1052 C_API
1054  complex_s32_t a[],
1055  const complex_s32_t b[],
1056  const int32_t c[],
1057  const unsigned length,
1058  const right_shift_t b_shr,
1059  const right_shift_t c_shr);
1060 
1061 
1124 C_API
1126  exponent_t* a_exp,
1127  right_shift_t* b_shr,
1128  right_shift_t* c_shr,
1129  const exponent_t b_exp,
1130  const exponent_t c_exp,
1131  const headroom_t b_hr,
1132  const headroom_t c_hr);
1133 
1134 
1180 C_API
1182  complex_s32_t a[],
1183  const complex_s32_t b[],
1184  const int32_t c,
1185  const unsigned length,
1186  const right_shift_t b_shr,
1187  const right_shift_t c_shr);
1188 
1189 
1202 #define xs3_vect_complex_s32_real_scale_prepare xs3_vect_s32_mul_prepare
1203 
1204 
1253 C_API
1255  complex_s32_t a[],
1256  const complex_s32_t b[],
1257  const int32_t c_real,
1258  const int32_t c_imag,
1259  const unsigned length,
1260  const right_shift_t b_shr,
1261  const right_shift_t c_shr);
1262 
1263 
1326 C_API
1328  exponent_t* a_exp,
1329  right_shift_t* b_shr,
1330  right_shift_t* c_shr,
1331  const exponent_t b_exp,
1332  const exponent_t c_exp,
1333  const headroom_t b_hr,
1334  const headroom_t c_hr);
1335 
1336 
1368 C_API
1370  complex_s32_t a[],
1371  const int32_t b_real,
1372  const int32_t b_imag,
1373  const unsigned length);
1374 
1375 
1411 C_API
1413  complex_s32_t a[],
1414  const complex_s32_t b[],
1415  const unsigned length,
1416  const left_shift_t b_shl);
1417 
1418 
1454 C_API
1456  complex_s32_t a[],
1457  const complex_s32_t b[],
1458  const unsigned length,
1459  const right_shift_t b_shr);
1460 
1461 
1500 C_API
1502  int32_t a[],
1503  const complex_s32_t b[],
1504  const unsigned length,
1505  const right_shift_t b_shr);
1506 
1507 
1553 C_API
1555  exponent_t* a_exp,
1556  right_shift_t* b_shr,
1557  const exponent_t b_exp,
1558  const headroom_t b_hr);
1559 
1560 
1612 C_API
1614  complex_s32_t a[],
1615  const complex_s32_t b[],
1616  const complex_s32_t c[],
1617  const unsigned length,
1618  const right_shift_t b_shr,
1619  const right_shift_t c_shr);
1620 
1621 
1634 #define xs3_vect_complex_s32_sub_prepare xs3_vect_s32_add_prepare
1635 
1636 
1689 C_API
1691  complex_s64_t* a,
1692  const complex_s32_t b[],
1693  const unsigned length,
1694  const right_shift_t b_shr);
1695 
1696 
1747 C_API
1749  exponent_t* a_exp,
1750  right_shift_t* b_shr,
1751  const exponent_t b_exp,
1752  const headroom_t b_hr,
1753  const unsigned length);
1754 
1755 
1791 C_API
1793  complex_s32_t x[],
1794  const unsigned length);
1795 
1796 
1828 C_API
1830  complex_s32_t a[],
1831  const complex_s32_t b[],
1832  const unsigned length);
1833 
1834 
1835 #ifdef __XC__
1836 } //extern "C"
1837 #endif
1838 
int exponent_t
An exponent.
Definition: xs3_math_types.h:76
int left_shift_t
A leftwards arithmetic bit-shift.
Definition: xs3_math_types.h:110
int right_shift_t
A rightwards arithmetic bit-shift.
Definition: xs3_math_types.h:98
unsigned headroom_t
Headroom of some integer or integer array.
Definition: xs3_math_types.h:86
headroom_t xs3_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.
Definition: xs3_vect.c:230
headroom_t xs3_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.
Definition: xs3_vect.c:153
headroom_t xs3_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.
Definition: xs3_vect.c:173
headroom_t xs3_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.
Definition: xs3_vect_complex_mul.c:257
headroom_t xs3_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.
Definition: xs3_vect_complex_mul.c:187
headroom_t xs3_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.
Definition: xs3_vect_complex_mag.c:74
headroom_t xs3_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.
Definition: xs3_vect_complex_mag.c:146
headroom_t xs3_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.
Definition: xs3_vect_complex_macc.c:97
void xs3_vect_complex_s32_tail_reverse(complex_s32_t x[], const unsigned length)
Reverses the order of the tail of a complex 32-bit vector.
Definition: xs3_fft_util.c:250
headroom_t xs3_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,...
Definition: xs3_vect_complex_conj_macc.c:97
headroom_t xs3_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 accumulat...
Definition: xs3_vect_complex_macc.c:129
void xs3_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.
Definition: xs3_vect_set.c:35
headroom_t xs3_vect_complex_s32_headroom(const complex_s32_t x[], const unsigned length)
Calculate the headroom of a complex 32-bit array.
Definition: xs3_vect.c:145
headroom_t xs3_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.
Definition: xs3_vect.c:132
headroom_t xs3_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.
Definition: xs3_vect_complex_mul.c:159
headroom_t xs3_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.
Definition: xs3_vect.c:164
headroom_t xs3_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.
Definition: xs3_vect_complex_conjugate.c:13
void xs3_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.
Definition: xs3_vect_complex_sum.c:29
headroom_t xs3_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,...
Definition: xs3_vect_complex_conj_macc.c:129
headroom_t xs3_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.
Definition: xs3_vect.c:183
headroom_t xs3_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.
Definition: xs3_vect_complex_mul.c:221
void xs3_vect_complex_s32_sum_prepare(exponent_t *a_exp, right_shift_t *b_shr, const exponent_t b_exp, const headroom_t b_hr, const unsigned length)
Obtain the output exponent and input shift used by xs3_vect_complex_s32_sum().
Definition: xs3_complex_prepare.c:416
void xs3_vect_complex_s32_macc_prepare(exponent_t *new_acc_exp, right_shift_t *acc_shr, right_shift_t *b_shr, right_shift_t *c_shr, const exponent_t acc_exp, const exponent_t b_exp, const exponent_t c_exp, const exponent_t acc_hr, const headroom_t b_hr, const headroom_t c_hr)
Obtain the output exponent and shifts needed by xs3_vect_complex_s32_macc().
Definition: xs3_complex_prepare.c:199
void xs3_vect_complex_s32_squared_mag_prepare(exponent_t *a_exp, right_shift_t *b_shr, const exponent_t b_exp, const headroom_t b_hr)
Obtain the output exponent and input shift used by xs3_vect_complex_s32_squared_mag().
Definition: xs3_complex_prepare.c:386
void xs3_vect_complex_s32_real_mul_prepare(exponent_t *a_exp, right_shift_t *b_shr, right_shift_t *c_shr, const exponent_t b_exp, const exponent_t c_exp, const headroom_t b_hr, const headroom_t c_hr)
Obtain the output exponent and input shifts used by xs3_vect_complex_s32_real_mul().
Definition: xs3_complex_prepare.c:270
void xs3_vect_complex_s32_mag_prepare(exponent_t *a_exp, right_shift_t *b_shr, const exponent_t b_exp, const headroom_t b_hr)
Obtain the output exponent and input shift used by xs3_vect_complex_s32_mag() and xs3_vect_complex_s1...
Definition: xs3_complex_prepare.c:257
void xs3_vect_complex_s32_mul_prepare(exponent_t *a_exp, right_shift_t *b_shr, right_shift_t *c_shr, const exponent_t b_exp, const exponent_t c_exp, const headroom_t b_hr, const headroom_t c_hr)
Obtain the output exponent and input shifts used by xs3_vect_complex_s32_mul() and xs3_vect_complex_s...
Definition: xs3_complex_prepare.c:307
void xs3_vect_complex_s32_scale_prepare(exponent_t *a_exp, right_shift_t *b_shr, right_shift_t *c_shr, const exponent_t b_exp, const exponent_t c_exp, const headroom_t b_hr, const headroom_t c_hr)
Obtain the output exponent and input shifts used by xs3_vect_complex_s32_scale().
Definition: xs3_complex_prepare.c:350
A complex number with a 32-bit real part and 32-bit imaginary part.
Definition: xs3_math_types.h:49
A complex number with a 64-bit real part and 64-bit imaginary part.
Definition: xs3_math_types.h:38