Last Modified: December 18, 2017

Computes the angle between column spaces of two matrices.

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

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.

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.

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.

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.

**Default: **No error

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

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

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

Let *U*_{1}*S*_{1}*V*_{1}^{T} and *U*_{2}*S*_{2}*V*_{2}^{T} 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**.

$\text{angle}=\mathrm{arccos}\left(s\right)$

where *s* is the minimum singular value of *U*_{1}^{T}*U*_{2}.

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

$\text{angle}=\mathrm{arccos}\left(\frac{{a}^{T}b}{\Vert a\Vert \Vert b\Vert}\right)$

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

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