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; \
} \
}