2.1.17.6.2 ocmath_ex_svdcmp


Description

Singular-value decomposition

Syntax

int ocmath_ex_svdcmp( double ** ppMat, int m, int n, double * pW, double ** ppV )

Parameters

ppMat
[modify]On input pointer to a m by n matrix in the standard
"pointer-to-rows" form. On output it receives the matrix U of the
decomposition.
m
[input] number of rows
n
[input] number of columns
pW
[output]pointer to an array of n doubles which will receive diagonal
elements of S
ppV
[output]pointer to a n by n matrix in the standard "pointer-to-rows"
form which will receive the matrix V of the decomposition.

Return

Returns 0 if OK, otherwise return 1.

Examples

EX1

void ocmath_ex_svdcmp_ex1()
{
    double dArray1[3]={2,3,5};
    double dArray2[3]={7,11,13};
    double *dArrayTest1[2];
    int m = 2;
    int n = 3;
    dArrayTest1[0]= dArray1;
    dArrayTest1[1]= dArray2;
    double dArray3[3];
    double dArray4[3];
    double dArray5[3];
    double *dArrayTest2[3];
    dArrayTest2[0]=dArray3;
    dArrayTest2[1]=dArray4;
    dArrayTest2[2]=dArray5;
    vector vW;
    vW.SetSize(n);
    int iRet = ocmath_ex_svdcmp(dArrayTest1, m, n, vW,dArrayTest2);
}

Remark

Singular-value decomposition.

A=U*S*V'

See Also

ocmath_svd, ocmath_svd_complex

Header to Include

origin.h

Reference