2.1.17.6.9 ocmath_svd_complex
Description
Singular-value decomposition for matrix of complex.
A=U*S*V', A is m by n, U is m by m, S is a vector to store diagnal elements of matrix of size min(m,n),V is n by n, it's the same as Matlab. This is an OriginPro only function.
Syntax
int ocmath_svd_complex( int m, int n, d_complex * pSource, d_complex * pU, double * pS, d_complex * pV )
Parameters
- m
- [input] row number of matrix A
- n
- [input] column number of matrix A
- pSource
- [input] pointer to the original matrix A
- pU
- [output] pointer to matrix U, of size m by m
- pS
- [output] pointer to the singular-value vector, of size min(m,n)
- pV
- [output] pointer to matrix V, of size n by n
Return
= OE_NOERROR: success
= OE_INVALID_SIZE: m < 1 or n < 1
= OE_NULL_POINTER: pointers pSource, pU, pS or pV is NULL
= NE_CONVERGENCE: <value> off-diagonals did not converge. The arrays d and e contain the diagonal and off-diagonal elements, respectively, of a bidiagonal matrix orthogonally equivalent to B.
= NE_ALLOC_FAIL: Memory allocation failed.
= NE_BAD_PARAM: On entry, parameter hvaluei had an illegal value.
= NE_INTERNAL_ERROR: An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
Examples
EX1
void ocmath_svd_complex_ex1()
{
matrix<complex> matSource={
{2+3i,5+7i,11+13i},
{17+19i,23+29i,31+37i}
};
matrix<complex> matU;
matrix matS;
matrix<complex> matV;
int nNumCols = matSource.GetNumCols();
int nNumRows = matSource.GetNumRows();
int nMinSize = nNumCols > nNumRows ? nNumRows : nNumCols;
matU.SetSize(nNumRows, nNumRows);
matS.SetSize(nMinSize, nMinSize);
matV.SetSize(nNumCols, nNumCols);
vector vecS;
vecS.SetSize(nMinSize);
ocmath_svd_complex(nNumRows, nNumCols, matSource, matU, vecS, matV);
matS.SetDiagonal(vecS, 0);
}
Remark
See Also
Header to Include
origin.h
Reference
nag_zgebrd(f08ksc)nag_zgebrd(f08ksc), nag_zungbr(f08ktc)nag_zgebrd(f08ksc)nag_zgebrd(f08ksc), nag_zungbr(f08ktc), nag_zbdsqr(f08msc)nag_zgebrd(f08ksc)nag_zgebrd(f08ksc), nag_zungbr(f08ktc)nag_zgebrd(f08ksc)nag_zgebrd(f08ksc), nag_zungbr(f08ktc), nag_zbdsqr(f08msc), Nag Manual
|