MatrixSolvers.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * National Institute of Advanced Industrial Science and Technology (AIST)
00008  * General Robotix Inc.
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


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:17