• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * @file     matrix_functions.h
3  * @brief    Public header file for CMSIS DSP Library
4  * @version  V1.9.0
5  * @date     23 April 2021
6  * Target Processor: Cortex-M and Cortex-A cores
7  ******************************************************************************/
8 /*
9  * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
10  *
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the License); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 
27 #ifndef _MATRIX_FUNCTIONS_H_
28 #define _MATRIX_FUNCTIONS_H_
29 
30 #include "arm_math_types.h"
31 #include "arm_math_memory.h"
32 
33 #include "dsp/none.h"
34 #include "dsp/utils.h"
35 
36 #ifdef   __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 /**
42  * @defgroup groupMatrix Matrix Functions
43  *
44  * This set of functions provides basic matrix math operations.
45  * The functions operate on matrix data structures.  For example,
46  * the type
47  * definition for the floating-point matrix structure is shown
48  * below:
49  * <pre>
50  *     typedef struct
51  *     {
52  *       uint16_t numRows;     // number of rows of the matrix.
53  *       uint16_t numCols;     // number of columns of the matrix.
54  *       float32_t *pData;     // points to the data of the matrix.
55  *     } arm_matrix_instance_f32;
56  * </pre>
57  * There are similar definitions for Q15 and Q31 data types.
58  *
59  * The structure specifies the size of the matrix and then points to
60  * an array of data.  The array is of size <code>numRows X numCols</code>
61  * and the values are arranged in row order.  That is, the
62  * matrix element (i, j) is stored at:
63  * <pre>
64  *     pData[i*numCols + j]
65  * </pre>
66  *
67  * \par Init Functions
68  * There is an associated initialization function for each type of matrix
69  * data structure.
70  * The initialization function sets the values of the internal structure fields.
71  * Refer to \ref arm_mat_init_f32(), \ref arm_mat_init_q31() and \ref arm_mat_init_q15()
72  * for floating-point, Q31 and Q15 types,  respectively.
73  *
74  * \par
75  * Use of the initialization function is optional. However, if initialization function is used
76  * then the instance structure cannot be placed into a const data section.
77  * To place the instance structure in a const data
78  * section, manually initialize the data structure.  For example:
79  * <pre>
80  * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
81  * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
82  * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
83  * </pre>
84  * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
85  * specifies the number of columns, and <code>pData</code> points to the
86  * data array.
87  *
88  * \par Size Checking
89  * By default all of the matrix functions perform size checking on the input and
90  * output matrices. For example, the matrix addition function verifies that the
91  * two input matrices and the output matrix all have the same number of rows and
92  * columns. If the size check fails the functions return:
93  * <pre>
94  *     ARM_MATH_SIZE_MISMATCH
95  * </pre>
96  * Otherwise the functions return
97  * <pre>
98  *     ARM_MATH_SUCCESS
99  * </pre>
100  * There is some overhead associated with this matrix size checking.
101  * The matrix size checking is enabled via the \#define
102  * <pre>
103  *     ARM_MATH_MATRIX_CHECK
104  * </pre>
105  * within the library project settings.  By default this macro is defined
106  * and size checking is enabled. By changing the project settings and
107  * undefining this macro size checking is eliminated and the functions
108  * run a bit faster. With size checking disabled the functions always
109  * return <code>ARM_MATH_SUCCESS</code>.
110  */
111 
112   /**
113    * @brief Instance structure for the floating-point matrix structure.
114    */
115   typedef struct
116   {
117     uint16_t numRows;     /**< number of rows of the matrix.     */
118     uint16_t numCols;     /**< number of columns of the matrix.  */
119     float32_t *pData;     /**< points to the data of the matrix. */
120   } arm_matrix_instance_f32;
121 
122  /**
123    * @brief Instance structure for the floating-point matrix structure.
124    */
125   typedef struct
126   {
127     uint16_t numRows;     /**< number of rows of the matrix.     */
128     uint16_t numCols;     /**< number of columns of the matrix.  */
129     float64_t *pData;     /**< points to the data of the matrix. */
130   } arm_matrix_instance_f64;
131 
132  /**
133    * @brief Instance structure for the Q7 matrix structure.
134    */
135   typedef struct
136   {
137     uint16_t numRows;     /**< number of rows of the matrix.     */
138     uint16_t numCols;     /**< number of columns of the matrix.  */
139     q7_t *pData;         /**< points to the data of the matrix. */
140   } arm_matrix_instance_q7;
141 
142   /**
143    * @brief Instance structure for the Q15 matrix structure.
144    */
145   typedef struct
146   {
147     uint16_t numRows;     /**< number of rows of the matrix.     */
148     uint16_t numCols;     /**< number of columns of the matrix.  */
149     q15_t *pData;         /**< points to the data of the matrix. */
150   } arm_matrix_instance_q15;
151 
152   /**
153    * @brief Instance structure for the Q31 matrix structure.
154    */
155   typedef struct
156   {
157     uint16_t numRows;     /**< number of rows of the matrix.     */
158     uint16_t numCols;     /**< number of columns of the matrix.  */
159     q31_t *pData;         /**< points to the data of the matrix. */
160   } arm_matrix_instance_q31;
161 
162   /**
163    * @brief Floating-point matrix addition.
164    * @param[in]  pSrcA  points to the first input matrix structure
165    * @param[in]  pSrcB  points to the second input matrix structure
166    * @param[out] pDst   points to output matrix structure
167    * @return     The function returns either
168    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
169    */
170 arm_status arm_mat_add_f32(
171   const arm_matrix_instance_f32 * pSrcA,
172   const arm_matrix_instance_f32 * pSrcB,
173         arm_matrix_instance_f32 * pDst);
174 
175   /**
176    * @brief Q15 matrix addition.
177    * @param[in]   pSrcA  points to the first input matrix structure
178    * @param[in]   pSrcB  points to the second input matrix structure
179    * @param[out]  pDst   points to output matrix structure
180    * @return     The function returns either
181    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
182    */
183 arm_status arm_mat_add_q15(
184   const arm_matrix_instance_q15 * pSrcA,
185   const arm_matrix_instance_q15 * pSrcB,
186         arm_matrix_instance_q15 * pDst);
187 
188   /**
189    * @brief Q31 matrix addition.
190    * @param[in]  pSrcA  points to the first input matrix structure
191    * @param[in]  pSrcB  points to the second input matrix structure
192    * @param[out] pDst   points to output matrix structure
193    * @return     The function returns either
194    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
195    */
196 arm_status arm_mat_add_q31(
197   const arm_matrix_instance_q31 * pSrcA,
198   const arm_matrix_instance_q31 * pSrcB,
199         arm_matrix_instance_q31 * pDst);
200 
201   /**
202    * @brief Floating-point, complex, matrix multiplication.
203    * @param[in]  pSrcA  points to the first input matrix structure
204    * @param[in]  pSrcB  points to the second input matrix structure
205    * @param[out] pDst   points to output matrix structure
206    * @return     The function returns either
207    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
208    */
209 arm_status arm_mat_cmplx_mult_f32(
210   const arm_matrix_instance_f32 * pSrcA,
211   const arm_matrix_instance_f32 * pSrcB,
212         arm_matrix_instance_f32 * pDst);
213 
214   /**
215    * @brief Q15, complex,  matrix multiplication.
216    * @param[in]  pSrcA  points to the first input matrix structure
217    * @param[in]  pSrcB  points to the second input matrix structure
218    * @param[out] pDst   points to output matrix structure
219    * @return     The function returns either
220    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
221    */
222 arm_status arm_mat_cmplx_mult_q15(
223   const arm_matrix_instance_q15 * pSrcA,
224   const arm_matrix_instance_q15 * pSrcB,
225         arm_matrix_instance_q15 * pDst,
226         q15_t * pScratch);
227 
228   /**
229    * @brief Q31, complex, matrix multiplication.
230    * @param[in]  pSrcA  points to the first input matrix structure
231    * @param[in]  pSrcB  points to the second input matrix structure
232    * @param[out] pDst   points to output matrix structure
233    * @return     The function returns either
234    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
235    */
236 arm_status arm_mat_cmplx_mult_q31(
237   const arm_matrix_instance_q31 * pSrcA,
238   const arm_matrix_instance_q31 * pSrcB,
239         arm_matrix_instance_q31 * pDst);
240 
241   /**
242    * @brief Floating-point matrix transpose.
243    * @param[in]  pSrc  points to the input matrix
244    * @param[out] pDst  points to the output matrix
245    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
246    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
247    */
248 arm_status arm_mat_trans_f32(
249   const arm_matrix_instance_f32 * pSrc,
250         arm_matrix_instance_f32 * pDst);
251 
252 /**
253    * @brief Floating-point matrix transpose.
254    * @param[in]  pSrc  points to the input matrix
255    * @param[out] pDst  points to the output matrix
256    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
257    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
258    */
259 arm_status arm_mat_trans_f64(
260   const arm_matrix_instance_f64 * pSrc,
261         arm_matrix_instance_f64 * pDst);
262 
263   /**
264    * @brief Floating-point complex matrix transpose.
265    * @param[in]  pSrc  points to the input matrix
266    * @param[out] pDst  points to the output matrix
267    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
268    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
269    */
270 arm_status arm_mat_cmplx_trans_f32(
271   const arm_matrix_instance_f32 * pSrc,
272   arm_matrix_instance_f32 * pDst);
273 
274 
275   /**
276    * @brief Q15 matrix transpose.
277    * @param[in]  pSrc  points to the input matrix
278    * @param[out] pDst  points to the output matrix
279    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
280    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
281    */
282 arm_status arm_mat_trans_q15(
283   const arm_matrix_instance_q15 * pSrc,
284         arm_matrix_instance_q15 * pDst);
285 
286   /**
287    * @brief Q15 complex matrix transpose.
288    * @param[in]  pSrc  points to the input matrix
289    * @param[out] pDst  points to the output matrix
290    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
291    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
292    */
293 arm_status arm_mat_cmplx_trans_q15(
294   const arm_matrix_instance_q15 * pSrc,
295   arm_matrix_instance_q15 * pDst);
296 
297   /**
298    * @brief Q7 matrix transpose.
299    * @param[in]  pSrc  points to the input matrix
300    * @param[out] pDst  points to the output matrix
301    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
302    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
303    */
304 arm_status arm_mat_trans_q7(
305   const arm_matrix_instance_q7 * pSrc,
306         arm_matrix_instance_q7 * pDst);
307 
308   /**
309    * @brief Q31 matrix transpose.
310    * @param[in]  pSrc  points to the input matrix
311    * @param[out] pDst  points to the output matrix
312    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
313    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
314    */
315 arm_status arm_mat_trans_q31(
316   const arm_matrix_instance_q31 * pSrc,
317         arm_matrix_instance_q31 * pDst);
318 
319   /**
320    * @brief Q31 complex matrix transpose.
321    * @param[in]  pSrc  points to the input matrix
322    * @param[out] pDst  points to the output matrix
323    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
324    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
325    */
326 arm_status arm_mat_cmplx_trans_q31(
327   const arm_matrix_instance_q31 * pSrc,
328   arm_matrix_instance_q31 * pDst);
329 
330   /**
331    * @brief Floating-point matrix multiplication
332    * @param[in]  pSrcA  points to the first input matrix structure
333    * @param[in]  pSrcB  points to the second input matrix structure
334    * @param[out] pDst   points to output matrix structure
335    * @return     The function returns either
336    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
337    */
338 arm_status arm_mat_mult_f32(
339   const arm_matrix_instance_f32 * pSrcA,
340   const arm_matrix_instance_f32 * pSrcB,
341         arm_matrix_instance_f32 * pDst);
342 
343   /**
344    * @brief Floating-point matrix multiplication
345    * @param[in]  pSrcA  points to the first input matrix structure
346    * @param[in]  pSrcB  points to the second input matrix structure
347    * @param[out] pDst   points to output matrix structure
348    * @return     The function returns either
349    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
350    */
351 arm_status arm_mat_mult_f64(
352   const arm_matrix_instance_f64 * pSrcA,
353   const arm_matrix_instance_f64 * pSrcB,
354         arm_matrix_instance_f64 * pDst);
355 
356   /**
357    * @brief Floating-point matrix and vector multiplication
358    * @param[in]  pSrcMat  points to the input matrix structure
359    * @param[in]  pVec     points to vector
360    * @param[out] pDst     points to output vector
361    */
362 void arm_mat_vec_mult_f32(
363   const arm_matrix_instance_f32 *pSrcMat,
364   const float32_t *pVec,
365   float32_t *pDst);
366 
367   /**
368    * @brief Q7 matrix multiplication
369    * @param[in]  pSrcA   points to the first input matrix structure
370    * @param[in]  pSrcB   points to the second input matrix structure
371    * @param[out] pDst    points to output matrix structure
372    * @param[in]  pState  points to the array for storing intermediate results
373    * @return     The function returns either
374    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
375    */
376 arm_status arm_mat_mult_q7(
377   const arm_matrix_instance_q7 * pSrcA,
378   const arm_matrix_instance_q7 * pSrcB,
379         arm_matrix_instance_q7 * pDst,
380         q7_t * pState);
381 
382   /**
383    * @brief Q7 matrix and vector multiplication
384    * @param[in]  pSrcMat  points to the input matrix structure
385    * @param[in]  pVec     points to vector
386    * @param[out] pDst     points to output vector
387    */
388 void arm_mat_vec_mult_q7(
389   const arm_matrix_instance_q7 *pSrcMat,
390   const q7_t *pVec,
391   q7_t *pDst);
392 
393   /**
394    * @brief Q15 matrix multiplication
395    * @param[in]  pSrcA   points to the first input matrix structure
396    * @param[in]  pSrcB   points to the second input matrix structure
397    * @param[out] pDst    points to output matrix structure
398    * @param[in]  pState  points to the array for storing intermediate results
399    * @return     The function returns either
400    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
401    */
402 arm_status arm_mat_mult_q15(
403   const arm_matrix_instance_q15 * pSrcA,
404   const arm_matrix_instance_q15 * pSrcB,
405         arm_matrix_instance_q15 * pDst,
406         q15_t * pState);
407 
408   /**
409    * @brief Q15 matrix and vector multiplication
410    * @param[in]  pSrcMat  points to the input matrix structure
411    * @param[in]  pVec     points to vector
412    * @param[out] pDst     points to output vector
413    */
414 void arm_mat_vec_mult_q15(
415   const arm_matrix_instance_q15 *pSrcMat,
416   const q15_t *pVec,
417   q15_t *pDst);
418 
419   /**
420    * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
421    * @param[in]  pSrcA   points to the first input matrix structure
422    * @param[in]  pSrcB   points to the second input matrix structure
423    * @param[out] pDst    points to output matrix structure
424    * @param[in]  pState  points to the array for storing intermediate results
425    * @return     The function returns either
426    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
427    */
428 arm_status arm_mat_mult_fast_q15(
429   const arm_matrix_instance_q15 * pSrcA,
430   const arm_matrix_instance_q15 * pSrcB,
431         arm_matrix_instance_q15 * pDst,
432         q15_t * pState);
433 
434   /**
435    * @brief Q31 matrix multiplication
436    * @param[in]  pSrcA  points to the first input matrix structure
437    * @param[in]  pSrcB  points to the second input matrix structure
438    * @param[out] pDst   points to output matrix structure
439    * @return     The function returns either
440    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
441    */
442 arm_status arm_mat_mult_q31(
443   const arm_matrix_instance_q31 * pSrcA,
444   const arm_matrix_instance_q31 * pSrcB,
445         arm_matrix_instance_q31 * pDst);
446 
447   /**
448    * @brief Q31 matrix and vector multiplication
449    * @param[in]  pSrcMat  points to the input matrix structure
450    * @param[in]  pVec     points to vector
451    * @param[out] pDst     points to output vector
452    */
453 void arm_mat_vec_mult_q31(
454   const arm_matrix_instance_q31 *pSrcMat,
455   const q31_t *pVec,
456   q31_t *pDst);
457 
458   /**
459    * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
460    * @param[in]  pSrcA  points to the first input matrix structure
461    * @param[in]  pSrcB  points to the second input matrix structure
462    * @param[out] pDst   points to output matrix structure
463    * @return     The function returns either
464    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
465    */
466 arm_status arm_mat_mult_fast_q31(
467   const arm_matrix_instance_q31 * pSrcA,
468   const arm_matrix_instance_q31 * pSrcB,
469         arm_matrix_instance_q31 * pDst);
470 
471   /**
472    * @brief Floating-point matrix subtraction
473    * @param[in]  pSrcA  points to the first input matrix structure
474    * @param[in]  pSrcB  points to the second input matrix structure
475    * @param[out] pDst   points to output matrix structure
476    * @return     The function returns either
477    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
478    */
479 arm_status arm_mat_sub_f32(
480   const arm_matrix_instance_f32 * pSrcA,
481   const arm_matrix_instance_f32 * pSrcB,
482         arm_matrix_instance_f32 * pDst);
483 
484   /**
485    * @brief Floating-point matrix subtraction
486    * @param[in]  pSrcA  points to the first input matrix structure
487    * @param[in]  pSrcB  points to the second input matrix structure
488    * @param[out] pDst   points to output matrix structure
489    * @return     The function returns either
490    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
491    */
492 arm_status arm_mat_sub_f64(
493   const arm_matrix_instance_f64 * pSrcA,
494   const arm_matrix_instance_f64 * pSrcB,
495         arm_matrix_instance_f64 * pDst);
496 
497   /**
498    * @brief Q15 matrix subtraction
499    * @param[in]  pSrcA  points to the first input matrix structure
500    * @param[in]  pSrcB  points to the second input matrix structure
501    * @param[out] pDst   points to output matrix structure
502    * @return     The function returns either
503    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
504    */
505 arm_status arm_mat_sub_q15(
506   const arm_matrix_instance_q15 * pSrcA,
507   const arm_matrix_instance_q15 * pSrcB,
508         arm_matrix_instance_q15 * pDst);
509 
510   /**
511    * @brief Q31 matrix subtraction
512    * @param[in]  pSrcA  points to the first input matrix structure
513    * @param[in]  pSrcB  points to the second input matrix structure
514    * @param[out] pDst   points to output matrix structure
515    * @return     The function returns either
516    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
517    */
518 arm_status arm_mat_sub_q31(
519   const arm_matrix_instance_q31 * pSrcA,
520   const arm_matrix_instance_q31 * pSrcB,
521         arm_matrix_instance_q31 * pDst);
522 
523   /**
524    * @brief Floating-point matrix scaling.
525    * @param[in]  pSrc   points to the input matrix
526    * @param[in]  scale  scale factor
527    * @param[out] pDst   points to the output matrix
528    * @return     The function returns either
529    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
530    */
531 arm_status arm_mat_scale_f32(
532   const arm_matrix_instance_f32 * pSrc,
533         float32_t scale,
534         arm_matrix_instance_f32 * pDst);
535 
536   /**
537    * @brief Q15 matrix scaling.
538    * @param[in]  pSrc        points to input matrix
539    * @param[in]  scaleFract  fractional portion of the scale factor
540    * @param[in]  shift       number of bits to shift the result by
541    * @param[out] pDst        points to output matrix
542    * @return     The function returns either
543    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
544    */
545 arm_status arm_mat_scale_q15(
546   const arm_matrix_instance_q15 * pSrc,
547         q15_t scaleFract,
548         int32_t shift,
549         arm_matrix_instance_q15 * pDst);
550 
551   /**
552    * @brief Q31 matrix scaling.
553    * @param[in]  pSrc        points to input matrix
554    * @param[in]  scaleFract  fractional portion of the scale factor
555    * @param[in]  shift       number of bits to shift the result by
556    * @param[out] pDst        points to output matrix structure
557    * @return     The function returns either
558    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
559    */
560 arm_status arm_mat_scale_q31(
561   const arm_matrix_instance_q31 * pSrc,
562         q31_t scaleFract,
563         int32_t shift,
564         arm_matrix_instance_q31 * pDst);
565 
566   /**
567    * @brief  Q31 matrix initialization.
568    * @param[in,out] S         points to an instance of the floating-point matrix structure.
569    * @param[in]     nRows     number of rows in the matrix.
570    * @param[in]     nColumns  number of columns in the matrix.
571    * @param[in]     pData     points to the matrix data array.
572    */
573 void arm_mat_init_q31(
574         arm_matrix_instance_q31 * S,
575         uint16_t nRows,
576         uint16_t nColumns,
577         q31_t * pData);
578 
579   /**
580    * @brief  Q15 matrix initialization.
581    * @param[in,out] S         points to an instance of the floating-point matrix structure.
582    * @param[in]     nRows     number of rows in the matrix.
583    * @param[in]     nColumns  number of columns in the matrix.
584    * @param[in]     pData     points to the matrix data array.
585    */
586 void arm_mat_init_q15(
587         arm_matrix_instance_q15 * S,
588         uint16_t nRows,
589         uint16_t nColumns,
590         q15_t * pData);
591 
592   /**
593    * @brief  Floating-point matrix initialization.
594    * @param[in,out] S         points to an instance of the floating-point matrix structure.
595    * @param[in]     nRows     number of rows in the matrix.
596    * @param[in]     nColumns  number of columns in the matrix.
597    * @param[in]     pData     points to the matrix data array.
598    */
599 void arm_mat_init_f32(
600         arm_matrix_instance_f32 * S,
601         uint16_t nRows,
602         uint16_t nColumns,
603         float32_t * pData);
604 
605 
606 
607   /**
608    * @brief Floating-point matrix inverse.
609    * @param[in]  src   points to the instance of the input floating-point matrix structure.
610    * @param[out] dst   points to the instance of the output floating-point matrix structure.
611    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
612    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
613    */
614   arm_status arm_mat_inverse_f32(
615   const arm_matrix_instance_f32 * src,
616   arm_matrix_instance_f32 * dst);
617 
618 
619   /**
620    * @brief Floating-point matrix inverse.
621    * @param[in]  src   points to the instance of the input floating-point matrix structure.
622    * @param[out] dst   points to the instance of the output floating-point matrix structure.
623    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
624    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
625    */
626   arm_status arm_mat_inverse_f64(
627   const arm_matrix_instance_f64 * src,
628   arm_matrix_instance_f64 * dst);
629 
630  /**
631    * @brief Floating-point Cholesky decomposition of Symmetric Positive Definite Matrix.
632    * @param[in]  src   points to the instance of the input floating-point matrix structure.
633    * @param[out] dst   points to the instance of the output floating-point matrix structure.
634    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
635    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
636    * If the matrix is ill conditioned or only semi-definite, then it is better using the LDL^t decomposition.
637    * The decomposition is returning a lower triangular matrix.
638    */
639   arm_status arm_mat_cholesky_f64(
640   const arm_matrix_instance_f64 * src,
641   arm_matrix_instance_f64 * dst);
642 
643  /**
644    * @brief Floating-point Cholesky decomposition of Symmetric Positive Definite Matrix.
645    * @param[in]  src   points to the instance of the input floating-point matrix structure.
646    * @param[out] dst   points to the instance of the output floating-point matrix structure.
647    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
648    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
649    * If the matrix is ill conditioned or only semi-definite, then it is better using the LDL^t decomposition.
650    * The decomposition is returning a lower triangular matrix.
651    */
652   arm_status arm_mat_cholesky_f32(
653   const arm_matrix_instance_f32 * src,
654   arm_matrix_instance_f32 * dst);
655 
656   /**
657    * @brief Solve UT . X = A where UT is an upper triangular matrix
658    * @param[in]  ut  The upper triangular matrix
659    * @param[in]  a  The matrix a
660    * @param[out] dst The solution X of UT . X = A
661    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
662   */
663   arm_status arm_mat_solve_upper_triangular_f32(
664   const arm_matrix_instance_f32 * ut,
665   const arm_matrix_instance_f32 * a,
666   arm_matrix_instance_f32 * dst);
667 
668  /**
669    * @brief Solve LT . X = A where LT is a lower triangular matrix
670    * @param[in]  lt  The lower triangular matrix
671    * @param[in]  a  The matrix a
672    * @param[out] dst The solution X of LT . X = A
673    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
674    */
675   arm_status arm_mat_solve_lower_triangular_f32(
676   const arm_matrix_instance_f32 * lt,
677   const arm_matrix_instance_f32 * a,
678   arm_matrix_instance_f32 * dst);
679 
680 
681   /**
682    * @brief Solve UT . X = A where UT is an upper triangular matrix
683    * @param[in]  ut  The upper triangular matrix
684    * @param[in]  a  The matrix a
685    * @param[out] dst The solution X of UT . X = A
686    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
687   */
688   arm_status arm_mat_solve_upper_triangular_f64(
689   const arm_matrix_instance_f64 * ut,
690   const arm_matrix_instance_f64 * a,
691   arm_matrix_instance_f64 * dst);
692 
693  /**
694    * @brief Solve LT . X = A where LT is a lower triangular matrix
695    * @param[in]  lt  The lower triangular matrix
696    * @param[in]  a  The matrix a
697    * @param[out] dst The solution X of LT . X = A
698    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
699    */
700   arm_status arm_mat_solve_lower_triangular_f64(
701   const arm_matrix_instance_f64 * lt,
702   const arm_matrix_instance_f64 * a,
703   arm_matrix_instance_f64 * dst);
704 
705 
706   /**
707    * @brief Floating-point LDL decomposition of Symmetric Positive Semi-Definite Matrix.
708    * @param[in]  src   points to the instance of the input floating-point matrix structure.
709    * @param[out] l   points to the instance of the output floating-point triangular matrix structure.
710    * @param[out] d   points to the instance of the output floating-point diagonal matrix structure.
711    * @param[out] p   points to the instance of the output floating-point permutation vector.
712    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
713    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
714    * The decomposition is returning a lower triangular matrix.
715    */
716   arm_status arm_mat_ldlt_f32(
717   const arm_matrix_instance_f32 * src,
718   arm_matrix_instance_f32 * l,
719   arm_matrix_instance_f32 * d,
720   uint16_t * pp);
721 
722  /**
723    * @brief Floating-point LDL decomposition of Symmetric Positive Semi-Definite Matrix.
724    * @param[in]  src   points to the instance of the input floating-point matrix structure.
725    * @param[out] l   points to the instance of the output floating-point triangular matrix structure.
726    * @param[out] d   points to the instance of the output floating-point diagonal matrix structure.
727    * @param[out] p   points to the instance of the output floating-point permutation vector.
728    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
729    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
730    * The decomposition is returning a lower triangular matrix.
731    */
732   arm_status arm_mat_ldlt_f64(
733   const arm_matrix_instance_f64 * src,
734   arm_matrix_instance_f64 * l,
735   arm_matrix_instance_f64 * d,
736   uint16_t * pp);
737 
738 #ifdef   __cplusplus
739 }
740 #endif
741 
742 #endif /* ifndef _MATRIX_FUNCTIONS_H_ */
743