indii/ml/aux/matrix.cpp

00001 //#if defined(__GNUC__) && defined(GCC_PCH)
00002 //  #include "aux.hpp"
00003 //#else
00004   #include "matrix.hpp"
00005   #include "vector.hpp"
00006 //#endif
00007 
00008 #include "boost/numeric/ublas/vector_proxy.hpp"
00009 #include "boost/numeric/bindings/traits/ublas_vector.hpp"
00010 #include "boost/numeric/bindings/traits/ublas_matrix.hpp"
00011 #include "boost/numeric/bindings/lapack/lapack.hpp"
00012 
00013 namespace lapack = boost::numeric::bindings::lapack;
00014 
00015 using namespace indii::ml::aux;
00016 
00017 void indii::ml::aux::inv(matrix& A, matrix& AI) {
00018   /* pre-condition */
00019   assert (A.size1() == A.size2());
00020   assert (AI.size1() == A.size1());
00021   assert (AI.size2() == A.size2());
00022 
00023   const unsigned int N = A.size1();
00024   const identity_matrix I(N);
00025 
00026   AI = I;
00027   #ifndef NDEBUG
00028   int ierr = lapack::gesv(A, AI);
00029   assert (ierr == 0);
00030   #else
00031   lapack::gesv(A, AI);
00032   #endif
00033 }
00034 

Generated on Wed Dec 17 15:11:57 2008 for dysii Dynamical Systems Library by  doxygen 1.5.3