A code to obtain Inverse Matrix with "boost"
Suppose to obtain inverse matrix of "matrix", where "matrix" is an object of boost::numeric::ublas::matrix<double>.
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/lu.hpp>
using namespace boost::numeric::ublas;
permutation_matrix<> pm(matrix.size1());
matrix<double> copiedMatrix = matrix<double>(matrix);
lu_factorize(copiedMatrix,pm);
matrix<double> inverseMatrix(identity_matrix<double>(copiedMatrix.size1()));
lu_substitute(copiedMatrix,pm,inverseMatrix);
The "inverseMatrix" object includes components of the inverse matrix.