32 #include <cusp/detail/config.h>
33 #include <cusp/array1d.h>
34 #include <cusp/blas.h>
35 #include <cusp/array2d.h>
36 #include <cusp/print.h>
62 template <
typename ValueType>
66 typedef typename norm_type<ValueType>::type
Real;
82 template <
typename MV>
87 bool verbose =
true) :
96 for (
int i = 0; i <
numRHS; i++)
97 b_norm[i] = cusp::blas::nrm2(b.column(i));
109 template <
typename MV>
116 cusp::array1d<ValueType, cusp::host_memory> resid(
numRHS);
117 std::cout <<
"Successfully converged after " <<
iteration_count() <<
" iterations to tolerance " <<
tolerance(0) << std::endl;
118 std::cout <<
"with max residual norm ";
120 for (
int i = 0; i <
numRHS; i++) {
121 resid[i] = cusp::blas::nrm2(r.column(i));
122 if (resid[i] > norm_max) norm_max = resid[i];
124 std::cout << norm_max << std::endl;
134 cusp::array1d<ValueType, cusp::host_memory> resid(
numRHS);
135 std::cout <<
"Failed to converge after " <<
iteration_count() <<
" iterations." << std::endl;
136 std::cout <<
"with max residual norm ";
138 for (
int i = 0; i <
numRHS; i++) {
139 resid[i] = cusp::blas::nrm2(r.column(i));
140 if (resid[i] > norm_max) norm_max = resid[i];
142 std::cout << norm_max << std::endl;
159 template <
typename MV>
162 for (
int i = 0; i <
numRHS; i++){
164 if (cusp::blas::nrm2(r.column(i)) >
tolerance(i)){
203 cusp::array1d<ValueType, cusp::host_memory>
b_norm;
bool converged(MV &r) const
default_block_monitor(const MV &b, size_t iteration_limit=500, Real absolute_tolerance=1e-6, Real relative_tolerance=1e-6, bool verbose=true)
bool finished(const MV &r)
norm_type< ValueType >::type Real
size_t iteration_count() const
size_t iteration_limit() const
Real tolerance(int i) const
cusp::array1d< ValueType, cusp::host_memory > b_norm
Real absolute_tolerance() const
Real relative_tolerance() const