CMSIS-DSP  
CMSIS DSP Software Library
matrix_utils.h File Reference

Macros

#define ELEM(A, ROW, COL)   &((A)->pData[(A)->numCols* (ROW) + (COL)])
 
#define SCALE_COL_T(T, CAST, A, ROW, v, i)
 
#define COPY_COL_T(T, A, ROW, COL, DST)
 
#define SWAP_ROWS_F16(A, COL, i, j)
 
#define SCALE_ROW_F16(A, COL, v, i)
 
#define MAC_ROW_F16(COL, A, i, v, B, j)
 
#define MAS_ROW_F16(COL, A, i, v, B, j)
 
#define COPY_COL_F16(A, ROW, COL, DST)    COPY_COL_T(float16_t,A,ROW,COL,DST)
 
#define SCALE_COL_F16(A, ROW, v, i)    SCALE_COL_T(float16_t,(_Float16),A,ROW,v,i)
 
#define SWAP_ROWS_F32(A, COL, i, j)
 
#define MAC_ROW_F32(COL, A, i, v, B, j)
 
#define MAS_ROW_F32(COL, A, i, v, B, j)
 
#define SCALE_ROW_F32(A, COL, v, i)
 
#define COPY_COL_F32(A, ROW, COL, DST)    COPY_COL_T(float32_t,A,ROW,COL,DST)
 
#define COPY_COL_F64(A, ROW, COL, DST)    COPY_COL_T(float64_t,A,ROW,COL,DST)
 
#define SWAP_COLS_F32(A, COL, i, j)
 
#define SCALE_COL_F32(A, ROW, v, i)    SCALE_COL_T(float32_t,,A,ROW,v,i)
 
#define SWAP_ROWS_F64(A, COL, i, j)
 
#define SWAP_COLS_F64(A, COL, i, j)
 
#define SCALE_ROW_F64(A, COL, v, i)
 
#define SCALE_COL_F64(A, ROW, v, i)    SCALE_COL_T(float64_t,,A,ROW,v,i)
 
#define MAC_ROW_F64(COL, A, i, v, B, j)
 
#define MAS_ROW_F64(COL, A, i, v, B, j)
 

Macro Definition Documentation

◆ COPY_COL_F16

#define COPY_COL_F16 (   A,
  ROW,
  COL,
  DST 
)     COPY_COL_T(float16_t,A,ROW,COL,DST)

◆ COPY_COL_F32

#define COPY_COL_F32 (   A,
  ROW,
  COL,
  DST 
)     COPY_COL_T(float32_t,A,ROW,COL,DST)

◆ COPY_COL_F64

#define COPY_COL_F64 (   A,
  ROW,
  COL,
  DST 
)     COPY_COL_T(float64_t,A,ROW,COL,DST)

◆ COPY_COL_T

#define COPY_COL_T (   T,
  A,
  ROW,
  COL,
  DST 
)
Value:
{ \
uint32_t _row; \
T *_pb=DST; \
T *_pa = (A)->pData + ROW * (A)->numCols + COL;\
for(_row = ROW; _row < (A)->numRows; _row ++) \
{ \
*_pb++ = *_pa; \
_pa += (A)->numCols; \
} \
}

◆ ELEM

#define ELEM (   A,
  ROW,
  COL 
)    &((A)->pData[(A)->numCols* (ROW) + (COL)])

◆ MAC_ROW_F16

#define MAC_ROW_F16 (   COL,
  A,
  i,
  v,
  B,
 
)
Value:
{ \
int32_t _w; \
float16_t *dataA = (A)->pData; \
float16_t *dataB = (B)->pData; \
const int32_t _numCols = (A)->numCols; \
const int32_t nb = _numCols-(COL); \
\
dataA += i*_numCols + (COL); \
dataB += j*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
*dataA++ += (_Float16)v * (_Float16)*dataB++;\
} \
}

◆ MAC_ROW_F32

#define MAC_ROW_F32 (   COL,
  A,
  i,
  v,
  B,
 
)

◆ MAC_ROW_F64

#define MAC_ROW_F64 (   COL,
  A,
  i,
  v,
  B,
 
)
Value:
{ \
int32_t _w; \
float64_t *dataA = (A)->pData; \
float64_t *dataB = (B)->pData; \
const int32_t _numCols = (A)->numCols;\
const int32_t nb = _numCols-(COL); \
\
dataA += i*_numCols + (COL); \
dataB += j*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
*dataA++ += v* *dataB++; \
} \
}

◆ MAS_ROW_F16

#define MAS_ROW_F16 (   COL,
  A,
  i,
  v,
  B,
 
)
Value:
{ \
int32_t _w; \
float16_t *dataA = (A)->pData; \
float16_t *dataB = (B)->pData; \
const int32_t _numCols = (A)->numCols; \
const int32_t nb = _numCols-(COL); \
\
dataA += i*_numCols + (COL); \
dataB += j*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
*dataA++ -= (_Float16)v * (_Float16)*dataB++;\
} \
}

◆ MAS_ROW_F32

#define MAS_ROW_F32 (   COL,
  A,
  i,
  v,
  B,
 
)

◆ MAS_ROW_F64

#define MAS_ROW_F64 (   COL,
  A,
  i,
  v,
  B,
 
)
Value:
{ \
int32_t _w; \
float64_t *dataA = (A)->pData; \
float64_t *dataB = (B)->pData; \
const int32_t _numCols = (A)->numCols;\
const int32_t nb = _numCols-(COL); \
\
dataA += i*_numCols + (COL); \
dataB += j*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
*dataA++ -= v* *dataB++; \
} \
}

◆ SCALE_COL_F16

#define SCALE_COL_F16 (   A,
  ROW,
  v,
 
)     SCALE_COL_T(float16_t,(_Float16),A,ROW,v,i)

◆ SCALE_COL_F32

#define SCALE_COL_F32 (   A,
  ROW,
  v,
 
)     SCALE_COL_T(float32_t,,A,ROW,v,i)

◆ SCALE_COL_F64

#define SCALE_COL_F64 (   A,
  ROW,
  v,
 
)     SCALE_COL_T(float64_t,,A,ROW,v,i)

◆ SCALE_COL_T

#define SCALE_COL_T (   T,
  CAST,
  A,
  ROW,
  v,
 
)
Value:
{ \
int32_t _w; \
T *data = (A)->pData; \
const int32_t _numCols = (A)->numCols; \
const int32_t nb = (A)->numRows - ROW;\
\
data += i + _numCols * (ROW); \
\
for(_w=0;_w < nb; _w++) \
{ \
*data *= CAST v; \
data += _numCols; \
} \
}

◆ SCALE_ROW_F16

#define SCALE_ROW_F16 (   A,
  COL,
  v,
 
)
Value:
{ \
int32_t _w; \
float16_t *data = (A)->pData; \
const int32_t _numCols = (A)->numCols;\
const int32_t nb = _numCols-(COL); \
\
data += i*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
*data++ *= (_Float16)v; \
} \
}

◆ SCALE_ROW_F32

#define SCALE_ROW_F32 (   A,
  COL,
  v,
 
)
Value:
{ \
float32_t *data = (A)->pData; \
const int32_t _numCols = (A)->numCols; \
const int32_t nb = _numCols - (COL); \
int32_t nbElems; \
f32x4_t vec = vdupq_n_f32(v); \
\
nbElems = nb >> 2; \
\
data += i*_numCols + (COL); \
while(nbElems>0) \
{ \
f32x4_t tmpa; \
tmpa = vld1q_f32(data); \
tmpa = vmulq_f32(tmpa,vec); \
vst1q_f32(data, tmpa); \
data += 4; \
nbElems --; \
} \
\
nbElems = nb & 3; \
while(nbElems > 0) \
{ \
*data++ *= v; \
nbElems--; \
} \
\
}

◆ SCALE_ROW_F64

#define SCALE_ROW_F64 (   A,
  COL,
  v,
 
)
Value:
{ \
int32_t _w; \
float64_t *data = (A)->pData; \
const int32_t _numCols = (A)->numCols;\
const int32_t nb = _numCols-(COL); \
\
data += i*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
*data++ *= v; \
} \
}

◆ SWAP_COLS_F32

#define SWAP_COLS_F32 (   A,
  COL,
  i,
 
)
Value:
{ \
int32_t _w; \
float32_t *data = (A)->pData; \
const int32_t _numCols = (A)->numCols; \
for(_w=(COL);_w < _numCols; _w++) \
{ \
float32_t tmp; \
tmp = data[_w*_numCols + i]; \
data[_w*_numCols + i] = data[_w*_numCols + j];\
data[_w*_numCols + j] = tmp; \
} \
}

◆ SWAP_COLS_F64

#define SWAP_COLS_F64 (   A,
  COL,
  i,
 
)
Value:
{ \
int32_t _w; \
float64_t *data = (A)->pData; \
const int32_t _numCols = (A)->numCols; \
for(_w=(COL);_w < _numCols; _w++) \
{ \
float64_t tmp; \
tmp = data[_w*_numCols + i]; \
data[_w*_numCols + i] = data[_w*_numCols + j];\
data[_w*_numCols + j] = tmp; \
} \
}

◆ SWAP_ROWS_F16

#define SWAP_ROWS_F16 (   A,
  COL,
  i,
 
)
Value:
{ \
int32_t _w; \
float16_t *dataI = (A)->pData; \
float16_t *dataJ = (A)->pData; \
const int32_t _numCols = (A)->numCols;\
const int32_t nb = _numCols-(COL); \
\
dataI += i*_numCols + (COL); \
dataJ += j*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
float16_t tmp; \
tmp = *dataI; \
*dataI++ = *dataJ; \
*dataJ++ = tmp; \
} \
}

◆ SWAP_ROWS_F32

#define SWAP_ROWS_F32 (   A,
  COL,
  i,
 
)
Value:
{ \
int32_t _w; \
float32_t *dataI = (A)->pData; \
float32_t *dataJ = (A)->pData; \
const int32_t _numCols = (A)->numCols;\
const int32_t nb = _numCols - COL; \
\
dataI += i*_numCols + (COL); \
dataJ += j*_numCols + (COL); \
\
float32_t tmp; \
\
for(_w=0;_w < nb; _w++) \
{ \
tmp = *dataI; \
*dataI++ = *dataJ; \
*dataJ++ = tmp; \
} \
}

◆ SWAP_ROWS_F64

#define SWAP_ROWS_F64 (   A,
  COL,
  i,
 
)
Value:
{ \
int32_t _w; \
float64_t *dataI = (A)->pData; \
float64_t *dataJ = (A)->pData; \
const int32_t _numCols = (A)->numCols;\
const int32_t nb = _numCols-(COL); \
\
dataI += i*_numCols + (COL); \
dataJ += j*_numCols + (COL); \
\
for(_w=0;_w < nb; _w++) \
{ \
float64_t tmp; \
tmp = *dataI; \
*dataI++ = *dataJ; \
*dataJ++ = tmp; \
} \
}