Matrix Addition
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_f16 (const riscv_matrix_instance_f16 *pSrcA, const riscv_matrix_instance_f16 *pSrcB, riscv_matrix_instance_f16 *pDst)
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_f32 (const riscv_matrix_instance_f32 *pSrcA, const riscv_matrix_instance_f32 *pSrcB, riscv_matrix_instance_f32 *pDst)
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_q15 (const riscv_matrix_instance_q15 *pSrcA, const riscv_matrix_instance_q15 *pSrcB, riscv_matrix_instance_q15 *pDst)
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_q31 (const riscv_matrix_instance_q31 *pSrcA, const riscv_matrix_instance_q31 *pSrcB, riscv_matrix_instance_q31 *pDst)
- group MatrixAdd
Adds two matrices.
\[\begin{split} \begin{pmatrix} a_{1,1} & a_{1,2} & a_{1,3} \\ a_{2,1} & a_{2,2} & a_{2,3} \\ a_{3,1} & a_{3,2} & a_{3,3} \\ \end{pmatrix} + \begin{pmatrix} b_{1,1} & b_{1,2} & b_{1,3} \\ b_{2,1} & b_{2,2} & b_{2,3} \\ b_{3,1} & b_{3,2} & b_{3,3} \\ \end{pmatrix} = \begin{pmatrix} a_{1,1}+b_{1,1} & a_{1,2}+b_{1,2} & a_{1,3}+b_{1,3} \\ a_{2,1}+b_{2,1} & a_{2,2}+b_{2,2} & a_{2,3}+b_{2,3} \\ a_{3,1}+b_{3,1} & a_{3,2}+b_{3,2} & a_{3,3}+b_{3,3} \\ \end{pmatrix} \end{split}\]- Addition of two 3 x 3 matrices
The functions check to make sure that
pSrcA
,pSrcB
, andpDst
have the same number of rows and columns.Functions
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_f16 (const riscv_matrix_instance_f16 *pSrcA, const riscv_matrix_instance_f16 *pSrcB, riscv_matrix_instance_f16 *pDst)
Floating-point matrix addition.
- Parameters
pSrcA – [in] points to first input matrix structure
pSrcB – [in] points to second input matrix structure
pDst – [out] points to output matrix structure
- Returns
execution status
RISCV_MATH_SUCCESS : Operation successful
RISCV_MATH_SIZE_MISMATCH : Matrix size check failed
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_f32 (const riscv_matrix_instance_f32 *pSrcA, const riscv_matrix_instance_f32 *pSrcB, riscv_matrix_instance_f32 *pDst)
Floating-point matrix addition.
- Parameters
pSrcA – [in] points to first input matrix structure
pSrcB – [in] points to second input matrix structure
pDst – [out] points to output matrix structure
- Returns
execution status
RISCV_MATH_SUCCESS : Operation successful
RISCV_MATH_SIZE_MISMATCH : Matrix size check failed
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_q15 (const riscv_matrix_instance_q15 *pSrcA, const riscv_matrix_instance_q15 *pSrcB, riscv_matrix_instance_q15 *pDst)
Q15 matrix addition.
- Scaling and Overflow Behavior
The function uses saturating arithmetic. Results outside of the allowable Q15 range [0x8000 0x7FFF] are saturated.
- Parameters
pSrcA – [in] points to first input matrix structure
pSrcB – [in] points to second input matrix structure
pDst – [out] points to output matrix structure
- Returns
execution status
RISCV_MATH_SUCCESS : Operation successful
RISCV_MATH_SIZE_MISMATCH : Matrix size check failed
- RISCV_DSP_ATTRIBUTE riscv_status riscv_mat_add_q31 (const riscv_matrix_instance_q31 *pSrcA, const riscv_matrix_instance_q31 *pSrcB, riscv_matrix_instance_q31 *pDst)
Q31 matrix addition.
- Scaling and Overflow Behavior
The function uses saturating arithmetic. Results outside of the allowable Q31 range [0x80000000 0x7FFFFFFF] are saturated.
- Parameters
pSrcA – [in] points to first input matrix structure
pSrcB – [in] points to second input matrix structure
pDst – [out] points to output matrix structure
- Returns
execution status
RISCV_MATH_SUCCESS : Operation successful
RISCV_MATH_SIZE_MISMATCH : Matrix size check failed