00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef MTL_MATRIX_SOLVE_INCLUDE
00013 #define MTL_MATRIX_SOLVE_INCLUDE
00014
00015 #include <boost/numeric/mtl/utility/tag.hpp>
00016 #include <boost/numeric/mtl/utility/category.hpp>
00017 #include <boost/numeric/mtl/concept/collection.hpp>
00018 #include <boost/numeric/mtl/operation/lu.hpp>
00019 #include <boost/numeric/mtl/interface/umfpack_solve.hpp>
00020
00021
00022 namespace mtl { namespace matrix {
00023
00024 namespace detail {
00025
00026 template <typename Matrix, typename Vector>
00027 Vector inline solve(const Matrix& A, const Vector& b, tag::dense)
00028 {
00029 return lu_solve(A, b);
00030 }
00031
00032 # ifdef MTL_HAS_UMFPACK
00033 template <typename Value, typename Parameters, typename Vector>
00034 Vector inline solve(const Matrix& A, const Vector& b, tag::compressed2D)
00035 {
00036 Vector x(num_cols(A));
00037 umfpack_solve(A, x, b);
00038 return x;
00039 }
00040 # endif
00041 }
00042
00043
00044 template <typename Matrix, typename Vector>
00045 Vector inline solve(const Matrix& A, const Vector& b)
00046 {
00047 return detail::solve(A, b, typename category<Coll>::type());
00048 }
00049
00050 }}
00051
00052 #endif // MTL_MATRIX_SOLVE_INCLUDE