Logo
MSP DSP Library
DSPLib_matrix.h
1 #ifndef __DSPLIB_MATRIX_H__
2 #define __DSPLIB_MATRIX_H__
3 
4 //******************************************************************************
5 //
17 //
18 //******************************************************************************
19 
20 //******************************************************************************
21 //
22 // If building with a C++ compiler, make all of the definitions in this header
23 // have a C binding.
24 //
25 //******************************************************************************
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
31 //******************************************************************************
32 //
36 //
37 //******************************************************************************
38 typedef struct msp_matrix_add_q15_params {
40  uint16_t rows;
42  uint16_t cols;
44 
45 //******************************************************************************
46 //
50 //
51 //******************************************************************************
54  uint16_t rows;
56  uint16_t cols;
58 
59 //******************************************************************************
60 //
64 //
65 //******************************************************************************
66 typedef struct msp_matrix_sub_q15_params {
68  uint16_t rows;
70  uint16_t cols;
72 
73 //******************************************************************************
74 //
78 //
79 //******************************************************************************
82  uint16_t rows;
84  uint16_t cols;
86 
87 //******************************************************************************
88 //
92 //
93 //******************************************************************************
96  uint16_t rows;
98  uint16_t cols;
100 
101 //******************************************************************************
102 //
106 //
107 //******************************************************************************
110  uint16_t rows;
112  uint16_t cols;
114 
115 //******************************************************************************
116 //
120 //
121 //******************************************************************************
124  uint16_t srcARows;
126  uint16_t srcACols;
128  uint16_t srcBRows;
130  uint16_t srcBCols;
132 
133 //******************************************************************************
134 //
138 //
139 //******************************************************************************
142  uint16_t srcARows;
144  uint16_t srcACols;
146  uint16_t srcBRows;
148  uint16_t srcBCols;
150 
151 //******************************************************************************
152 //
156 //
157 //******************************************************************************
160  uint16_t rows;
162  uint16_t cols;
164 
165 //******************************************************************************
166 //
170 //
171 //******************************************************************************
174  uint16_t rows;
176  uint16_t cols;
178 
179 //******************************************************************************
180 //
184 //
185 //******************************************************************************
188  uint16_t rows;
190  uint16_t cols;
192 
193 //******************************************************************************
194 //
198 //
199 //******************************************************************************
202  uint16_t rows;
204  uint16_t cols;
206 
207 //******************************************************************************
208 //
212 //
213 //******************************************************************************
216  uint16_t rows;
218  uint16_t cols;
220  int16_t offset;
222 
223 //******************************************************************************
224 //
228 //
229 //******************************************************************************
232  uint16_t rows;
234  uint16_t cols;
236  int32_t offset;
238 
239 //******************************************************************************
240 //
244 //
245 //******************************************************************************
248  uint16_t rows;
250  uint16_t cols;
252  uint8_t shift;
256 
257 //******************************************************************************
258 //
262 //
263 //******************************************************************************
266  uint16_t rows;
268  uint16_t cols;
270  uint8_t shift;
274 
275 //******************************************************************************
276 //
280 //
281 //******************************************************************************
284  uint16_t rows;
286  uint16_t cols;
289  int8_t shift;
291 
292 //******************************************************************************
293 //
297 //
298 //******************************************************************************
301  uint16_t rows;
303  uint16_t cols;
306  int8_t shift;
308 
309 //******************************************************************************
310 //
327 //
328 //******************************************************************************
330  const _q15 *srcA,
331  const _q15 *srcB,
332  _q15 *dst);
333 
334 //******************************************************************************
335 //
352 //
353 //******************************************************************************
355  const _iq31 *srcA,
356  const _iq31 *srcB,
357  _iq31 *dst);
358 
359 //******************************************************************************
360 //
377 //
378 //******************************************************************************
380  const _q15 *srcA,
381  const _q15 *srcB,
382  _q15 *dst);
383 
384 //******************************************************************************
385 //
402 //
403 //******************************************************************************
405  const _iq31 *srcA,
406  const _iq31 *srcB,
407  _iq31 *dst);
408 
409 //******************************************************************************
410 //
427 //
428 //******************************************************************************
430  const _q15 *srcA,
431  const _q15 *srcB,
432  _q15 *dst);
433 
434 //******************************************************************************
435 //
452 //
453 //******************************************************************************
455  const _iq31 *srcA,
456  const _iq31 *srcB,
457  _iq31 *dst);
458 
459 //******************************************************************************
460 //
478 //
479 //******************************************************************************
481  const _q15 *src,
482  _q15 *dst);
483 
484 //******************************************************************************
485 //
503 //
504 //******************************************************************************
506  const _iq31 *src,
507  _iq31 *dst);
508 
509 //******************************************************************************
510 //
526 //
527 //******************************************************************************
529  const _q15 *src,
530  _q15 *dst);
531 
532 //******************************************************************************
533 //
549 //
550 //******************************************************************************
552  const _iq31 *src,
553  _iq31 *dst);
554 
555 //******************************************************************************
556 //
571 //
572 //******************************************************************************
574  const _q15 *src,
575  _q15 *dst);
576 
577 //******************************************************************************
578 //
593 //
594 //******************************************************************************
596  const _iq31 *src,
597  _iq31 *dst);
598 
599 //******************************************************************************
600 //
616 //
617 //******************************************************************************
619  const msp_matrix_offset_q15_params *params,
620  const _q15 *src,
621  _q15 *dst);
622 
623 //******************************************************************************
624 //
640 //
641 //******************************************************************************
643  const msp_matrix_offset_iq31_params *params,
644  const _iq31 *src,
645  _iq31 *dst);
646 
647 //******************************************************************************
648 //
664 //
665 //******************************************************************************
667  const msp_matrix_scale_q15_params *params,
668  const _q15 *src,
669  _q15 *dst);
670 
671 //******************************************************************************
672 //
688 //
689 //******************************************************************************
691  const msp_matrix_scale_iq31_params *params,
692  const _iq31 *src,
693  _iq31 *dst);
694 
695 //******************************************************************************
696 //
713 //
714 //******************************************************************************
716  const msp_matrix_shift_q15_params *params,
717  const _q15 *src,
718  _q15 *dst);
719 
720 //******************************************************************************
721 //
738 //
739 //******************************************************************************
741  const msp_matrix_shift_iq31_params *params,
742  const _iq31 *src,
743  _iq31 *dst);
744 
745 //*****************************************************************************
746 //
747 // Mark the end of the C bindings section for C++ compilers.
748 //
749 //*****************************************************************************
750 #ifdef __cplusplus
751 }
752 #endif
753 
754 #endif //__DSPLIB_MATRIX_H__
Parameter structure for the matrix subtract function.
Definition: DSPLib_matrix.h:80
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:202
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:110
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:52
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:301
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:268
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:190
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:59
uint16_t srcARows
Number of rows in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:124
int16_t offset
Q15 constant to add to the source matrix.
Definition: DSPLib_matrix.h:220
Parameter structure for the matrix transpose function.
Definition: DSPLib_matrix.h:94
Parameter structure for the real matrix shift function.
Definition: DSPLib_matrix.h:299
msp_status
Enumerated type to return the status of an operation.
Definition: DSPLib_types.h:78
Parameter structure for the real matrix scale function.
Definition: DSPLib_matrix.h:264
Parameter structure for the real matrix scale function.
Definition: DSPLib_matrix.h:246
uint16_t srcBCols
Number of columns in source B matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:130
Parameter structure for the real matrix multiply function.
Definition: DSPLib_matrix.h:140
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:284
uint16_t srcACols
Number of columns in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:144
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:232
Parameter structure for the real matrix negate function.
Definition: DSPLib_matrix.h:158
int32_t offset
IQ31 constant to add to the source matrix.
Definition: DSPLib_matrix.h:236
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:84
Parameter structure for the real matrix absolute value function.
Definition: DSPLib_matrix.h:186
Parameter structure for the real matrix negate function.
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:70
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:40
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:286
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:108
Parameter structure for the matrix subtract function.
Definition: DSPLib_matrix.h:66
uint8_t shift
Integer amount to shift result matrix by, must be positive.
Definition: DSPLib_matrix.h:252
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:216
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:266
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:68
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:112
Parameter structure for the real matrix offset function.
Definition: DSPLib_matrix.h:214
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:42
uint8_t shift
Integer amount to shift result matrix by, must be positive.
Definition: DSPLib_matrix.h:270
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:162
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:56
int16_t _q15
Signed fixed point data type with 1 integer bit and 15 fractional bits.
Definition: DSPLib_types.h:38
int8_t shift
Definition: DSPLib_matrix.h:306
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:82
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:250
Parameter structure for the real matrix multiply function.
Definition: DSPLib_matrix.h:122
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:188
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:38
Parameter structure for the real matrix offset function.
Definition: DSPLib_matrix.h:230
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:160
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:272
uint16_t srcBRows
Number of rows in source B matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:146
uint16_t srcBRows
Number of rows in source B matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:128
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:96
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:303
int8_t shift
Definition: DSPLib_matrix.h:289
uint16_t srcARows
Number of rows in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:142
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:282
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:174
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:98
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:218
_q15 scale
Q15 constant multiplied with the source matrix.
Definition: DSPLib_matrix.h:254
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:248
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:148
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:234
Parameter structure for the real matrix absolute value function.
Definition: DSPLib_matrix.h:200
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:204
uint16_t srcACols
Number of columns in source A matrix, must be a multiple of two.
Definition: DSPLib_matrix.h:126
uint16_t cols
Number of columns in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:176
uint16_t rows
Number of rows in the source matrices, must be a multiple of two.
Definition: DSPLib_matrix.h:54