XCORE SDK
XCORE Software Development Kit
xs3_vect_complex_s16.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 
15 
91 C_API
93  int16_t a_real[],
94  int16_t a_imag[],
95  const int16_t b_real[],
96  const int16_t b_imag[],
97  const int16_t c_real[],
98  const int16_t c_imag[],
99  const unsigned length,
100  const right_shift_t b_shr,
101  const right_shift_t c_shr);
102 
103 
116 #define xs3_vect_complex_s16_add_prepare xs3_vect_s32_add_prepare
117 
118 
176 C_API
178  int16_t a_real[],
179  int16_t a_imag[],
180  const int16_t b_real[],
181  const int16_t b_imag[],
182  const complex_s16_t c,
183  const unsigned length,
184  const right_shift_t b_shr);
185 
186 
200 #define xs3_vect_complex_s16_add_scalar_prepare xs3_vect_s32_add_prepare
201 
202 
260 C_API
262  int16_t a_real[],
263  int16_t a_imag[],
264  const int16_t b_real[],
265  const int16_t b_imag[],
266  const int16_t c_real[],
267  const int16_t c_imag[],
268  const unsigned length,
269  const right_shift_t a_shr);
270 
271 
284 #define xs3_vect_complex_s16_conj_mul_prepare xs3_vect_complex_s16_mul_prepare
285 
320 C_API
322  const int16_t b_real[],
323  const int16_t b_imag[],
324  const unsigned length);
325 
326 
388 C_API
390  int16_t a[],
391  const int16_t b_real[],
392  const int16_t b_imag[],
393  const unsigned length,
394  const right_shift_t b_shr,
395  const int16_t* rot_table,
396  const unsigned table_rows);
397 
398 
469 C_API
471  int16_t acc_real[],
472  int16_t acc_imag[],
473  const int16_t b_real[],
474  const int16_t b_imag[],
475  const int16_t c_real[],
476  const int16_t c_imag[],
477  const unsigned length,
478  const right_shift_t acc_shr,
479  const right_shift_t bc_sat);
480 
481 
549 C_API
551  int16_t acc_real[],
552  int16_t acc_imag[],
553  const int16_t b_real[],
554  const int16_t b_imag[],
555  const int16_t c_real[],
556  const int16_t c_imag[],
557  const unsigned length,
558  const right_shift_t acc_shr,
559  const right_shift_t bc_sat);
560 
561 
630 C_API
632  int16_t acc_real[],
633  int16_t acc_imag[],
634  const int16_t b_real[],
635  const int16_t b_imag[],
636  const int16_t c_real[],
637  const int16_t c_imag[],
638  const unsigned length,
639  const right_shift_t acc_shr,
640  const right_shift_t bc_sat);
641 
642 
711 C_API
713  int16_t acc_real[],
714  int16_t acc_imag[],
715  const int16_t b_real[],
716  const int16_t b_imag[],
717  const int16_t c_real[],
718  const int16_t c_imag[],
719  const unsigned length,
720  const right_shift_t acc_shr,
721  const right_shift_t bc_sat);
722 
723 
802 C_API
804  exponent_t* new_acc_exp,
805  right_shift_t* acc_shr,
806  right_shift_t* bc_sat,
807  const exponent_t acc_exp,
808  const exponent_t b_exp,
809  const exponent_t c_exp,
810  const headroom_t acc_hr,
811  const headroom_t b_hr,
812  const headroom_t c_hr);
813 
814 
827 #define xs3_vect_complex_s16_nmacc_prepare xs3_vect_complex_s16_macc_prepare
828 
829 
843 #define xs3_vect_complex_s16_conj_macc_prepare xs3_vect_complex_s16_macc_prepare
844 
845 
859 #define xs3_vect_complex_s16_conj_nmacc_prepare xs3_vect_complex_s16_macc_prepare
860 
873 #define xs3_vect_complex_s16_mag_prepare xs3_vect_complex_s32_mag_prepare
874 
875 
933 C_API
935  int16_t a_real[],
936  int16_t a_imag[],
937  const int16_t b_real[],
938  const int16_t b_imag[],
939  const int16_t c_real[],
940  const int16_t c_imag[],
941  const unsigned length,
942  const right_shift_t a_shr);
943 
944 
1005 C_API
1007  exponent_t* a_exp,
1008  right_shift_t* a_shr,
1009  const exponent_t b_exp,
1010  const exponent_t c_exp,
1011  const headroom_t b_hr,
1012  const headroom_t c_hr);
1013 
1014 
1069 C_API
1071  int16_t a_real[],
1072  int16_t a_imag[],
1073  const int16_t b_real[],
1074  const int16_t b_imag[],
1075  const int16_t c_real[],
1076  const unsigned length,
1077  const right_shift_t a_shr);
1078 
1079 
1140 C_API
1142  exponent_t* a_exp,
1143  right_shift_t* a_shr,
1144  const exponent_t b_exp,
1145  const exponent_t c_exp,
1146  const headroom_t b_hr,
1147  const headroom_t c_hr);
1148 
1149 
1202 C_API
1204  int16_t a_real[],
1205  int16_t a_imag[],
1206  const int16_t b_real[],
1207  const int16_t b_imag[],
1208  const int16_t c,
1209  const unsigned length,
1210  const right_shift_t a_shr);
1211 
1212 
1226 #define xs3_vect_complex_s16_real_scale_prepare xs3_vect_s16_scale_prepare
1227 
1228 
1284 C_API
1286  int16_t a_real[],
1287  int16_t a_imag[],
1288  const int16_t b_real[],
1289  const int16_t b_imag[],
1290  const int16_t c_real,
1291  const int16_t c_imag,
1292  const unsigned length,
1293  const right_shift_t a_shr);
1294 
1295 
1308 #define xs3_vect_complex_s16_scale_prepare xs3_vect_complex_s16_mul_prepare
1309 
1310 
1346 C_API
1348  int16_t a_real[],
1349  int16_t a_imag[],
1350  const int16_t b_real,
1351  const int16_t b_imag,
1352  const unsigned length);
1353 
1354 
1399 C_API
1401  int16_t a_real[],
1402  int16_t a_imag[],
1403  const int16_t b_real[],
1404  const int16_t b_imag[],
1405  const unsigned length,
1406  const left_shift_t b_shl);
1407 
1408 
1453 C_API
1455  int16_t a_real[],
1456  int16_t a_imag[],
1457  const int16_t b_real[],
1458  const int16_t b_imag[],
1459  const unsigned length,
1460  const right_shift_t b_shr);
1461 
1462 
1505 C_API
1507  int16_t a[],
1508  const int16_t b_real[],
1509  const int16_t b_imag[],
1510  const unsigned length,
1511  const right_shift_t a_shr);
1512 
1513 
1564 C_API
1566  exponent_t* a_exp,
1567  right_shift_t* a_shr,
1568  const exponent_t b_exp,
1569  const headroom_t b_hr);
1570 
1571 
1635 C_API
1637  int16_t a_real[],
1638  int16_t a_imag[],
1639  const int16_t b_real[],
1640  const int16_t b_imag[],
1641  const int16_t c_real[],
1642  const int16_t c_imag[],
1643  const unsigned length,
1644  const right_shift_t b_shr,
1645  const right_shift_t c_shr);
1646 
1647 
1660 #define xs3_vect_complex_s16_sub_prepare xs3_vect_s32_add_prepare
1661 
1662 
1693 C_API
1695  const int16_t b_real[],
1696  const int16_t b_imag[],
1697  const unsigned length);
1698 
1699 
1700 #ifdef __XC__
1701 } //extern "C"
1702 #endif
1703 
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_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 16-bit vector element-wise by the complex conjugate of another.
Definition: xs3_vect_complex_mul.c:83
headroom_t xs3_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 16-bit vector from another.
Definition: xs3_vect.c:93
headroom_t xs3_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 16-bit vector element-wise by the complex conjugate of another,...
Definition: xs3_vect_complex_conj_macc.c:18
headroom_t xs3_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 16-bit vector element-wise by another, and add the result to an accumulator.
Definition: xs3_vect_complex_macc.c:18
headroom_t xs3_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 16-bit vector.
Definition: xs3_vect_complex_mag.c:17
headroom_t xs3_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 16-bit vector to another.
Definition: xs3_vect.c:13
headroom_t xs3_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 16-bit vector element-wise by a real 16-bit vector.
Definition: xs3_vect_complex_mul.c:18
headroom_t xs3_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)
Left-shift each element of a complex 16-bit vector by a specified number of bits.
Definition: xs3_vect.c:67
headroom_t xs3_vect_complex_s16_headroom(const int16_t b_real[], const int16_t b_imag[], const unsigned length)
Calculate the headroom of a complex 16-bit array.
Definition: xs3_vect.c:29
headroom_t xs3_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 16-bit vector.
Definition: xs3_vect_complex_mag.c:124
headroom_t xs3_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 16-bit vector by a real scalar.
Definition: xs3_vect.c:40
headroom_t xs3_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)
Right-shift each element of a complex 16-bit vector by a specified number of bits.
Definition: xs3_vect.c:78
headroom_t xs3_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 16-bit vector by a complex 16-bit scalar.
Definition: xs3_vect_complex_mul.c:116
headroom_t xs3_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 16-bit vector element-wise by the complex conjugate of another,...
Definition: xs3_vect_complex_conj_macc.c:52
headroom_t xs3_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 16-bit vector element-wise by another, and subtract the result from an accumulat...
Definition: xs3_vect_complex_macc.c:52
void xs3_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 16-bit vector to a specified value.
Definition: xs3_vect.c:55
headroom_t xs3_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 16-bit vector element-wise by another.
Definition: xs3_vect_complex_mul.c:50
complex_s32_t xs3_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 16-bit vector.
Definition: xs3_vect.c:109
headroom_t xs3_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 16-bit vector.
Definition: xs3_vect.c:242
void xs3_vect_complex_s16_real_mul_prepare(exponent_t *a_exp, right_shift_t *a_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 output shift used by xs3_vect_complex_s16_real_mul().
Definition: xs3_complex_prepare.c:50
void xs3_vect_complex_s16_macc_prepare(exponent_t *new_acc_exp, right_shift_t *acc_shr, right_shift_t *bc_sat, const exponent_t acc_exp, const exponent_t b_exp, const exponent_t c_exp, const headroom_t acc_hr, const headroom_t b_hr, const headroom_t c_hr)
Obtain the output exponent and shifts needed by xs3_vect_complex_s16_macc().
Definition: xs3_complex_prepare.c:17
void xs3_vect_complex_s16_mul_prepare(exponent_t *a_exp, right_shift_t *a_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 output shift used by xs3_vect_complex_s16_mul() and xs3_vect_complex_s...
Definition: xs3_complex_prepare.c:121
void xs3_vect_complex_s16_squared_mag_prepare(exponent_t *a_exp, right_shift_t *a_shr, const exponent_t b_exp, const headroom_t b_hr)
Obtain the output exponent and input shift used by xs3_vect_complex_s16_squared_mag().
Definition: xs3_complex_prepare.c:162
A complex number with a 16-bit real part and 16-bit imaginary part.
Definition: xs3_math_types.h:60
A complex number with a 32-bit real part and 32-bit imaginary part.
Definition: xs3_math_types.h:49