f08kb computes the singular value decomposition (SVD) of a real by matrix , optionally computing the left and/or right singular vectors.
Syntax
C# |
---|
public static void f08kb( string jobu, string jobvt, int m, int n, double[,] a, double[] s, double[,] u, double[,] vt, out int info ) |
Visual Basic |
---|
Public Shared Sub f08kb ( _ jobu As String, _ jobvt As String, _ m As Integer, _ n As Integer, _ a As Double(,), _ s As Double(), _ u As Double(,), _ vt As Double(,), _ <OutAttribute> ByRef info As Integer _ ) |
Visual C++ |
---|
public: static void f08kb( String^ jobu, String^ jobvt, int m, int n, array<double,2>^ a, array<double>^ s, array<double,2>^ u, array<double,2>^ vt, [OutAttribute] int% info ) |
F# |
---|
static member f08kb : jobu : string * jobvt : string * m : int * n : int * a : float[,] * s : float[] * u : float[,] * vt : float[,] * info : int byref -> unit |
Parameters
- jobu
- Type: System..::..StringOn entry: specifies options for computing all or part of the matrix .Constraint: , , or .
- jobvt
- Type: System..::..StringOn entry: specifies options for computing all or part of the matrix .
- m
- Type: System..::..Int32On entry: , the number of rows of the matrix .Constraint: .
- n
- Type: System..::..Int32On entry: , the number of columns of the matrix .Constraint: .
- a
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, dim2]Note: dim1 must satisfy the constraint:Note: the second dimension of the array a must be at least .On entry: the by matrix .
- s
- Type: array<System..::..Double>[]()[][]An array of size [dim1]Note: the dimension of the array s must be at least .On exit: the singular values of , sorted so that .
- u
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, dim2]Note: dim1 must satisfy the constraint:
- if or , ;
- otherwise .
- if , ;
- if , ;
- otherwise .
Note: the second dimension of the array u must be at least if , if , and at least otherwise.
- vt
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, dim2]Note: dim1 must satisfy the constraint:
- if , ;
- if , ;
- otherwise .
Note: the second dimension of the array vt must be at least if , if , and at least otherwise.
- info
- Type: System..::..Int32%On exit: unless the method detects an error (see [Error Indicators and Warnings]).
Description
The SVD is written as
where is an by matrix which is zero except for its diagonal elements, is an by orthogonal matrix, and is an by orthogonal matrix. The diagonal elements of are the singular values of ; they are real and non-negative, and are returned in descending order. The first columns of and are the left and right singular vectors of .
Note that the method returns , not .
References
Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Error Indicators and Warnings
Some error messages may refer to parameters that are dropped from this interface
(LDA, LDU, LDVT) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
- If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
Accuracy
The computed singular value decomposition is nearly the exact singular value decomposition for a nearby matrix , where
and is the machine precision. In addition, the computed singular vectors are nearly orthogonal to working precision. See Section 4.9 of Anderson et al. (1999) for further details.
Parallelism and Performance
None.
Further Comments
The total number of floating-point operations is approximately proportional to when and otherwise.
The singular values are returned in descending order.
The complex analogue of this method is f08kp.
Example
This example finds the singular values and left and right singular vectors of the by matrix
together with approximate error bounds for the computed singular values and vectors.
Example program (C#): f08kbe.cs