Previous Page Next Page Contents

numeric::singularvectors -- numerical singular value decomposition of a matrix

Introduction

numeric::singularvectors(A, ..) returns numerical singular values and singular vectors of the matrix A.

Call(s)

numeric::singularvectors(A <, NoLeftVectors> <, NoRightVectors> <, NoErrors>)

Parameters

A - a numerical matrix of domain type DOM_ARRAY or of category Cat::Matrix

Options

NoLeftVectors - suppresses the computation of left singular vectors
NoRightVectors - suppresses the computation of right singular vectors
NoErrors - suppresses the computation of error estimates

Returns

a list [U,d,V,resU,resV]. U is a unitary square float matrix of domain type DOM_ARRAY, whose columns are left singular vectors. d is a list of singular float values. V is a unitary square float matrix of domain type DOM_ARRAY, whose columns are right singular vectors. The lists of float residues resU and resV provide error estimates for the numerical data.

Side Effects

The function is sensitive to the environment variable DIGITS, which determines the numerical working precision.

Related Functions

linalg::eigenvalues, linalg::eigenvectors, numeric::eigenvalues, numeric::eigenvectors, numeric::singularvalues, numeric::spectralradius

Details

Option: NoLeftVectors

Option: NoRightVectors

Option: NoErrors

Example 1

Numerical expressions are converted to floats:

>> DIGITS := 5:
>> A :=array(1..3, 1..2, [[1, PI], [2, 3], [3, exp(sqrt(2))]]):
>> [U, d, V, resU, resV] := numeric::singularvectors(A):

The singular data are:

>> U, d, V
      +-                             -+
      |  -0.88078, 0.45729,  0.12293  |
      |                               |
      |   0.14947, 0.51483, -0.84417  |, [0.89905, 6.9986],
      |                               |
      |   0.44932, 0.72515,  0.5218   |
      +-                             -+
      
         +-                   -+
         |   0.85215,  0.5233  |
         |                     |
         |  -0.52331, 0.85215  |
         +-                   -+

The residues indicate that these results are not severely affected by round-off within the working precision of 5 digits:

>> resU, resV
        [2.0954e-9, 2.9802e-8, 1.7347e-18], [3.4925e-9, 7.4506e-8]
>> delete DIGITS, A, U, d, V, resU, resV:

Example 2

We demonstrate how to reconstruct a matrix from its singular data:

>> DIGITS := 3: A := array(1..2, 1..3, [[1.0, I, PI], [2, 3, I]]):
>> [U, d, V, resU, resV] := numeric::singularvectors(A, NoErrors):

For convenience, the matrix domain Dom::Matrix() is used to process the matrices:

>> M := Dom::Matrix(): U := M(U)
                 +-                                     -+
                 |  - 0.789 + 0.336 I, 0.511 + 0.0665 I  |
                 |                                       |
                 |   0.487 - 0.168 I,    0.84 + 0.17 I   |
                 +-                                     -+

A ``diagonal'' matrix is built from the singular values:

>> DD := M(2, 3, d, Diagonal)
                            +-              -+
                            |  3.27,  0,  0  |
                            |                |
                            |    0,  3.9, 0  |
                            +-              -+
>> V := M(V)
        +-                                                      -+
        |       0.0568,      0.562 + 0.104 I, - 0.681 - 0.454 I  |
        |                                                        |
        |   0.55 + 0.0871 I,      0.663,       0.454 + 0.208 I   |
        |                                                        |
        |  - 0.81 + 0.174 I, 0.455 - 0.162 I,       0.283        |
        +-                                                      -+

We use the methods conjugate and transpose of the matrix domain to compute the Hermitean transpose of V and reconstruct A up to numerical round-off:

>> VH := M::conjugate(M::transpose(V)):
>> U*DD*VH 
        +-                                                       -+
        |  1.0 + 2.62e-10 I,       1.0 I,      3.14 + 4.66e-10 I  |
        |                                                         |
        |  2.0 + 5.02e-10 I, 3.0 - 1.16e-10 I, - 3.73e-9 + 1.0 I  |
        +-                                                       -+
>> delete DIGITS, A, U, d, V, resU, resV, M, DD, VH:

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000