mirror of
				https://github.com/IcedRooibos/py32f0-template.git
				synced 2025-10-31 09:52:05 -07:00 
			
		
		
		
	
		
			
				
	
	
		
			758 lines
		
	
	
		
			30 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			758 lines
		
	
	
		
			30 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /******************************************************************************
 | |
|  * @file     matrix_functions.h
 | |
|  * @brief    Public header file for CMSIS DSP Library
 | |
|  * @version  V1.10.0
 | |
|  * @date     08 July 2021
 | |
|  * Target Processor: Cortex-M and Cortex-A cores
 | |
|  ******************************************************************************/
 | |
| /*
 | |
|  * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
 | |
|  *
 | |
|  * SPDX-License-Identifier: Apache-2.0
 | |
|  *
 | |
|  * Licensed under the Apache License, Version 2.0 (the License); you may
 | |
|  * not use this file except in compliance with the License.
 | |
|  * You may obtain a copy of the License at
 | |
|  *
 | |
|  * www.apache.org/licenses/LICENSE-2.0
 | |
|  *
 | |
|  * Unless required by applicable law or agreed to in writing, software
 | |
|  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 | |
|  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | |
|  * See the License for the specific language governing permissions and
 | |
|  * limitations under the License.
 | |
|  */
 | |
| 
 | |
|  
 | |
| #ifndef _MATRIX_FUNCTIONS_H_
 | |
| #define _MATRIX_FUNCTIONS_H_
 | |
| 
 | |
| #include "arm_math_types.h"
 | |
| #include "arm_math_memory.h"
 | |
| 
 | |
| #include "dsp/none.h"
 | |
| #include "dsp/utils.h"
 | |
| 
 | |
| #ifdef   __cplusplus
 | |
| extern "C"
 | |
| {
 | |
| #endif
 | |
| 
 | |
| /**
 | |
|  * @defgroup groupMatrix Matrix Functions
 | |
|  *
 | |
|  * This set of functions provides basic matrix math operations.
 | |
|  * The functions operate on matrix data structures.  For example,
 | |
|  * the type
 | |
|  * definition for the floating-point matrix structure is shown
 | |
|  * below:
 | |
|  * <pre>
 | |
|  *     typedef struct
 | |
|  *     {
 | |
|  *       uint16_t numRows;     // number of rows of the matrix.
 | |
|  *       uint16_t numCols;     // number of columns of the matrix.
 | |
|  *       float32_t *pData;     // points to the data of the matrix.
 | |
|  *     } arm_matrix_instance_f32;
 | |
|  * </pre>
 | |
|  * There are similar definitions for Q15 and Q31 data types.
 | |
|  *
 | |
|  * The structure specifies the size of the matrix and then points to
 | |
|  * an array of data.  The array is of size <code>numRows X numCols</code>
 | |
|  * and the values are arranged in row order.  That is, the
 | |
|  * matrix element (i, j) is stored at:
 | |
|  * <pre>
 | |
|  *     pData[i*numCols + j]
 | |
|  * </pre>
 | |
|  *
 | |
|  * \par Init Functions
 | |
|  * There is an associated initialization function for each type of matrix
 | |
|  * data structure.
 | |
|  * The initialization function sets the values of the internal structure fields.
 | |
|  * Refer to \ref arm_mat_init_f32(), \ref arm_mat_init_q31() and \ref arm_mat_init_q15()
 | |
|  * for floating-point, Q31 and Q15 types,  respectively.
 | |
|  *
 | |
|  * \par
 | |
|  * Use of the initialization function is optional. However, if initialization function is used
 | |
|  * then the instance structure cannot be placed into a const data section.
 | |
|  * To place the instance structure in a const data
 | |
|  * section, manually initialize the data structure.  For example:
 | |
|  * <pre>
 | |
|  * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
 | |
|  * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
 | |
|  * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
 | |
|  * </pre>
 | |
|  * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
 | |
|  * specifies the number of columns, and <code>pData</code> points to the
 | |
|  * data array.
 | |
|  *
 | |
|  * \par Size Checking
 | |
|  * By default all of the matrix functions perform size checking on the input and
 | |
|  * output matrices. For example, the matrix addition function verifies that the
 | |
|  * two input matrices and the output matrix all have the same number of rows and
 | |
|  * columns. If the size check fails the functions return:
 | |
|  * <pre>
 | |
|  *     ARM_MATH_SIZE_MISMATCH
 | |
|  * </pre>
 | |
|  * Otherwise the functions return
 | |
|  * <pre>
 | |
|  *     ARM_MATH_SUCCESS
 | |
|  * </pre>
 | |
|  * There is some overhead associated with this matrix size checking.
 | |
|  * The matrix size checking is enabled via the \#define
 | |
|  * <pre>
 | |
|  *     ARM_MATH_MATRIX_CHECK
 | |
|  * </pre>
 | |
|  * within the library project settings.  By default this macro is defined
 | |
|  * and size checking is enabled. By changing the project settings and
 | |
|  * undefining this macro size checking is eliminated and the functions
 | |
|  * run a bit faster. With size checking disabled the functions always
 | |
|  * return <code>ARM_MATH_SUCCESS</code>.
 | |
|  */
 | |
| 
 | |
|   /**
 | |
|    * @brief Instance structure for the floating-point matrix structure.
 | |
|    */
 | |
|   typedef struct
 | |
|   {
 | |
|     uint16_t numRows;     /**< number of rows of the matrix.     */
 | |
|     uint16_t numCols;     /**< number of columns of the matrix.  */
 | |
|     float32_t *pData;     /**< points to the data of the matrix. */
 | |
|   } arm_matrix_instance_f32;
 | |
|  
 | |
|  /**
 | |
|    * @brief Instance structure for the floating-point matrix structure.
 | |
|    */
 | |
|   typedef struct
 | |
|   {
 | |
|     uint16_t numRows;     /**< number of rows of the matrix.     */
 | |
|     uint16_t numCols;     /**< number of columns of the matrix.  */
 | |
|     float64_t *pData;     /**< points to the data of the matrix. */
 | |
|   } arm_matrix_instance_f64;
 | |
| 
 | |
|  /**
 | |
|    * @brief Instance structure for the Q7 matrix structure.
 | |
|    */
 | |
|   typedef struct
 | |
|   {
 | |
|     uint16_t numRows;     /**< number of rows of the matrix.     */
 | |
|     uint16_t numCols;     /**< number of columns of the matrix.  */
 | |
|     q7_t *pData;         /**< points to the data of the matrix. */
 | |
|   } arm_matrix_instance_q7;
 | |
| 
 | |
|   /**
 | |
|    * @brief Instance structure for the Q15 matrix structure.
 | |
|    */
 | |
|   typedef struct
 | |
|   {
 | |
|     uint16_t numRows;     /**< number of rows of the matrix.     */
 | |
|     uint16_t numCols;     /**< number of columns of the matrix.  */
 | |
|     q15_t *pData;         /**< points to the data of the matrix. */
 | |
|   } arm_matrix_instance_q15;
 | |
| 
 | |
|   /**
 | |
|    * @brief Instance structure for the Q31 matrix structure.
 | |
|    */
 | |
|   typedef struct
 | |
|   {
 | |
|     uint16_t numRows;     /**< number of rows of the matrix.     */
 | |
|     uint16_t numCols;     /**< number of columns of the matrix.  */
 | |
|     q31_t *pData;         /**< points to the data of the matrix. */
 | |
|   } arm_matrix_instance_q31;
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix addition.
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_add_f32(
 | |
|   const arm_matrix_instance_f32 * pSrcA,
 | |
|   const arm_matrix_instance_f32 * pSrcB,
 | |
|         arm_matrix_instance_f32 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 matrix addition.
 | |
|    * @param[in]   pSrcA  points to the first input matrix structure
 | |
|    * @param[in]   pSrcB  points to the second input matrix structure
 | |
|    * @param[out]  pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_add_q15(
 | |
|   const arm_matrix_instance_q15 * pSrcA,
 | |
|   const arm_matrix_instance_q15 * pSrcB,
 | |
|         arm_matrix_instance_q15 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix addition.
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_add_q31(
 | |
|   const arm_matrix_instance_q31 * pSrcA,
 | |
|   const arm_matrix_instance_q31 * pSrcB,
 | |
|         arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point, complex, matrix multiplication.
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_cmplx_mult_f32(
 | |
|   const arm_matrix_instance_f32 * pSrcA,
 | |
|   const arm_matrix_instance_f32 * pSrcB,
 | |
|         arm_matrix_instance_f32 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15, complex,  matrix multiplication.
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_cmplx_mult_q15(
 | |
|   const arm_matrix_instance_q15 * pSrcA,
 | |
|   const arm_matrix_instance_q15 * pSrcB,
 | |
|         arm_matrix_instance_q15 * pDst,
 | |
|         q15_t * pScratch);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31, complex, matrix multiplication.
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_cmplx_mult_q31(
 | |
|   const arm_matrix_instance_q31 * pSrcA,
 | |
|   const arm_matrix_instance_q31 * pSrcB,
 | |
|         arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_trans_f32(
 | |
|   const arm_matrix_instance_f32 * pSrc,
 | |
|         arm_matrix_instance_f32 * pDst);
 | |
| 
 | |
| /**
 | |
|    * @brief Floating-point matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_trans_f64(
 | |
|   const arm_matrix_instance_f64 * pSrc,
 | |
|         arm_matrix_instance_f64 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point complex matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_cmplx_trans_f32(
 | |
|   const arm_matrix_instance_f32 * pSrc,
 | |
|   arm_matrix_instance_f32 * pDst);
 | |
| 
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_trans_q15(
 | |
|   const arm_matrix_instance_q15 * pSrc,
 | |
|         arm_matrix_instance_q15 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 complex matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_cmplx_trans_q15(
 | |
|   const arm_matrix_instance_q15 * pSrc,
 | |
|   arm_matrix_instance_q15 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q7 matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_trans_q7(
 | |
|   const arm_matrix_instance_q7 * pSrc,
 | |
|         arm_matrix_instance_q7 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_trans_q31(
 | |
|   const arm_matrix_instance_q31 * pSrc,
 | |
|         arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 complex matrix transpose.
 | |
|    * @param[in]  pSrc  points to the input matrix
 | |
|    * @param[out] pDst  points to the output matrix
 | |
|    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
 | |
|    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_cmplx_trans_q31(
 | |
|   const arm_matrix_instance_q31 * pSrc,
 | |
|   arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix multiplication
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_f32(
 | |
|   const arm_matrix_instance_f32 * pSrcA,
 | |
|   const arm_matrix_instance_f32 * pSrcB,
 | |
|         arm_matrix_instance_f32 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix multiplication
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_f64(
 | |
|   const arm_matrix_instance_f64 * pSrcA,
 | |
|   const arm_matrix_instance_f64 * pSrcB,
 | |
|         arm_matrix_instance_f64 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix and vector multiplication
 | |
|    * @param[in]  pSrcMat  points to the input matrix structure
 | |
|    * @param[in]  pVec     points to vector
 | |
|    * @param[out] pDst     points to output vector
 | |
|    */
 | |
| void arm_mat_vec_mult_f32(
 | |
|   const arm_matrix_instance_f32 *pSrcMat, 
 | |
|   const float32_t *pVec, 
 | |
|   float32_t *pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q7 matrix multiplication
 | |
|    * @param[in]  pSrcA   points to the first input matrix structure
 | |
|    * @param[in]  pSrcB   points to the second input matrix structure
 | |
|    * @param[out] pDst    points to output matrix structure
 | |
|    * @param[in]  pState  points to the array for storing intermediate results
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_q7(
 | |
|   const arm_matrix_instance_q7 * pSrcA,
 | |
|   const arm_matrix_instance_q7 * pSrcB,
 | |
|         arm_matrix_instance_q7 * pDst,
 | |
|         q7_t * pState);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q7 matrix and vector multiplication
 | |
|    * @param[in]  pSrcMat  points to the input matrix structure
 | |
|    * @param[in]  pVec     points to vector
 | |
|    * @param[out] pDst     points to output vector
 | |
|    */
 | |
| void arm_mat_vec_mult_q7(
 | |
|   const arm_matrix_instance_q7 *pSrcMat, 
 | |
|   const q7_t *pVec, 
 | |
|   q7_t *pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 matrix multiplication
 | |
|    * @param[in]  pSrcA   points to the first input matrix structure
 | |
|    * @param[in]  pSrcB   points to the second input matrix structure
 | |
|    * @param[out] pDst    points to output matrix structure
 | |
|    * @param[in]  pState  points to the array for storing intermediate results
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_q15(
 | |
|   const arm_matrix_instance_q15 * pSrcA,
 | |
|   const arm_matrix_instance_q15 * pSrcB,
 | |
|         arm_matrix_instance_q15 * pDst,
 | |
|         q15_t * pState);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 matrix and vector multiplication
 | |
|    * @param[in]  pSrcMat  points to the input matrix structure
 | |
|    * @param[in]  pVec     points to vector
 | |
|    * @param[out] pDst     points to output vector
 | |
|    */
 | |
| void arm_mat_vec_mult_q15(
 | |
|   const arm_matrix_instance_q15 *pSrcMat, 
 | |
|   const q15_t *pVec, 
 | |
|   q15_t *pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
 | |
|    * @param[in]  pSrcA   points to the first input matrix structure
 | |
|    * @param[in]  pSrcB   points to the second input matrix structure
 | |
|    * @param[out] pDst    points to output matrix structure
 | |
|    * @param[in]  pState  points to the array for storing intermediate results
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_fast_q15(
 | |
|   const arm_matrix_instance_q15 * pSrcA,
 | |
|   const arm_matrix_instance_q15 * pSrcB,
 | |
|         arm_matrix_instance_q15 * pDst,
 | |
|         q15_t * pState);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix multiplication
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_q31(
 | |
|   const arm_matrix_instance_q31 * pSrcA,
 | |
|   const arm_matrix_instance_q31 * pSrcB,
 | |
|         arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix multiplication
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @param[in]  pState  points to the array for storing intermediate results
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_opt_q31(
 | |
|   const arm_matrix_instance_q31 * pSrcA,
 | |
|   const arm_matrix_instance_q31 * pSrcB,
 | |
|         arm_matrix_instance_q31 * pDst,
 | |
|         q31_t *pState);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix and vector multiplication
 | |
|    * @param[in]  pSrcMat  points to the input matrix structure
 | |
|    * @param[in]  pVec     points to vector
 | |
|    * @param[out] pDst     points to output vector
 | |
|    */
 | |
| void arm_mat_vec_mult_q31(
 | |
|   const arm_matrix_instance_q31 *pSrcMat, 
 | |
|   const q31_t *pVec, 
 | |
|   q31_t *pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_mult_fast_q31(
 | |
|   const arm_matrix_instance_q31 * pSrcA,
 | |
|   const arm_matrix_instance_q31 * pSrcB,
 | |
|         arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix subtraction
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_sub_f32(
 | |
|   const arm_matrix_instance_f32 * pSrcA,
 | |
|   const arm_matrix_instance_f32 * pSrcB,
 | |
|         arm_matrix_instance_f32 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix subtraction
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_sub_f64(
 | |
|   const arm_matrix_instance_f64 * pSrcA,
 | |
|   const arm_matrix_instance_f64 * pSrcB,
 | |
|         arm_matrix_instance_f64 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 matrix subtraction
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_sub_q15(
 | |
|   const arm_matrix_instance_q15 * pSrcA,
 | |
|   const arm_matrix_instance_q15 * pSrcB,
 | |
|         arm_matrix_instance_q15 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix subtraction
 | |
|    * @param[in]  pSrcA  points to the first input matrix structure
 | |
|    * @param[in]  pSrcB  points to the second input matrix structure
 | |
|    * @param[out] pDst   points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_sub_q31(
 | |
|   const arm_matrix_instance_q31 * pSrcA,
 | |
|   const arm_matrix_instance_q31 * pSrcB,
 | |
|         arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix scaling.
 | |
|    * @param[in]  pSrc   points to the input matrix
 | |
|    * @param[in]  scale  scale factor
 | |
|    * @param[out] pDst   points to the output matrix
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_scale_f32(
 | |
|   const arm_matrix_instance_f32 * pSrc,
 | |
|         float32_t scale,
 | |
|         arm_matrix_instance_f32 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q15 matrix scaling.
 | |
|    * @param[in]  pSrc        points to input matrix
 | |
|    * @param[in]  scaleFract  fractional portion of the scale factor
 | |
|    * @param[in]  shift       number of bits to shift the result by
 | |
|    * @param[out] pDst        points to output matrix
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_scale_q15(
 | |
|   const arm_matrix_instance_q15 * pSrc,
 | |
|         q15_t scaleFract,
 | |
|         int32_t shift,
 | |
|         arm_matrix_instance_q15 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Q31 matrix scaling.
 | |
|    * @param[in]  pSrc        points to input matrix
 | |
|    * @param[in]  scaleFract  fractional portion of the scale factor
 | |
|    * @param[in]  shift       number of bits to shift the result by
 | |
|    * @param[out] pDst        points to output matrix structure
 | |
|    * @return     The function returns either
 | |
|    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
 | |
|    */
 | |
| arm_status arm_mat_scale_q31(
 | |
|   const arm_matrix_instance_q31 * pSrc,
 | |
|         q31_t scaleFract,
 | |
|         int32_t shift,
 | |
|         arm_matrix_instance_q31 * pDst);
 | |
| 
 | |
|   /**
 | |
|    * @brief  Q31 matrix initialization.
 | |
|    * @param[in,out] S         points to an instance of the floating-point matrix structure.
 | |
|    * @param[in]     nRows     number of rows in the matrix.
 | |
|    * @param[in]     nColumns  number of columns in the matrix.
 | |
|    * @param[in]     pData     points to the matrix data array.
 | |
|    */
 | |
| void arm_mat_init_q31(
 | |
|         arm_matrix_instance_q31 * S,
 | |
|         uint16_t nRows,
 | |
|         uint16_t nColumns,
 | |
|         q31_t * pData);
 | |
| 
 | |
|   /**
 | |
|    * @brief  Q15 matrix initialization.
 | |
|    * @param[in,out] S         points to an instance of the floating-point matrix structure.
 | |
|    * @param[in]     nRows     number of rows in the matrix.
 | |
|    * @param[in]     nColumns  number of columns in the matrix.
 | |
|    * @param[in]     pData     points to the matrix data array.
 | |
|    */
 | |
| void arm_mat_init_q15(
 | |
|         arm_matrix_instance_q15 * S,
 | |
|         uint16_t nRows,
 | |
|         uint16_t nColumns,
 | |
|         q15_t * pData);
 | |
| 
 | |
|   /**
 | |
|    * @brief  Floating-point matrix initialization.
 | |
|    * @param[in,out] S         points to an instance of the floating-point matrix structure.
 | |
|    * @param[in]     nRows     number of rows in the matrix.
 | |
|    * @param[in]     nColumns  number of columns in the matrix.
 | |
|    * @param[in]     pData     points to the matrix data array.
 | |
|    */
 | |
| void arm_mat_init_f32(
 | |
|         arm_matrix_instance_f32 * S,
 | |
|         uint16_t nRows,
 | |
|         uint16_t nColumns,
 | |
|         float32_t * pData);
 | |
| 
 | |
| 
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix inverse.
 | |
|    * @param[in]  src   points to the instance of the input floating-point matrix structure.
 | |
|    * @param[out] dst   points to the instance of the output floating-point matrix structure.
 | |
|    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
 | |
|    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
 | |
|    */
 | |
|   arm_status arm_mat_inverse_f32(
 | |
|   const arm_matrix_instance_f32 * src,
 | |
|   arm_matrix_instance_f32 * dst);
 | |
| 
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point matrix inverse.
 | |
|    * @param[in]  src   points to the instance of the input floating-point matrix structure.
 | |
|    * @param[out] dst   points to the instance of the output floating-point matrix structure.
 | |
|    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
 | |
|    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
 | |
|    */
 | |
|   arm_status arm_mat_inverse_f64(
 | |
|   const arm_matrix_instance_f64 * src,
 | |
|   arm_matrix_instance_f64 * dst);
 | |
| 
 | |
|  /**
 | |
|    * @brief Floating-point Cholesky decomposition of Symmetric Positive Definite Matrix.
 | |
|    * @param[in]  src   points to the instance of the input floating-point matrix structure.
 | |
|    * @param[out] dst   points to the instance of the output floating-point matrix structure.
 | |
|    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
 | |
|    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
 | |
|    * If the matrix is ill conditioned or only semi-definite, then it is better using the LDL^t decomposition.
 | |
|    * The decomposition is returning a lower triangular matrix.
 | |
|    */
 | |
|   arm_status arm_mat_cholesky_f64(
 | |
|   const arm_matrix_instance_f64 * src,
 | |
|   arm_matrix_instance_f64 * dst);
 | |
| 
 | |
|  /**
 | |
|    * @brief Floating-point Cholesky decomposition of Symmetric Positive Definite Matrix.
 | |
|    * @param[in]  src   points to the instance of the input floating-point matrix structure.
 | |
|    * @param[out] dst   points to the instance of the output floating-point matrix structure.
 | |
|    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
 | |
|    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
 | |
|    * If the matrix is ill conditioned or only semi-definite, then it is better using the LDL^t decomposition.
 | |
|    * The decomposition is returning a lower triangular matrix.
 | |
|    */
 | |
|   arm_status arm_mat_cholesky_f32(
 | |
|   const arm_matrix_instance_f32 * src,
 | |
|   arm_matrix_instance_f32 * dst);
 | |
| 
 | |
|   /**
 | |
|    * @brief Solve UT . X = A where UT is an upper triangular matrix
 | |
|    * @param[in]  ut  The upper triangular matrix
 | |
|    * @param[in]  a  The matrix a
 | |
|    * @param[out] dst The solution X of UT . X = A
 | |
|    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
 | |
|   */
 | |
|   arm_status arm_mat_solve_upper_triangular_f32(
 | |
|   const arm_matrix_instance_f32 * ut,
 | |
|   const arm_matrix_instance_f32 * a,
 | |
|   arm_matrix_instance_f32 * dst);
 | |
| 
 | |
|  /**
 | |
|    * @brief Solve LT . X = A where LT is a lower triangular matrix
 | |
|    * @param[in]  lt  The lower triangular matrix
 | |
|    * @param[in]  a  The matrix a
 | |
|    * @param[out] dst The solution X of LT . X = A
 | |
|    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
 | |
|    */
 | |
|   arm_status arm_mat_solve_lower_triangular_f32(
 | |
|   const arm_matrix_instance_f32 * lt,
 | |
|   const arm_matrix_instance_f32 * a,
 | |
|   arm_matrix_instance_f32 * dst);
 | |
| 
 | |
| 
 | |
|   /**
 | |
|    * @brief Solve UT . X = A where UT is an upper triangular matrix
 | |
|    * @param[in]  ut  The upper triangular matrix
 | |
|    * @param[in]  a  The matrix a
 | |
|    * @param[out] dst The solution X of UT . X = A
 | |
|    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
 | |
|   */
 | |
|   arm_status arm_mat_solve_upper_triangular_f64(
 | |
|   const arm_matrix_instance_f64 * ut,
 | |
|   const arm_matrix_instance_f64 * a,
 | |
|   arm_matrix_instance_f64 * dst);
 | |
| 
 | |
|  /**
 | |
|    * @brief Solve LT . X = A where LT is a lower triangular matrix
 | |
|    * @param[in]  lt  The lower triangular matrix
 | |
|    * @param[in]  a  The matrix a
 | |
|    * @param[out] dst The solution X of LT . X = A
 | |
|    * @return The function returns ARM_MATH_SINGULAR, if the system can't be solved.
 | |
|    */
 | |
|   arm_status arm_mat_solve_lower_triangular_f64(
 | |
|   const arm_matrix_instance_f64 * lt,
 | |
|   const arm_matrix_instance_f64 * a,
 | |
|   arm_matrix_instance_f64 * dst);
 | |
| 
 | |
| 
 | |
|   /**
 | |
|    * @brief Floating-point LDL decomposition of Symmetric Positive Semi-Definite Matrix.
 | |
|    * @param[in]  src   points to the instance of the input floating-point matrix structure.
 | |
|    * @param[out] l   points to the instance of the output floating-point triangular matrix structure.
 | |
|    * @param[out] d   points to the instance of the output floating-point diagonal matrix structure.
 | |
|    * @param[out] p   points to the instance of the output floating-point permutation vector.
 | |
|    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
 | |
|    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
 | |
|    * The decomposition is returning a lower triangular matrix.
 | |
|    */
 | |
|   arm_status arm_mat_ldlt_f32(
 | |
|   const arm_matrix_instance_f32 * src,
 | |
|   arm_matrix_instance_f32 * l,
 | |
|   arm_matrix_instance_f32 * d,
 | |
|   uint16_t * pp);
 | |
| 
 | |
|  /**
 | |
|    * @brief Floating-point LDL decomposition of Symmetric Positive Semi-Definite Matrix.
 | |
|    * @param[in]  src   points to the instance of the input floating-point matrix structure.
 | |
|    * @param[out] l   points to the instance of the output floating-point triangular matrix structure.
 | |
|    * @param[out] d   points to the instance of the output floating-point diagonal matrix structure.
 | |
|    * @param[out] p   points to the instance of the output floating-point permutation vector.
 | |
|    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
 | |
|    * If the input matrix does not have a decomposition, then the algorithm terminates and returns error status ARM_MATH_DECOMPOSITION_FAILURE.
 | |
|    * The decomposition is returning a lower triangular matrix.
 | |
|    */
 | |
|   arm_status arm_mat_ldlt_f64(
 | |
|   const arm_matrix_instance_f64 * src,
 | |
|   arm_matrix_instance_f64 * l,
 | |
|   arm_matrix_instance_f64 * d,
 | |
|   uint16_t * pp);
 | |
| 
 | |
| #ifdef   __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif /* ifndef _MATRIX_FUNCTIONS_H_ */
 | 
