
特别说明:完整45期数字信号处理教程,原创高性能示波器代码全开源地址:链接 第20章 MatrixFunctions的使用(二) 本期教程主要讲解矩阵运算中的放缩,乘法和转置。 20.1 矩阵放缩 MatScale 20.2 矩阵乘法 MatMult 20.3 转置矩阵 MatTrans 20.4 总结 20.1 矩阵放缩 MatScale 20.1.1 arm_mat_scale_f32 公式描述: ![]() 函数定义如下: arm_status arm_mat_scale_f32( const arm_matrix_instance_f32 * pSrc, float32_t scale, arm_matrix_instance_f32 * pDst) 参数定义: [in] *pSrc points to input matrix structure [in] scale scale factor to be applied [out] *pDst points to output matrix structure return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> 20.1.2 arm_mat_scale_q31 函数定义如下: arm_status arm_mat_scale_q31( const arm_matrix_instance_q31 * pSrc, q31_t scaleFract, int32_t shift, arm_matrix_instance_q31 * pDst) 参数定义: [in] *pSrc points to input matrix [in] scaleFract fractional portion of the scale factor [in] shift number of bits to shift the result by [out] *pDst points to output matrix structure return The function returns either 注意事项: 1. 两个1.31格式的数据相乘产生2.62格式的数据,最终结果要做偏移和饱和运算产生1.31格式数据。 2. 定点数的最终放缩比例计算是:scale = scaleFract * 2^shift. 20.1.3 arm_mat_scale_q15 函数定义如下: arm_status arm_mat_scale_q15( const arm_matrix_instance_q15 * pSrc, q15_t scaleFract, int32_t shift, arm_matrix_instance_q15 * pDst) 参数定义: [in,out] *S points to an instance of the floating-point matrix structure. [in] nRows number of rows in the matrix. [in] nColumns number of columns in the matrix. [in] *pData points to the matrix data array. 注意事项: 1. 两个1.15格式的数据相乘产生2.30格式的数据,最终结果要做偏移和饱和运算产生1.15格式数据。 2. 定点数的最终放缩比例计算是:scale = scaleFract * 2^shift. 20.1.4 实例讲解 实验目的: 1. 学习MatrixFunctions中矩阵的放缩 实验内容: 1. 按下按键K1, 串口打印函数DSP_MatScale的输出结果 实验现象: 通过窗口上位机软件SecureCRT(V5光盘里面有此软件)查看打印信息现象如下: ![]() 程序设计:
1. 下面通过matlab来实现矩阵的放缩: ![]() |
20.2.1 arm_mat_mult_f32
20.2.2 arm_mat_mult_q31
20.2.3 arm_mat_mult_q15
20.2.4 arm_mat_mult_fast_q31
20.2.5 arm_mat_mult_fast_q15
20.2.6 实例讲解
20.3.1 arm_mat_trans_f32
20.3.2 arm_mat_trans_q31
20.3.3 arm_mat_trans_q15
20.3.4 实例讲解