LinearAlgebra - Maple Programming Help

Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Eigenvalues : LinearAlgebra/SingularValues

LinearAlgebra

 SingularValues
 compute the singular values of a Matrix

 Calling Sequence SingularValues(A, out, c, t, options, outopts)

Parameters

 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

Description

 • 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·\mathrm{Transpose}\left(A\right)$ (conjugate=false) or $A·\mathrm{HermitianTranspose}\left(A\right)$ (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·\mathrm{SS}·\mathrm{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](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $A≔\mathrm{RandomMatrix}\left(5,3,\mathrm{datatype}=\mathrm{float}\right)$
 ${A}{≔}\left[\begin{array}{ccc}{-55.}& {-58.}& {21.}\\ {-67.}& {-94.}& {-25.}\\ {77.}& {-7.}& {40.}\\ {-70.}& {12.}& {97.}\\ {13.}& {-53.}& {43.}\end{array}\right]$ (1)
 > $\mathrm{SingularValues}\left(A,\mathrm{output}='\mathrm{list}'\right)$
 $\left[{157.836196052456}{,}{117.916483181125}{,}{93.9225117311403}{,}{0.}{,}{0.}\right]$ (2)
 > $B,\mathrm{tauq},\mathrm{taup}≔\mathrm{BidiagonalForm}\left(A,\mathrm{output}='\mathrm{NAG}'\right)$
 ${B}{,}{\mathrm{tauq}}{,}{\mathrm{taup}}{≔}\left[\begin{array}{ccc}{136.058810813560}& {-57.8620842808195}& {-0.172043473372200}\\ {0.350677363240685}& {-108.981299315678}& {1.81950243976625}\\ {-0.403017268201982}& {0.462622084679374}& {-117.888697562649}\\ {0.366379334729074}& {-0.154053631168474}& {0.481271347686089}\\ {-0.0680418764496852}& {0.491902447919747}& {0.282894860406543}\end{array}\right]{,}\left[\begin{array}{c}{1.40423695952603}\\ {1.35160730488081}\\ {1.52479513727331}\\ {0.}\\ {0.}\end{array}\right]{,}\left[\begin{array}{c}{1.94250391079653}\\ {0.}\\ {0.}\\ {0.}\\ {0.}\end{array}\right]$ (3)
 > $S≔\mathrm{SingularValues}\left(\left[B,\mathrm{tauq},\mathrm{taup}\right],\mathrm{outputoptions}\left['S'\right]=\left[\mathrm{readonly}\right]\right)$
 ${S}{≔}\left[\begin{array}{c}{157.836196052456}\\ {117.916483181125}\\ {93.9225117311403}\\ {0.}\\ {0.}\end{array}\right]$ (4)
 > $U,\mathrm{Vt}≔\mathrm{SingularValues}\left(A,\mathrm{output}=\left['U','\mathrm{Vt}'\right]\right):$
 > $U·\mathrm{DiagonalMatrix}\left(S\left[1..3\right],5,3\right)·\mathrm{Vt}$
 $\left[\begin{array}{ccc}{-55.0000000000000}& {-58.0000000000000}& {21.}\\ {-67.0000000000000}& {-94.0000000000000}& {-25.0000000000000}\\ {77.0000000000000}& {-7.00000000000001}& {40.0000000000000}\\ {-70.0000000000000}& {12.0000000000000}& {97.0000000000000}\\ {13.0000000000000}& {-53.0000000000000}& {43.0000000000000}\end{array}\right]$ (5)
 > $A≔\mathrm{Matrix}\left(3,2,\left[\left[1.0,2.0\right],\left[1.0,2.1\right],\left[2.0,4.1\right]\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{1.0}& {2.0}\\ {1.0}& {2.1}\\ {2.0}& {4.1}\end{array}\right]$ (6)
 > $\mathrm{SingularValues}\left(A,\mathrm{output}='U'\right)$
 $\left[\begin{array}{ccc}{-0.400178817531517}& {0.711704700466233}& {-0.577350269189637}\\ {-0.416264941830802}& {-0.702417372271841}& {-0.577350269189615}\\ {-0.816443759362319}& {0.00928732819441857}& {0.577350269189626}\end{array}\right]$ (7)
 > $\mathrm{SingularValues}\left(A,\mathrm{output}='U',\mathrm{thin}\right)$
 $\left[\begin{array}{cc}{-0.400178817531517}& {0.711704700466233}\\ {-0.416264941830802}& {-0.702417372271841}\\ {-0.816443759362319}& {0.00928732819441857}\end{array}\right]$ (8)