Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
linearSolvers.hpp
00001 /* $Id: linearSolver.hpp  $ */
00002 
00003 #ifndef LINEAR_SOLVERS_HPP
00004 #define LINEAR_SOLVERS_HPP
00005 
00006 #include "jafarConfig.h"
00007 
00008 #ifdef HAVE_BOOST_SANDBOX
00009 #ifdef HAVE_LAPACK
00010 
00011 #include "jmath/jblas.hpp"
00012 
00013 namespace jafar {
00014   namespace jmath {
00015 
00023     namespace LinearSolvers {
00024       
00036       int solve_QR(jblas::mat_column_major& A, const jblas::mat_column_major& B, jblas::mat_column_major& X);
00037 
00049       int solve_QR_noQ(jblas::mat_column_major A, jblas::mat B, jblas::mat& X);
00050 
00051       /*
00052        * This function returns the solution of Ax=b
00053        *
00054        * The function assumes that A is symmetric & positive definite and employs
00055        * the Cholesky decomposition:
00056        * If A=U^T U with U upper triangular, the system to be solved becomes
00057        * (U^T U) x = b
00058        * This amount to solving U^T y = b for y and then U x = y for x
00059        *
00060        * The function returns 0 in case of error, 1 if successfull
00061        */
00062       int solve_Cholesky(jblas::mat_column_major A, jblas::mat_column_major B, jblas::mat& X);
00063       int solve_Cholesky(jblas::mat_column_major A, jblas::vec B, jblas::vec& x);
00064 
00075       int solve_LU(jblas::mat_column_major A, jblas::vec b, jblas::vec& x);
00076       //int solve_LU(const jblas::mat& A, const jblas::vec& b, jblas::vec& x);
00077 
00078       /*
00079        * This function returns the solution of Ax = b
00080        *
00081        * The function is based on SVD decomposition:
00082        * If A=U D V^T with U, V orthogonal and D diagonal, the linear system becomes
00083        * (U D V^T) x = b or x=V D^{-1} U^T b
00084        * Note that V D^{-1} U^T is the pseudoinverse A^+
00085        *
00086        * The function returns 0 in case of error, 1 if successfull
00087        */
00088       int solve_SVD(const jblas::mat& A, const jblas::vec& b, jblas::vec& x);
00089 
00090       /*
00091        * This function returns the solution of Ax = b for a real symmetric matrix A
00092        *
00093        * The function is based on Bunch-Kaufman factorization:
00094        * A is factored as U*D*U^T where U is upper triangular and
00095        * D symmetric and block diagonal
00096        *
00097        * The function returns 0 in case of error, 1 if successfull
00098        */
00099       int solve_BK(const jblas::mat& A, const jblas::vec& b, jblas::vec& x);
00100     } // namespace LinearSolvers
00101   } // namespace jmath
00102 } // namespace jafar
00103 
00104 
00105 #endif // HAVE_LAPACK
00106 #endif // HAVE_BOOST_SANDBOX
00107 
00108 #endif // JMATH_LINEAR_LEAST_SQUARES_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:21 for Jafar by doxygen 1.7.6.1
LAAS-CNRS