Logo
MSP DSP Library
DSPLib_matrix.h
1 #ifndef __DSPLIB_MATRIX_H__
2 #define __DSPLIB_MATRIX_H__
3 
4 //******************************************************************************
5 //
15 //
16 //******************************************************************************
17 
18 //******************************************************************************
19 //
20 // If building with a C++ compiler, make all of the definitions in this header
21 // have a C binding.
22 //
23 //******************************************************************************
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 //******************************************************************************
30 //
34 //
35 //******************************************************************************
36 typedef struct msp_matrix_add_q15_params {
38  uint16_t rows;
40  uint16_t cols;
42 
43 //******************************************************************************
44 //
48 //
49 //******************************************************************************
52  uint16_t rows;
54  uint16_t cols;
56 
57 //******************************************************************************
58 //
62 //
63 //******************************************************************************
64 typedef struct msp_matrix_sub_q15_params {
66  uint16_t rows;
68  uint16_t cols;
70 
71 //******************************************************************************
72 //
76 //
77 //******************************************************************************
80  uint16_t rows;
82  uint16_t cols;
84 
85 //******************************************************************************
86 //
90 //
91 //******************************************************************************
94  uint16_t rows;
96  uint16_t cols;
98 
99 //******************************************************************************
100 //
104 //
105 //******************************************************************************
108  uint16_t rows;
110  uint16_t cols;
112 
113 //******************************************************************************
114 //
118 //
119 //******************************************************************************
122  uint16_t srcARows;
124  uint16_t srcACols;
126  uint16_t srcBRows;
128  uint16_t srcBCols;
130 
131 //******************************************************************************
132 //
136 //
137 //******************************************************************************
140  uint16_t srcARows;
142  uint16_t srcACols;
144  uint16_t srcBRows;
146  uint16_t srcBCols;
148 
149 //******************************************************************************
150 //
154 //
155 //******************************************************************************
158  uint16_t rows;
160  uint16_t cols;
162 
163 //******************************************************************************
164 //
168 //
169 //******************************************************************************
172  uint16_t rows;
174  uint16_t cols;
176 
177 //******************************************************************************
178 //
182 //
183 //******************************************************************************
186  uint16_t rows;
188  uint16_t cols;
190 
191 //******************************************************************************
192 //
196 //
197 //******************************************************************************
200  uint16_t rows;
202  uint16_t cols;
204 
205 //******************************************************************************
206 //
210 //
211 //******************************************************************************
214  uint16_t rows;
216  uint16_t cols;
218  int16_t offset;
220 
221 //******************************************************************************
222 //
226 //
227 //******************************************************************************
230  uint16_t rows;
232  uint16_t cols;
234  int32_t offset;
236 
237 //******************************************************************************
238 //
242 //
243 //******************************************************************************
246  uint16_t rows;
248  uint16_t cols;
250  uint8_t shift;
254 
255 //******************************************************************************
256 //
260 //
261 //******************************************************************************
264  uint16_t rows;
266  uint16_t cols;
268  uint8_t shift;
272 
273 //******************************************************************************
274 //
278 //
279 //******************************************************************************
282  uint16_t rows;
284  uint16_t cols;
287  int8_t shift;
289 
290 //******************************************************************************
291 //
295 //
296 //******************************************************************************
299  uint16_t rows;
301  uint16_t cols;
304  int8_t shift;
306 
307 //******************************************************************************
308 //
330 //
331 //******************************************************************************
333  const _q15 *srcA,
334  const _q15 *srcB,
335  _q15 *dst);
336 
337 //******************************************************************************
338 //
360 //
361 //******************************************************************************
363  const _iq31 *srcA,
364  const _iq31 *srcB,
365  _iq31 *dst);
366 
367 //******************************************************************************
368 //
390 //
391 //******************************************************************************
393  const _q15 *srcA,
394  const _q15 *srcB,
395  _q15 *dst);
396 
397 //******************************************************************************
398 //
420 //
421 //******************************************************************************
423  const _iq31 *srcA,
424  const _iq31 *srcB,
425  _iq31 *dst);
426 
427 //******************************************************************************
428 //
450 //
451 //******************************************************************************
453  const _q15 *srcA,
454  const _q15 *srcB,
455  _q15 *dst);
456 
457 //******************************************************************************
458 //
480 //
481 //******************************************************************************
483  const _iq31 *srcA,
484  const _iq31 *srcB,
485  _iq31 *dst);
486 
487 //******************************************************************************
488 //
510 //
511 //******************************************************************************
513  const _q15 *src,
514  _q15 *dst);
515 
516 //******************************************************************************
517 //
539 //
540 //******************************************************************************
542  const _iq31 *src,
543  _iq31 *dst);
544 
545 //******************************************************************************
546 //
567 //
568 //******************************************************************************
570  const _q15 *src,
571  _q15 *dst);
572 
573 //******************************************************************************
574 //
595 //
596 //******************************************************************************
598  const _iq31 *src,
599  _iq31 *dst);
600 
601 //******************************************************************************
602 //
621 //
622 //******************************************************************************
624  const _q15 *src,
625  _q15 *dst);
626 
627 //******************************************************************************
628 //
647 //
648 //******************************************************************************
650  const _iq31 *src,
651  _iq31 *dst);
652 
653 //******************************************************************************
654 //
675 //
676 //******************************************************************************
678  const msp_matrix_offset_q15_params *params,
679  const _q15 *src,
680  _q15 *dst);
681 
682 //******************************************************************************
683 //
704 //
705 //******************************************************************************
707  const msp_matrix_offset_iq31_params *params,
708  const _iq31 *src,
709  _iq31 *dst);
710 
711 //******************************************************************************
712 //
732 //
733 //******************************************************************************
735  const msp_matrix_scale_q15_params *params,
736  const _q15 *src,
737  _q15 *dst);
738 
739 //******************************************************************************
740 //
760 //
761 //******************************************************************************
763  const msp_matrix_scale_iq31_params *params,
764  const _iq31 *src,
765  _iq31 *dst);
766 
767 //******************************************************************************
768 //
790 //
791 //******************************************************************************
793  const msp_matrix_shift_q15_params *params,
794  const _q15 *src,
795  _q15 *dst);
796 
797 //******************************************************************************
798 //
820 //
821 //******************************************************************************
823  const msp_matrix_shift_iq31_params *params,
824  const _iq31 *src,
825  _iq31 *dst);
826 
827 //*****************************************************************************
828 //
829 // Mark the end of the C bindings section for C++ compilers.
830 //
831 //*****************************************************************************
832 #ifdef __cplusplus
833 }
834 #endif
835 
836 #endif //__DSPLIB_MATRIX_H__
Parameter structure for the matrix subtract function.
Definition: DSPLib_matrix.h:78
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:200
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:108
msp_status msp_matrix_offset_q15(const msp_matrix_offset_q15_params *params, const _q15 *src, _q15 *dst)
Constant offset of a real source matrix.
Parameter structure for the matrix add function.
Definition: DSPLib_matrix.h:50
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:299
msp_status msp_matrix_shift_q15(const msp_matrix_shift_q15_params *params, const _q15 *src, _q15 *dst)
Bitwise shift of a real source matrix.
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:266
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:188
msp_status msp_matrix_neg_iq31(const msp_matrix_neg_iq31_params *params, const _iq31 *src, _iq31 *dst)
Negation of a source matrix.
int32_t _iq31
Signed fixed point data type with 1 integer bit and 31 fractional bits.
Definition: DSPLib_types.h:100
uint16_t srcARows
Number of rows in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:122
int16_t offset
Q15 constant to add to the source matrix.
Definition: DSPLib_matrix.h:218
Parameter structure for the matrix transpose function.
Definition: DSPLib_matrix.h:92
Parameter structure for the real matrix shift function.
Definition: DSPLib_matrix.h:297
msp_status
Enumerated type to return the status of an operation.
Definition: DSPLib_types.h:119
Parameter structure for the real matrix scale function.
Definition: DSPLib_matrix.h:262
Parameter structure for the real matrix scale function.
Definition: DSPLib_matrix.h:244
uint16_t srcBCols
Number of columns in source B matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:128
Parameter structure for the real matrix multiply function.
Definition: DSPLib_matrix.h:138
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:282
uint16_t srcACols
Number of columns in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:142
msp_status msp_matrix_trans_q15(const msp_matrix_trans_q15_params *params, const _q15 *src, _q15 *dst)
Transposition of a source matrix.
msp_status msp_matrix_scale_iq31(const msp_matrix_scale_iq31_params *params, const _iq31 *src, _iq31 *dst)
Scale a real source matrix.
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:230
Parameter structure for the real matrix negate function.
Definition: DSPLib_matrix.h:156
int32_t offset
IQ31 constant to add to the source matrix.
Definition: DSPLib_matrix.h:234
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:82
Parameter structure for the real matrix absolute value function.
Definition: DSPLib_matrix.h:184
Parameter structure for the real matrix negate function.
Definition: DSPLib_matrix.h:170
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:68
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:38
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:284
msp_status msp_matrix_shift_iq31(const msp_matrix_shift_iq31_params *params, const _iq31 *src, _iq31 *dst)
Bitwise shift of a real source matrix.
Parameter structure for the matrix transpose function.
Definition: DSPLib_matrix.h:106
Parameter structure for the matrix subtract function.
Definition: DSPLib_matrix.h:64
uint8_t shift
Integer amount to shift result matrix by, must be positive.
Definition: DSPLib_matrix.h:250
msp_status msp_matrix_mpy_q15(const msp_matrix_mpy_q15_params *params, const _q15 *srcA, const _q15 *srcB, _q15 *dst)
Multiplication of two real source matrices.
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:214
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:264
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:66
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:110
Parameter structure for the real matrix offset function.
Definition: DSPLib_matrix.h:212
msp_status msp_matrix_add_iq31(const msp_matrix_add_iq31_params *params, const _iq31 *srcA, const _iq31 *srcB, _iq31 *dst)
Addition of two real source matrices.
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:40
uint8_t shift
Integer amount to shift result matrix by, must be positive.
Definition: DSPLib_matrix.h:268
msp_status msp_matrix_sub_q15(const msp_matrix_sub_q15_params *params, const _q15 *srcA, const _q15 *srcB, _q15 *dst)
Subtraction of two real source matrices.
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:160
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:54
int16_t _q15
Signed fixed point data type with 1 integer bit and 15 fractional bits.
Definition: DSPLib_types.h:79
int8_t shift
Definition: DSPLib_matrix.h:304
msp_status msp_matrix_abs_q15(const msp_matrix_abs_q15_params *params, const _q15 *src, _q15 *dst)
Absolute value of a real source matrix.
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:80
msp_status msp_matrix_neg_q15(const msp_matrix_neg_q15_params *params, const _q15 *src, _q15 *dst)
Negation of a source matrix.
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:248
Parameter structure for the real matrix multiply function.
Definition: DSPLib_matrix.h:120
msp_status msp_matrix_mpy_iq31(const msp_matrix_mpy_iq31_params *params, const _iq31 *srcA, const _iq31 *srcB, _iq31 *dst)
Multiplication of two real source matrices.
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:186
msp_status msp_matrix_offset_iq31(const msp_matrix_offset_iq31_params *params, const _iq31 *src, _iq31 *dst)
Constant offset of a real source matrix.
Parameter structure for the matrix add function.
Definition: DSPLib_matrix.h:36
Parameter structure for the real matrix offset function.
Definition: DSPLib_matrix.h:228
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:158
msp_status msp_matrix_scale_q15(const msp_matrix_scale_q15_params *params, const _q15 *src, _q15 *dst)
Scale a real source matrix.
msp_status msp_matrix_abs_iq31(const msp_matrix_abs_iq31_params *params, const _iq31 *src, _iq31 *dst)
Absolute value of a real source matrix.
_iq31 scale
IQ31 constant multiplied with the source matrix.
Definition: DSPLib_matrix.h:270
uint16_t srcBRows
Number of rows in source B matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:144
uint16_t srcBRows
Number of rows in source B matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:126
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:94
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:301
int8_t shift
Definition: DSPLib_matrix.h:287
uint16_t srcARows
Number of rows in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:140
msp_status msp_matrix_sub_iq31(const msp_matrix_sub_iq31_params *params, const _iq31 *srcA, const _iq31 *srcB, _iq31 *dst)
Subtraction of two real source matrices.
Parameter structure for the real matrix shift function.
Definition: DSPLib_matrix.h:280
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:172
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:96
msp_status msp_matrix_add_q15(const msp_matrix_add_q15_params *params, const _q15 *srcA, const _q15 *srcB, _q15 *dst)
Addition of two real source matrices.
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:216
_q15 scale
Q15 constant multiplied with the source matrix.
Definition: DSPLib_matrix.h:252
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:246
msp_status msp_matrix_trans_iq31(const msp_matrix_trans_iq31_params *params, const _iq31 *src, _iq31 *dst)
Transposition of a source matrix.
uint16_t srcBCols
Number of columns in source B matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:146
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:232
Parameter structure for the real matrix absolute value function.
Definition: DSPLib_matrix.h:198
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:202
uint16_t srcACols
Number of columns in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:124
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:174
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:52