# A x B (G Dataflow)

Performs the multiplication of two input matrices or an input matrix and an input vector.  ## 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. ## 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. ## 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. ## 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. ## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error ## 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. ## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error  If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## 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.

$\begin{array}{cc}{c}_{ij}=\underset{l=0}{\overset{k-1}{\sum }}{a}_{il}{b}_{lj}& \text{for}\left\{\begin{array}{c}i=0,1,2,...,n-1\\ j=0,1,2,...,m-1\end{array}\end{array}$

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 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.

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.

and

$\begin{array}{c}X\prime =\left[\begin{array}{cccc}{x}_{0}& {x}_{1}& \dots & {x}_{n-1}\end{array}\right]\\ Y\prime =\left[\begin{array}{cccc}{y}_{0}& {y}_{1}& \dots & {y}_{k-1}\end{array}\right]\end{array}$

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

Web Server: Not supported in VIs that run in a web application