« Kinetic Sculpture in BMW Museum | メイン | Drawing artistic images with minimal code "ContextFree.js & Algorithm Ink" »

A code to obtain Inverse Matrix with "boost"

  はてなブックマークに追加 このエントリを livedoor クリップへ追加

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.

Ads BOARD








最近のエントリーとその関連エントリー

トラックバック

このエントリーのトラックバックURL:
http://kazuhiro.ty.land.to/blog/mt-tb.cgi/681

  Map