singularValues

Return singular values and left and right singular vectors

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

         sigma = Matrices.singularValues(A);
(sigma, U, VT) = Matrices.singularValues(A);

Description

This function computes the singular values and optionally the singular vectors of matrix A. Basically the singular value decomposition of A is computed, i.e.,

A = U Σ VT
  = U*Sigma*VT

where U and V are orthogonal matrices (UUT=I, VVT=I). Σ = [diagonal(σi), zeros(n,m-n)], if n=size(A,1) ≤ m=size(A,2)) or [diagonal(σi); zeros(n-m,m)], if n > m=size(A,2)). Σ has the same size as matrix A with nonnegative diagonal elements in decreasing order and with all other elements zero (σ1 is the largest element). The function returns the singular values σi in vector sigma and the orthogonal matrices in matrices U and VT.

Example

A = [1, 2,  3,  4;
     3, 4,  5, -2;
    -1, 2, -3,  5];
(sigma, U, VT) = singularValues(A);
results in:
   sigma = {8.33, 6.94, 2.31};
i.e.
   Sigma = [8.33,    0,    0, 0;
               0, 6.94,    0, 0;
               0,    0, 2.31, 0]

See also

Matrices.eigenValues

Syntax

(sigma, U, VT) = singularValues(A)

Inputs (1)

A

Type: Real[:,:]

Description: Matrix

Outputs (3)

sigma

Type: Real[min(size(A, 1), size(A, 2))]

Description: Singular values

U

Default Value: identity(size(A, 1))

Type: Real[size(A, 1),size(A, 1)]

Description: Left orthogonal matrix

VT

Default Value: identity(size(A, 2))

Type: Real[size(A, 2),size(A, 2)]

Description: Transposed right orthogonal matrix