svd_matrix T_svd_matrix SvdMatrix SvdMatrix (Operator)
Name
svd_matrix T_svd_matrix SvdMatrix SvdMatrix
— Compute the singular value decomposition of a matrix.
Signature
void SvdMatrix (const HTuple& MatrixID , const HTuple& SVDType , const HTuple& ComputeSingularVectors , HTuple* MatrixUID , HTuple* MatrixSID , HTuple* MatrixVID )
HMatrix HMatrix ::SvdMatrix (const HString& SVDType , const HString& ComputeSingularVectors , HMatrix* MatrixSID , HMatrix* MatrixVID ) const
HMatrix HMatrix ::SvdMatrix (const char* SVDType , const char* ComputeSingularVectors , HMatrix* MatrixSID , HMatrix* MatrixVID ) const
HMatrix HMatrix ::SvdMatrix (const wchar_t* SVDType , const wchar_t* ComputeSingularVectors , HMatrix* MatrixSID , HMatrix* MatrixVID ) const
(Windows only)
Description
The operator svd_matrix svd_matrix SvdMatrix SvdMatrix SvdMatrix
computes a full or reduced singular
value decomposition (SVD) of the Matrix Matrix Matrix Matrix matrix
defined by the
matrix handle MatrixID MatrixID MatrixID MatrixID matrixID
. The operator returns the matrix
handle MatrixSID MatrixSID MatrixSID MatrixSID matrixSID
of the matrix MatrixS MatrixS MatrixS MatrixS matrixS
with
singular values in descending order.
Optionally, the matrices MatrixU MatrixU MatrixU MatrixU matrixU
with the left and
MatrixV MatrixV MatrixV MatrixV matrixV
with the right singular vectors are computed and
the matrix handles MatrixUID MatrixUID MatrixUID MatrixUID matrixUID
and MatrixVID MatrixVID MatrixVID MatrixVID matrixVID
are
returned. Access to the elements of the matrices is possible e.g.
with the operator get_full_matrix get_full_matrix GetFullMatrix GetFullMatrix GetFullMatrix
. The SVD is written
For SVDType SVDType SVDType SVDType SVDType
= 'full' "full" "full" "full" "full" , a full SVD is computed.
Example:
For SVDType SVDType SVDType SVDType SVDType
= 'reduced' "reduced" "reduced" "reduced" "reduced" , a reduced SVD is
computed.
Example:
For ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors computeSingularVectors
= 'left' "left" "left" "left" "left" , the matrix
MatrixU MatrixU MatrixU MatrixU matrixU
with the left singular vectors is computed. For
ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors computeSingularVectors
= 'right' "right" "right" "right" "right" , the matrix
MatrixV MatrixV MatrixV MatrixV matrixV
with the right singular vectors is computed. For
ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors computeSingularVectors
= 'both' "both" "both" "both" "both" , the matrices
MatrixU MatrixU MatrixU MatrixU matrixU
and MatrixV MatrixV MatrixV MatrixV matrixV
with the left and right
singular vectors are computed.
For ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors computeSingularVectors
= 'none' "none" "none" "none" "none" , no matrices
with the singular vectors are computed. The matrix
MatrixS MatrixS MatrixS MatrixS matrixS
is a matrix with n rows and one column, where
the number n = min(number of rows of the input Matrix Matrix Matrix Matrix matrix
,
number of columns of the input Matrix Matrix Matrix Matrix matrix
).
Example:
It should be noted that in the examples there are differences in the
meaning of the values of the output matrices: If a value is shown as
an integer number, e.g., 0 or 1, the value of this element is per
definition this certain value. If the number is shown as a floating
point number, e.g., 0.0 or 1.0, the value is computed by the
operator.
Execution Information
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Processed without parallelization.
Parameters
MatrixID MatrixID MatrixID MatrixID matrixID
(input_control) matrix →
HMatrix , HTuple HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Matrix handle of the input matrix.
SVDType SVDType SVDType SVDType SVDType
(input_control) string →
HTuple HTuple Htuple (string) (string ) (HString ) (char* )
Type of computation.
Default value:
'full'
"full"
"full"
"full"
"full"
List of values: 'full' "full" "full" "full" "full" , 'reduced' "reduced" "reduced" "reduced" "reduced"
ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors ComputeSingularVectors computeSingularVectors
(input_control) string →
HTuple HTuple Htuple (string) (string ) (HString ) (char* )
Computation of singular values.
Default value:
'both'
"both"
"both"
"both"
"both"
List of values: 'both' "both" "both" "both" "both" , 'left' "left" "left" "left" "left" , 'none' "none" "none" "none" "none" , 'right' "right" "right" "right" "right"
MatrixUID MatrixUID MatrixUID MatrixUID matrixUID
(output_control) matrix →
HMatrix , HTuple HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Matrix handle with the left singular vectors.
MatrixSID MatrixSID MatrixSID MatrixSID matrixSID
(output_control) matrix →
HMatrix , HTuple HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Matrix handle with singular values.
MatrixVID MatrixVID MatrixVID MatrixVID matrixVID
(output_control) matrix →
HMatrix , HTuple HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Matrix handle with the right singular vectors.
Result
If the parameters are valid, the operator svd_matrix svd_matrix SvdMatrix SvdMatrix SvdMatrix
returns
the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
Possible Predecessors
create_matrix create_matrix CreateMatrix CreateMatrix CreateMatrix
Possible Successors
get_full_matrix get_full_matrix GetFullMatrix GetFullMatrix GetFullMatrix
,
get_value_matrix get_value_matrix GetValueMatrix GetValueMatrix GetValueMatrix
References
David Poole: “Linear Algebra: A Modern Introduction”; Thomson;
Belmont; 2006.
Gene H. Golub, Charles F. van Loan: “Matrix Computations”; The
Johns Hopkins University Press; Baltimore and London; 1996.
Module
Foundation