30#include "rheolef/config.h"
31#ifdef _RHEOLEF_HAVE_EIGEN
40template<
class T,
class M>
45 using namespace Eigen;
46 Matrix<int,Dynamic,1> nnz_row (a.nrow());
48 for (
size_type i = 0, q = 0, n = a.nrow(); i < n; ++i) {
49 nnz_row[i] = ia[i+1] - ia[i];
51 SparseMatrix<T> a_tmp (a.nrow(),a.ncol());
53 a_tmp.reserve (nnz_row);
55 for (
size_type i = 0, n = a.nrow(); i < n; ++i) {
57 a_tmp.insert (i, (*p).first) = (*p).second;
60 a_tmp.makeCompressed();
61 if (
_a.is_symmetric() &&
_a.is_definite_positive()) {
66 _det.mantissa = (det_a >= 0) ? 1 : -1;
67 _det.exponant = log(fabs(det_a)) / log(
T(10));
83template<
class T,
class M>
87 if (b.dis_size() == 0)
return b;
89 using namespace Eigen;
90 Map<Matrix<T,Dynamic,1> > b_map ((
T*)(b.begin().operator->()), b.size()),
91 x_map ( x.begin().operator->(), x.size());
92 if (
_a.is_symmetric() &&
_a.is_definite_positive()) {
99template<
class T,
class M>
103 if (
_a.is_symmetric())
return solve(b);
104 if (b.dis_size() == 0)
return b;
106 fatal_macro (
"eigen superlu trans_solve: not yet implemented, sorry");
109 _superlu_a.matrixU().transSolveInPlace (x_map);
110 _superlu_a.matrixL().transSolveInPlace (x_map);
121#ifdef _RHEOLEF_HAVE_MPI
see the csr page for the full documentation
const solver_option & option() const
void update_values(const csr< T, M > &a)
base::size_type size_type
Eigen::SparseLU< Eigen::SparseMatrix< T, Eigen::ColMajor >, Eigen::COLAMDOrdering< int > > _superlu_a
vec< T, M > trans_solve(const vec< T, M > &rhs) const
Eigen::SimplicialLDLT< Eigen::SparseMatrix< T, Eigen::ColMajor >, Eigen::Lower, Eigen::AMDOrdering< int > > _ldlt_a
vec< T, M > solve(const vec< T, M > &rhs) const
see the vec page for the full documentation
#define fatal_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
void solve(tiny_matrix< T > &a, tiny_vector< size_t > &piv, const tiny_vector< T > &b, tiny_vector< T > &x)