Document toolboxDocument toolbox

(8.D.2.3) MatrixMultiplication

Overview

Matrix multiplication of two input pins

Discussion

The matrix multiplication module implements simple two dimensional multiplication of two matrices. Both real and complex data types are supported. Complex input matrices produces complex output matrix.

Matrix representation of the each input pin and the output pin is as follows:

    blockSize - represents the matrix rows

    numChannels - represents the matrix columns

Transposing the first, second, or both matrices is also supported through the constructor argument MATRIX_MULT_OP. This allows users to avoid explicit traspose of the input matrices if the matrix dimension not valid for multiplication. Possible options of the argument MATRIX_MULT_OP:

A*B - input matrices multiplied as it is.

(A^T)*B - first matrix is transposed before the multiplication. i.e. dimension of the first matrix is transposed.

A*(B^T) - second matrix is transposed before the multiplication. i.e. dimension of the second matrix is transposed.

(A^T)*(B^T) - both the matrices are transposed before the multiplication. i.e. dimension of both matrices are transposed.

Module bypass behavior is same as active. i.e. module process function is called when the module status is bypassed.

Type Definition

typedef struct _ModuleMatrixMultiplication { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 matrixMultOp; // Matrix multiplication operation. Supported are A*B, (A^T)*B, A*(B^T) and (A^T)*(B^T) void * hardware_specific_struct_pointer; // This may point to a struct that varies based on the target platform } ModuleMatrixMultiplicationClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

matrixMultOp

int

const

1

2

Unrestricted

 

hardware_specific_struct_pointer

void *

state

1

 

Unrestricted

 

Pins

Input Pins

Name: in1(A)

Description: Input matrix A

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

 

Name: in2(B)

Description: Input matrix B

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

Output Pins

Name: out

Description: Output matrix

Data type: float

Scratch Pins

Channel count: 1

Block size: 34

Sample rate: 48000

MATLAB Usage

File Name: matrix_multiplication_module.m

M=matrix_multiplication_module(NAME, MATRIX_MULT_OP) Creates a matrix multiplication module for use in the Audio Weaver environment. The module has two input pins and one output pin. Each input pin is a two dimensional matrix. The number of input rows and columns per input pin is determined by the upstream audio module. Output pin matrix dimension is determined by the multiplication operation selection from the argument MATRIX_MULT_OP. Arguments: NAME - name of the module. MATRIX_MULT_OP - matrix multiplication type. Available options are A * B (A^T) * B A * (B^T) (A^T) * (B^T) Default operation is A * (B^T)

Â