Table Of Contents

A x B (G Dataflow)

Last Modified: January 9, 2017

Performs the multiplication of two input matrices or an input matrix and an input vector.

connector_pane_image
datatype_icon

matrix A

The input matrix.

This input accepts the following data types:

  • 1D array of double-precision, floating-point numbers
  • 1D array of complex double-precision, floating-point numbers
  • 2D array of double-precision, floating-point numbers
  • 2D array of complex double-precision, floating-point numbers

The inputs of this node cannot both be vectors.

If the inputs of this node are both matrices, the number of columns in the first matrix must match the number of rows in the second matrix and must be greater than zero. Otherwise, the node returns an empty array as the output matrix multiplication and returns an error.

datatype_icon

matrix B

The second matrix.

If the inputs of this node are both matrices, the number of columns in the first matrix must match the number of rows in the second matrix and must be greater than zero. Otherwise, the node returns an empty array as the output matrix multiplication and returns an error.

datatype_icon

vector v'

The input vector.

This input accepts the following data types:

  • 1D array of double-precision, floating-point numbers
  • 1D array of complex double-precision, floating-point numbers

The inputs of this node cannot both be vectors.

datatype_icon

vector v

The input vector.

This input accepts the following data types:

  • 1D array of double-precision, floating-point numbers
  • 1D array of complex double-precision, floating-point numbers

The inputs of this node cannot both be vectors.

datatype_icon

error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

datatype_icon

A x B

Result of the multiplication of the first and second inputs.

This output changes to A x v or v' x A depending on the data type you wire to the inputs.

datatype_icon

error out

Error information. The node produces this output according to standard error behavior.

Algorithm for Calculating A × B

If A is an n-by-k matrix and B is a k-by-m matrix, the matrix multiplication of A and B, C = AB, results in a matrix, C, whose dimensions are n-by-m. Let A represent the 2D input matrix A, B represent the 2D input matrix B, and C represent the 2D output A x B. This node calculates the elements of C using the following equation.

c i j = l = 0 k 1 a i l b l j for { i = 0 , 1 , 2 , ... , n 1 j = 0 , 1 , 2 , ... , m 1

where

  • n is the number of rows in matrix A
  • k is the number of columns in matrix A and the number of rows in matrix B
  • m is the number of columns in matrix B
spd-note-note
Note  

This node performs a strict matrix multiplication and not an element-by-element 2D multiplication. To perform an element-by-element multiplication, use the Multiply node. In general, ABBA.

Algorithm for Calculating A × Vector

If A is an n-by-k matrix and x is a vector with k elements, the multiplication of A and x, y = Ax, results in a vector y with n elements. This node calculates the elements of y using the following equation.

y i = j = 0 k 1 a i j x j for  i = 0 , 1 , 2 , ... , n 1

where

  • y is the output A x v
  • A is the input matrix A
  • x is the input vector v
  • n is the number of rows in matrix A
  • k is the number of columns in matrix A and the number of elements in vector v

Algorithm for Calculating Vector × A

If X' is a row vector with n elements and A is an n-by-k matrix, the multiplication of X' and A, Y = X'A, results in a row vector Y' with k elements. This node calculates the elements of Y' using the following equation.

y j = i = 0 n 1 a i j x i for  j = 0 , 1 , 2 , ... , k 1

and

X = [ x 0 x 1 x n 1 ] Y = [ y 0 y 1 y k 1 ]

where

  • Y' is the output v' x A
  • X' is the input vector v'
  • A is the input matrix B
  • n is the number of elements in vector v' and the number of rows in matrix B
  • k is the number of columns in matrix B

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported


Recently Viewed Topics