Strided Matrix operations
Modules
Detailed Description
Par: Example: Assume the following 4x5 matrix:
[
\mathbf{A} = \left[\begin{array}{lllll}
a_{00} & a_{01} & a_{02} & a_{03} & a_{04}\
a_{10} & a_{11} & a_{12} & a_{13} & a_{14}\
a_{20} & a_{21} & a_{22} & a_{23} & a_{24}\
a_{30} & a_{31} & a_{32} & a_{33} & a_{34}\
\end{array}\right]
] It linear memory, it is uint16_t pA[20] = [a_00, a_01, a_02, a_03, a_04, a_10, ..., a_34]
Per convention, the number of columns N = 5
and the number of rows M = 4
. Let's assume we wish to access only the sub matrix: [
\mathbf{A}{1:2,1:3} = \left[\begin{array}{lll}
a{11} & a_{12} & a_{13}\
a_{21} & a_{22} & a_{23}\
\end{array}\right]
] We can achieve this by passing the array as: pSrcA = pA + N + 1
, N = 3
, M = 2
and strideA = 5
. Notice that we need to change the pointer to the start of the matrix, and the dimensionality of the matrix. Also, strideA
is the original width of the matrix.
This module contains all matrix operations with strided access. Strided operations can be used to ooperate on a small region of an MxN matrix. All functions contain a stride
parameter for each operand. The stride
parameter is the number of elements between the start of each row. In other words, it is the number of columns of the original matrix.
Updated on 2023-03-01 at 16:16:31 +0000