33 #ifndef __H__LIB_ALGEBRA__LAPACK_ANALYZING_SOLVER__
34 #define __H__LIB_ALGEBRA__LAPACK_ANALYZING_SOLVER__
36 #include "../interface/linear_operator_inverse.h"
37 #include "../interface/matrix_operator.h"
46 template <
typename M,
typename X,
typename Y = X>
61 virtual bool apply(Y& u,
const X& f)
92 UG_LOG(
"ANALYZING SOLVER:\n");
93 UG_LOG(
" Matrix is of dimension " << A.num_rows() <<
"\n");
94 if(A.num_rows() != A.num_cols())
95 {
UG_LOG(
" Matrix is not quadratic???\n"); }
97 {
UG_LOG(
" Submatrices are DOUBLE.\n")}
99 {
UG_LOG(
" Submatrices are Matrices of size " <<
GetRows(A(0,0)) <<
" x " <<
GetCols(A(0,0)) <<
"\n");}
110 size_t m_size = A.num_rows() * nrOfRows;
113 mat.resize_and_clear(m_size, m_size);
115 for(
size_t r=0; r<A.num_rows(); r++)
116 for(
typename matrix_type::const_row_iterator it = A.begin_row(r); it != A.end_row(r); ++it)
118 size_t rr = r*nrOfRows;
119 size_t cc = it.index()*nrOfRows;
120 for(
size_t r2=0; r2<nrOfRows; r2++)
121 for(
size_t c2=0; c2<nrOfRows; c2++)
123 if(
BlockRef(it.value(), r2, c2) != 0.0)
124 mat(rr + r2, cc + c2) =
BlockRef(it.value(), r2, c2);
146 A.template cast_dynamic<MatrixOperator<M,Y,X> >();
150 UG_THROW(
"IMatrixOperatorInverse::init:"
151 " Passed operator is not matrix-based.");
Definition: smart_pointer.h:108
bool invalid() const
returns true if the pointer is invalid, false if not.
Definition: smart_pointer.h:212
Definition: analyzing_solver.h:49
virtual ~AnalyzingSolver()
virtual destructor
Definition: analyzing_solver.h:77
AnalyzingSolver(SmartPtr< ILinearOperatorInverse< X, Y > > pLinearOperatorInverse)
Definition: analyzing_solver.h:71
virtual std::string config_string() const
returns information about configuration parameters
Definition: analyzing_solver.h:158
virtual bool init(SmartPtr< ILinearOperator< Y, X > > A)
Definition: analyzing_solver.h:136
virtual bool supports_parallel() const
returns if parallel solving is supported
Definition: analyzing_solver.h:80
virtual bool init(SmartPtr< ILinearOperator< Y, X > > A, const Y &u)
Definition: analyzing_solver.h:130
virtual bool apply_return_defect(Y &u, X &f)
Definition: analyzing_solver.h:66
virtual const char * name() const
returns the name of the operator inverse
Definition: analyzing_solver.h:156
virtual bool apply(Y &u, const X &f)
Definition: analyzing_solver.h:61
SmartPtr< ILinearOperatorInverse< X, Y > > m_pLinearOperatorInverse
Definition: analyzing_solver.h:163
M matrix_type
Matrix type.
Definition: analyzing_solver.h:58
Y codomain_function_type
Range space.
Definition: analyzing_solver.h:55
void check(const matrix_type &A)
Definition: analyzing_solver.h:90
void check(SmartPtr< ILinearOperator< Y, X > > A)
Definition: analyzing_solver.h:142
X domain_function_type
Domain space.
Definition: analyzing_solver.h:52
describes a linear mapping X->Y
Definition: linear_operator.h:80
describes an inverse linear mapping X->Y
Definition: linear_operator_inverse.h:80
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
ParallelMatrix< SparseMatrix< double > > matrix_type
Definition: cpu_algebra_types.h:79
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
size_t GetCols(const T &t)
double & BlockRef(T &vec, size_t i)
Definition: blocks.h:66
void checksub(const CPUAlgebra::matrix_type &A)
Definition: analyzing_solver.cpp:37
size_t GetRows(const T &t)
Definition: communication_policies.h:58