int inv const DblNumMat M,
DblNumMat R
 

Definition at line 164 of file vecmatop.cpp.

References NumMat< F >::data(), DGETRF, DGETRI, NumMat< F >::m(), and NumMat< F >::n().

00165 {
00166   //OR pinv(M, 0.0, R);
00167   assert(M.m()==M.n() && R.m()==R.n() && M.m()==R.m());
00168   memcpy(R.data(), M.data(), M.m()*M.n()*sizeof(double));
00169   int info;
00170   int m = M.m();
00171   int* ipiv = new int[m];
00172   DGETRF(&m, &m, R.data(), &m, ipiv, &info); assert(info==0);
00173   int lwork = m;
00174   double* work = new double[lwork];
00175   DGETRI(&m, R.data(), &m, ipiv, work, &lwork, &info);  assert(info==0);
00176   delete [] ipiv;
00177   delete [] work;
00178   return 0;
00179 }


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