int SVDRep::dgemv double  alpha,
double *  X,
double  beta,
double *  Y,
double  tol = 0.0
 

Perform the operation:

y = alpha*M*X + beta*Y where M is the original matrix from the SVDRep.

Using the SVD representation, this dgemv operation is performed more quickly. This also uses the Blas DGEMV opaeration seen in blas.h

Definition at line 93 of file svdrep.cpp.

References _matS, _matU, _matVT, NumMat< F >::data(), DGEMV, NumMat< F >::m(), NumVec< F >::m(), and NumMat< F >::n().

00094 {
00095   int K = 1; //prevent matrix of zero size
00096   while(K<_matS.m() && _matS(K)>=tol) 
00097          K++;
00098   //buf = VT(1:K,:) * X
00099   //double* buf = _wsbuf;
00100   double* buf = new double[K];
00101   {
00102          char TRANS = 'N';
00103          int M = _matVT.m();
00104          int N = _matVT.n();
00105          double ALPHA = 1.0;
00106          double BETA = 0.0;
00107          int INC = 1;
00108          DGEMV(&TRANS, &K, &N, &ALPHA, _matVT.data(), &M, X, &INC, &BETA, buf, &INC); //first K rows
00109   }
00110   // buf = S(1:K) .* buf;
00111   for(int i=0; i<K; i++)
00112          buf[i] = buf[i] * _matS(i);
00113   // y = U(:,1:K) * buf
00114   {
00115          char TRANS = 'N';
00116          int M = _matU.m(); //int N = _matU.n();
00117          double ALPHA = alpha;
00118          double BETA = beta;
00119          int INC = 1;
00120          DGEMV(&TRANS, &M, &K, &ALPHA, _matU.data(), &M, buf, &INC, &BETA, Y, &INC);    
00121   }
00122   delete [] buf;
00123   
00124   return 0;
00125 }


Generated on Sun Dec 4 18:13:14 2005 for common by  doxygen 1.4.5