LinearAlgebra
SingularValues
compute the singular values of a Matrix
Calling Sequence
Parameters
Description
Examples
SingularValues(A, out, c, t, options, outopts)
A
-
Matrix, list; Matrix whose singular values are required
out
(optional) equation of the form output = obj where obj is one of 'U', 'S', 'Vt', or 'list', or a list containing one or more of these names; selects result objects to compute
c
(optional) equation of the form conjugate=true or false; specifies whether to use the Hermitian transpose in the case of non-floating-point data
t
(optional) equation of the form thin=true or false; specifies whether the number of left or right singular vectors computed is at most the minimum of the row and column dimensions of Matrix A.
options
(optional) constructor options for the result object(s)
outopts
(optional) equation(s) of the form outputoptions[o]=list where o is one of 'U', 'S', or 'Vt'; constructor options for the specified result object
The SingularValues(A) function returns the singular values of Matrix A in a column Vector.
The singular values are equal to the square roots of the (real) eigenvalues of A·Transpose⁡A (when conjugate=false) or A·HermitianTranspose⁡A (when conjugate=true, the default). Since this product is either real-symmetric or Hermitian, and positive semi-definite, the eigenvalues are all real and non-negative, and so their square roots are also purely real.
Computation of the left and right singular Vectors (as columns of Matrices) may only be requested for a Matrix A whose entries can be evaluated to purely floating-point values.
The singular values S together with the left singular Vectors as columns of Matrix U and the right singular Vectors as rows of Matrix Vt satisfy U·SS·Vt=A. Matrix SS has the entries of S along its main diagonal.
If the thin option is not supplied or is given as thin=false and if Matrix A has dimensions n x p then Matrix U has dimensions n x n, Matrix Vt has dimensions p x p, and Matrix SS has dimensions n x p.
If the thin option is given as thin or thin=true and if k is the minimum of n and p the dimensions of A then Matrix U has dimensions n x k and Matrix Vt has dimensions k x p.
For non-floating-point Matrices, in the case that the left and right singular Vectors are not requested, the singular values are returned in indexed RootOf form (as opposed to explicit radicals).
If A is a list, then the elements of the list are taken as the Matrix factors of the Matrix A, due to some prefactorization. These factors are interpreted, uniquely, as follows:
A list of Matrix, Vector[column], Vector[column] items, [B,tauq,taup], is interpreted as the result of calling BidiagonalForm with the output='NAG' option.
The output option (out) determines the content of the returned expression sequence.
Depending on what is included in the output option, an expression sequence containing one or more of the items U (the left singular vectors), S (the singular values), or Vt (the right singular vectors) can be returned. If out is given as output=[...], that is, providing a list of objects to return, the objects are returned in the same order as specified in the list. If the list output object is specified, the singular values are returned as a list. This output object cannot be specified with any other output object(s).
The options option provides additional information (readonly, shape, storage, order, datatype, and attributes) to the Vector constructor that builds the result. These options may also be provided in the form outputoptions[o]=[...], where [...] represents a Maple list. If a constructor option is provided in both the calling sequence directly and in an outputoptions[o] option, the latter takes precedence (regardless of the order).
The following list indicates permissible values for index [o] of outputoptions with their corresponding meaning.
U
left singular vectors
S
singular values
Vt
right singular vectors
This function is part of the LinearAlgebra package, and so it can be used in the form SingularValues(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[SingularValues](..).
with⁡LinearAlgebra:
A≔RandomMatrix⁡5,3,datatype=float
A≔−55.−58.21.−67.−94.−25.77.−7.40.−70.12.97.13.−53.43.
SingularValues⁡A,output=list
157.836196052456,117.916483181125,93.9225117311403,0.,0.
B,tauq,taup≔BidiagonalForm⁡A,output=NAG
B,tauq,taup≔136.058810813560−57.8620842808195−0.1720434733722000.350677363240685−108.9812993156781.81950243976622−0.4030172682019820.462622084679374−117.8886975626490.366379334729074−0.1540536311684740.481271347686089−0.06804187644968520.4919024479197470.282894860406543,1.404236959526031.351607304880811.524795137273310.0.,1.942503910796530.0.0.0.
S≔SingularValues⁡B,tauq,taup,outputoptionsS=readonly
S≔157.836196052456117.91648318112593.92251173114030.0.
U,Vt≔SingularValues⁡A,output=U,Vt:
U·DiagonalMatrix⁡S1..3,5,3·Vt
−55.0000000000000−58.000000000000021.0000000000000−67.0000000000000−94.0000000000000−25.000000000000077.0000000000000−6.9999999999999940.0000000000000−70.12.000000000000097.000000000000113.0000000000000−53.000000000000043.0000000000000
A≔Matrix⁡3,2,1.0,2.0,1.0,2.1,2.0,4.1
A≔1.02.01.02.12.04.1
SingularValues⁡A,output=U
0.4001788175315170.711704700466233−0.5773502691896360.416264941830802−0.702417372271841−0.5773502691896150.8164437593623190.009287328194418500.577350269189626
SingularValues⁡A,output=U,thin
0.4001788175315170.7117047004662330.416264941830802−0.7024173722718410.8164437593623190.00928732819441850
See Also
LinearAlgebra[Eigenvalues]
Matrix
RootOf
Vector
Download Help Document