Table Of Contents

Subspaces Angle (G Dataflow)

Last Modified: March 15, 2017

Computes the angle between column spaces of two matrices.

connector_pane_image
datatype_icon

vector a

A real vector.

This input accepts a 1D array of double-precision, floating-point numbers or a 2D array of double-precision, floating-point numbers. If this input is a 1D array of double-precision, floating-point numbers, you must wire a 1D array of double-precision, floating point numbers to vector b. This input changes to matrix A when the data type is a 2D array of double-precision, floating-point numbers.

Default: Empty array

datatype_icon

vector b

A real vector.

This input accepts a 1D array of double-precision, floating-point numbers or a 2D array of double-precision, floating-point numbers. This input changes to matrix B when the data type is a 2D array of double-precision, floating-point numbers.

The length of vector a or the number of rows in matrix A must equal the length of vector b or the number of rows in matrix B. Otherwise, the node returns NaN as the output angle and returns an error.

datatype_icon

matrix A

A real matrix.

This input accepts a 1D array of double-precision, floating-point numbers or a 2D array of double-precision, floating-point numbers. This input changes to vector a when the data type is a 1D array of double-precision, floating-point numbers.

datatype_icon

matrix B

A real matrix.

This input accepts a 1D array of double-precision, floating-point numbers or a 2D array of double-precision, floating-point numbers. This input changes to vector b when the data type is a 1D array of double-precision, floating-point numbers.

The length of vector a or the number of rows in matrix A must equal the length of vector b or the number of rows in matrix B. Otherwise, the node returns NaN as the output angle and returns an error.

datatype_icon

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

datatype_icon

angle

Angle, in radians, between the column subspaces of the inputs.

datatype_icon

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 the Angle between Subspaces of Two Matrices or Two Vectors

Let U1S1V1T and U2S2V2T be the singular value decomposition of matrix A and matrix B, respectively. The following equation defines the angle between the Euclidean subspaces that span the columns of matrix A and matrix B.

angle = arccos ( s )

where s is the minimum singular value of U1TU2.

For inputs vector a and vector b, the previous equation equals the following equation.

angle = arccos ( a T b a b )

where a is the input vector a and b is the input vector b, and the norm symbols (||.||) compute the 2-norm of the input vectors.

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices


Recently Viewed Topics