monolish
0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
|
Go to the documentation of this file. 1 #include "../../include/monolish_blas.hpp"
2 #include "../../include/monolish_equation.hpp"
3 #include "../../include/monolish_vml.hpp"
4 #include "../internal/monolish_internal.hpp"
12 template <
typename MATRIX,
typename T>
18 if (A.get_row() != A.get_col()) {
19 throw std::runtime_error(
"error, A.row != A.col");
23 throw std::runtime_error(
"error, A.get_device_mem_stat != "
24 "x.get_device_mem_stat != b.get_device_mem_stat");
32 if (A.get_device_mem_stat() ==
true) {
36 this->precond.create_precond(A);
43 this->precond.apply_precond(r, z);
46 for (
size_t iter = 0; iter < this->get_maxiter(); iter++) {
56 this->precond.apply_precond(r, z);
61 T resid = this->get_residual(r);
62 if (this->get_print_rhistory() ==
true) {
63 *this->rhistory_stream << iter + 1 <<
"\t" << std::scientific << resid
67 if (resid < this->get_tol() && this->get_miniter() <= iter + 1) {
72 if (std::isnan(resid)) {
97 template <
typename MATRIX,
typename T>
103 if (this->get_lib() == 0) {
104 ret = monolish_CG(A, x, b);
Linear Operator imitating Matrix.
int solve(MATRIX &A, vector< Float > &x, vector< Float > &b)
solve Ax = b by BiCGSTAB method(lib=0: monolish)
logger class (singleton, for developper class)
void axpy(const double alpha, const vector< double > &x, vector< double > &y)
axpy: y = ax + y
int monolish_CG(MATRIX &A, vector< Float > &x, vector< Float > &b)
void solver_in(const std::string func_name)
void sub(const matrix::CRS< double > &A, const matrix::CRS< double > &B, matrix::CRS< double > &C)
element by element subtract CRS matrix A and CRS matrix B.
#define MONOLISH_SOLVER_SUCCESS
#define MONOLISH_SOLVER_MAXITER
void copy(const matrix::Dense< double > &A, matrix::Dense< double > &C)
Dense matrix copy (C=A)
bool get_device_mem_stat() const
true: sended, false: not send
void matvec(const matrix::Dense< double > &A, const vector< double > &x, vector< double > &y)
Dense matrix and vector multiplication: y = Ax.
void dot(const vector< double > &x, const vector< double > &y, double &ans)
inner product (dot)
void xpay(const double alpha, const vector< double > &x, vector< double > &y)
xpay: y = x + ay
#define MONOLISH_SOLVER_RESIDUAL_NAN
auto send(T &x)
send data to GPU
static Logger & get_instance()
Compressed Row Storage (CRS) format Matrix.