Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

template<class ArrayT>
int Impala::Core::Matrix::MatSVD ( ArrayT *  a,
ArrayT *&  u,
ArrayT *&  s,
ArrayT *&  v 
) [inline]

Singular Value Decomposition Using TNT Library.

For further information about TNT library and JAMA solvers suplied with it, please take a look at : http://math.nist.gov/tnt/

The current implementation of SVD in JAMA makes the following decomposition, returning the first min(m,n) left and right singular vectors in U and V.

A = U * S * V'

A: m x n U: m x n S: n x n V: n x n

Definition at line 43 of file MatSVD.h.

Referenced by MatPInv().

00044 {
00045     int rows = a->H();
00046     int cols = a->W();
00047 
00048     //TNT Array Initialization
00049     Array2D<Real64> A(rows,cols,a->PB());
00050     Array2D<Real64> U(0,0);
00051     Array2D<Real64> S(0,0);
00052     Array2D<Real64> V(0,0);
00053     
00054     JAMA::SVD<Real64> svd(A);
00055 
00056     svd.getU(U);
00057     u=MatCreate<Mat>(U.dim1(),U.dim2());
00058     for(int i=0;i<U.dim1();i++)
00059         for(int j=0;j<U.dim2();j++)
00060             u->SetValue(U[i][j],j,i);
00061     
00062     svd.getV(V);
00063     v=MatCreate<Mat>(V.dim2(),V.dim1());
00064     for(int i=0;i<V.dim1();i++)
00065         for(int j=0;j<V.dim2();j++)
00066             v->SetValue(V[i][j],j,i);
00067     
00068     svd.getS(S);
00069     s=MatCreate<Mat>(S.dim1(),S.dim2());
00070     for(int i=0;i<S.dim1();i++)
00071         for(int j=0;j<S.dim2();j++)
00072             s->SetValue(S[i][j],j,i);
00073 
00074     return svd.rank();
00075 
00076 }


Generated on Fri Mar 19 11:16:15 2010 for ImpalaSrc by  doxygen 1.5.1