Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HRPUTIL_MATRIX_SOLVERS_H_INCLUDED
00012 #define HRPUTIL_MATRIX_SOLVERS_H_INCLUDED
00013
00014 #include "EigenTypes.h"
00015 #include "config.h"
00016
00017 namespace hrp {
00018
00022 HRP_UTIL_EXPORT int solveLinearEquation(const dmatrix &_a, const dvector &_b, dvector &_x, double _sv_ratio=1.0e-3);
00023
00024 HRP_UTIL_EXPORT int solveLinearEquationLU(dmatrix a, const dmatrix &b, dmatrix &out_x);
00025 HRP_UTIL_EXPORT int solveLinearEquationLU(const dmatrix &_a, const dvector &_b, dvector &_x);
00026 HRP_UTIL_EXPORT int solveLinearEquationSVD(const dmatrix &_a, const dvector &_b, dvector &_x, double _sv_ratio=1.0e-3);
00027
00028 HRP_UTIL_EXPORT int calcPseudoInverse(const dmatrix &_a, dmatrix &_a_pseu, double _sv_ratio=1.0e-3);
00029
00030 HRP_UTIL_EXPORT int calcEigenVectors(const dmatrix &_a, dmatrix &_evec, dvector &_eval);
00031 HRP_UTIL_EXPORT int calcSRInverse(const dmatrix& _a, dmatrix &_a_sr, double _sr_ratio, dmatrix _w);
00032 HRP_UTIL_EXPORT double det(const dmatrix &a);
00033
00037 inline dmatrix inverse(const dmatrix& M)
00038 {
00039 const int dim = M.rows();
00040 dmatrix E = dmatrix::Identity(dim,dim);
00041 dmatrix Minv(dim, dim);
00042 solveLinearEquationLU(M, E, Minv);
00043 return Minv;
00044 }
00045
00046 };
00047
00048 #endif