Skip to content

matrix scale

Module: Matrix Functions

More...

Modules

Name
matrix scale Kernels

Functions

Name
void plp_mat_scale_f32(const float restrict pSrc, uint32_t M, uint32_t N, float scaleFactor, float restrict pDst)
Glue code for matrix scale of 32-bit floating-point matrices.
void plp_mat_scale_f32_parallel(const float restrict pSrc, uint32_t M, uint32_t N, float scaleFactor, uint32_t nPE, float restrict pDst)
Glue code for parallel matrix scale of 32-bit floating-point matrices.
void plp_mat_scale_i16(const int16_t restrict pSrc, uint32_t M, uint32_t N, int16_t scaleFactor, int32_t shift, int16_t restrict pDst)
Glue code for matrix scale of 16-bit integer matrices.
void plp_mat_scale_i16_parallel(const int16_t restrict pSrc, uint32_t M, uint32_t N, int16_t scaleFactor, int32_t shift, uint32_t nPE, int16_t restrict pDst)
Glue code for parallel matrix scale of 16-bit integer matrices.
void plp_mat_scale_i32(const int32_t restrict pSrc, uint32_t M, uint32_t N, int32_t scaleFactor, int32_t shift, int32_t restrict pDst)
Glue code for matrix scale of 16-bit integer matrices.
void plp_mat_scale_i32_parallel(const int32_t restrict pSrc, uint32_t M, uint32_t N, int32_t scaleFactor, int32_t shift, uint32_t nPE, int32_t restrict pDst)
Glue code for parallel matrix scale of 16-bit integer matrices.
void plp_mat_scale_i8(const int8_t restrict pSrc, uint32_t M, uint32_t N, int8_t scaleFactor, int32_t shift, int8_t restrict pDst)
Glue code for matrix scale of 16-bit integer matrices.
void plp_mat_scale_i8_parallel(const int8_t restrict pSrc, uint32_t M, uint32_t N, int8_t scaleFactor, int32_t shift, uint32_t nPE, int8_t restrict pDst)
Glue code for parallel matrix scale of 16-bit integer matrices.

Detailed Description

This module contains the glue code for matrix scale. The kernel codes (kernels) are in the Module strided matrix scale Kernels.

The Matrix Scale applies a scalar multiplication, followed by a bitshift operation to every element in the matrix. For floating-point implementations, the bitshift operation is not applied.

`pDst[m,n] = (pSrc[m,n] * scale) >> shift`

There are functions for integer 32- 16- and 8-bit data types. For lower precision integers (16- and 8-bit), functions exploiting SIMD instructions are provided.

The naming scheme of the functions follows the following pattern (for example plp_mat_stride_i32):

`plp_<function name>_<data type><precision>[_parallel]`
name description
function_name mat_scale
data type {f, i, q} respectively for floats, integers, fixed points
precision {32, 16, 8} bits

Functions Documentation

function plp_mat_scale_f32

void plp_mat_scale_f32(
    const float *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    float scaleFactor,
    float *__restrict__ pDst
)

Glue code for matrix scale of 32-bit floating-point matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements
  • pDst Points to the output matrix

Return: none

Glue code for matrix scale of a 32-bit floating-point matrices.

function plp_mat_scale_f32_parallel

void plp_mat_scale_f32_parallel(
    const float *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    float scaleFactor,
    uint32_t nPE,
    float *__restrict__ pDst
)

Glue code for parallel matrix scale of 32-bit floating-point matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix scale of a 32-bit floating-point matrices.

function plp_mat_scale_i16

void plp_mat_scale_i16(
    const int16_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int16_t scaleFactor,
    int32_t shift,
    int16_t *__restrict__ pDst
)

Glue code for matrix scale of 16-bit integer matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

Glue code for matrix scale of a 16-bit integer matrices.

function plp_mat_scale_i16_parallel

void plp_mat_scale_i16_parallel(
    const int16_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int16_t scaleFactor,
    int32_t shift,
    uint32_t nPE,
    int16_t *__restrict__ pDst
)

Glue code for parallel matrix scale of 16-bit integer matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix scale of a 16-bit integer matrices.

function plp_mat_scale_i32

void plp_mat_scale_i32(
    const int32_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int32_t scaleFactor,
    int32_t shift,
    int32_t *__restrict__ pDst
)

Glue code for matrix scale of 16-bit integer matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

Glue code for matrix scale of a 32-bit integer matrices.

function plp_mat_scale_i32_parallel

void plp_mat_scale_i32_parallel(
    const int32_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int32_t scaleFactor,
    int32_t shift,
    uint32_t nPE,
    int32_t *__restrict__ pDst
)

Glue code for parallel matrix scale of 16-bit integer matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements before shifting
  • nPE Number of cores to use for computation
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix scale of a 32-bit integer matrices.

function plp_mat_scale_i8

void plp_mat_scale_i8(
    const int8_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int8_t scaleFactor,
    int32_t shift,
    int8_t *__restrict__ pDst
)

Glue code for matrix scale of 16-bit integer matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

Glue code for matrix scale of a 8-bit integer matrices.

function plp_mat_scale_i8_parallel

void plp_mat_scale_i8_parallel(
    const int8_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int8_t scaleFactor,
    int32_t shift,
    uint32_t nPE,
    int8_t *__restrict__ pDst
)

Glue code for parallel matrix scale of 16-bit integer matrices.

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix scale of a 8-bit integer matrices.


Updated on 2023-03-01 at 16:16:32 +0000