svd_matrixT_svd_matrixSvdMatrixSvdMatrixsvd_matrix (算子)

名称

svd_matrixT_svd_matrixSvdMatrixSvdMatrixsvd_matrix — 计算矩阵的奇异值分解。

签名

svd_matrix( : : MatrixID, SVDType, ComputeSingularVectors : MatrixUID, MatrixSID, MatrixVID)

Herror T_svd_matrix(const Htuple MatrixID, const Htuple SVDType, const Htuple ComputeSingularVectors, Htuple* MatrixUID, Htuple* MatrixSID, Htuple* MatrixVID)

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)

static void HOperatorSet.SvdMatrix(HTuple matrixID, HTuple SVDType, HTuple computeSingularVectors, out HTuple matrixUID, out HTuple matrixSID, out HTuple matrixVID)

HMatrix HMatrix.SvdMatrix(string SVDType, string computeSingularVectors, out HMatrix matrixSID, out HMatrix matrixVID)

def svd_matrix(matrix_id: HHandle, svdtype: str, compute_singular_vectors: str) -> Tuple[HHandle, HHandle, HHandle]

描述

算子 svd_matrixsvd_matrixSvdMatrixSvdMatrixSvdMatrixsvd_matrix computes a full or reduced singular value decomposition (SVD) of the Matrix defined by the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixIDmatrix_id. The operator returns the matrix handle MatrixSIDMatrixSIDMatrixSIDMatrixSIDmatrixSIDmatrix_sid of the matrix MatrixS with singular values in descending order. Optionally, the matrices MatrixU with the left and MatrixV with the right singular vectors are computed and the matrix handles MatrixUIDMatrixUIDMatrixUIDMatrixUIDmatrixUIDmatrix_uid and MatrixVIDMatrixVIDMatrixVIDMatrixVIDmatrixVIDmatrix_vid are returned. Access to the elements of the matrices is possible e.g., with the operator get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrixget_full_matrix。The SVD is written

For SVDTypeSVDTypeSVDTypeSVDTypeSVDTypesvdtype = 'full'"full""full""full""full""full", a full SVD is computed.

示例:

SVDTypeSVDTypeSVDTypeSVDTypeSVDTypesvdtype = 'full'"full""full""full""full""full", ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors = 'both'"both""both""both""both""both"

For SVDTypeSVDTypeSVDTypeSVDTypeSVDTypesvdtype = 'reduced'"reduced""reduced""reduced""reduced""reduced", a reduced SVD is computed.

示例:

SVDTypeSVDTypeSVDTypeSVDTypeSVDTypesvdtype = 'reduced'"reduced""reduced""reduced""reduced""reduced", ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors = 'both'"both""both""both""both""both"

For ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors = 'left'"left""left""left""left""left", the matrix MatrixU with the left singular vectors is computed. For ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors = 'right'"right""right""right""right""right", the matrix MatrixV with the right singular vectors is computed. For ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors = 'both'"both""both""both""both""both", the matrices MatrixU and MatrixV with the left and right singular vectors are computed.

For ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors = 'none'"none""none""none""none""none", no matrices with the singular vectors are computed. The matrix MatrixS is a matrix with n rows and one column, where the number n = min(number of rows of the input Matrix, number of columns of the input Matrix).

示例:

SVDTypeSVDTypeSVDTypeSVDTypeSVDTypesvdtype = 'reduced'"reduced""reduced""reduced""reduced""reduced" or 'full'"full""full""full""full""full", ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors = 'none'"none""none""none""none""none"

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.

执行信息

参数

MatrixIDMatrixIDMatrixIDMatrixIDmatrixIDmatrix_id (输入控制)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

输入矩阵的矩阵句柄。

SVDTypeSVDTypeSVDTypeSVDTypeSVDTypesvdtype (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of computation.

默认值: 'full' "full" "full" "full" "full" "full"

值列表: 'full'"full""full""full""full""full", 'reduced'"reduced""reduced""reduced""reduced""reduced"

ComputeSingularVectorsComputeSingularVectorsComputeSingularVectorsComputeSingularVectorscomputeSingularVectorscompute_singular_vectors (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Computation of singular values.

默认值: 'both' "both" "both" "both" "both" "both"

值列表: 'both'"both""both""both""both""both", 'left'"left""left""left""left""left", 'none'"none""none""none""none""none", 'right'"right""right""right""right""right"

MatrixUIDMatrixUIDMatrixUIDMatrixUIDmatrixUIDmatrix_uid (输出控制)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle with the left singular vectors.

MatrixSIDMatrixSIDMatrixSIDMatrixSIDmatrixSIDmatrix_sid (输出控制)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle with singular values.

MatrixVIDMatrixVIDMatrixVIDMatrixVIDmatrixVIDmatrix_vid (输出控制)  matrix HMatrix, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Matrix handle with the right singular vectors.

结果

如果参数有效,算子 svd_matrixsvd_matrixSvdMatrixSvdMatrixSvdMatrixsvd_matrix 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

可能的前趋

create_matrixcreate_matrixCreateMatrixCreateMatrixCreateMatrixcreate_matrix

可能的后继

get_full_matrixget_full_matrixGetFullMatrixGetFullMatrixGetFullMatrixget_full_matrix, get_value_matrixget_value_matrixGetValueMatrixGetValueMatrixGetValueMatrixget_value_matrix

参考文献

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.

模块

基础