monolish
0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
|
Go to the documentation of this file.
7 #include <initializer_list>
10 #define MONOLISH_SOLVER_SUCCESS 0
11 #define MONOLISH_SOLVER_SIZE_ERROR -1
12 #define MONOLISH_SOLVER_MAXITER -2
13 #define MONOLISH_SOLVER_BREAKDOWN -3
14 #define MONOLISH_SOLVER_RESIDUAL_NAN -4
15 #define MONOLISH_SOLVER_NOT_IMPL -10
251 template <
typename T>
254 std::random_device random;
255 std::mt19937 mt(random());
256 std::uniform_real_distribution<> rand(
min,
max);
258 for (
size_t i = 0; i < vec.
size(); i++) {
282 template <
typename T>
297 template <
typename T>
310 template <
typename T>
323 template <
typename T>
336 template <
typename T>
343 template <
typename T,
typename... types>
358 template <
typename T,
typename U>
bool is_same_size(
const T &x,
const U &y) {
359 return x.size() == y.size();
372 template <
typename T>
385 template <
typename T>
398 template <
typename T>
411 template <
typename T>
418 template <
typename T,
typename U,
typename... types>
419 bool is_same_size(
const T &arg1,
const U &arg2,
const types &... args) {
430 template <
typename T,
typename U>
432 return arg1.get_device_mem_stat() == arg2.get_device_mem_stat();
442 template <
typename T,
typename U,
typename... types>
444 const types &... args) {
463 template <
typename T>
465 const T diag_val,
const T val);
478 template <
typename T>
480 const int nnzrow,
const T val);
523 template <
typename T>
537 template <
typename T>
574 template <
typename T>
589 template <
typename T>
598 template <
typename T>
auto send(T &x) { x.send(); }
603 template <
typename T,
typename... Types>
auto send(T &x, Types &... args) {
612 template <
typename T>
auto recv(T &x) { x.recv(); }
617 template <
typename T,
typename... Types>
auto recv(T &x, Types &... args) {
632 template <
typename T,
typename... Types>
bool is_same_size(const T &x, const U &y)
compare size of vector or 1Dview (same as is_same_structure())
bool build_with_avx()
get build option (true: with avx, false: without avx)
Linear Operator imitating Matrix.
void min(const matrix::CRS< double > &A, const matrix::CRS< double > &B, matrix::CRS< double > &C)
Create a new CRS matrix with smallest elements of two matrices (C[0:nnz] = min(A[0:nnz],...
bool build_with_gpu()
get build option (true: enable gpu, false: disable gpu)
matrix::COO< T > tridiagonal_toeplitz_matrix(const int &M, T a, T b)
create tridiagonal Toeplitz matrix
matrix::COO< T > random_structure_matrix(const int M, const int N, const int nnzrow, const T val)
create random structure matrix (column number is decided by random)
bool build_with_cblas()
get build option (true: with cblas, false: without cblas (=with intel mkl))
matrix::COO< T > frank_matrix(const int &M)
create Frank matrix
bool is_same_structure(const T A, const U B)
compare matrix structure
void max(const matrix::CRS< double > &A, const matrix::CRS< double > &B, matrix::CRS< double > &C)
Create a new CRS matrix with greatest elements of two matrices (C[0:nnz] = max(A[0:nnz],...
double get_residual_l2(const matrix::Dense< double > &A, const vector< double > &x, const vector< double > &y)
get nrm |b-Ax|_2
T frank_matrix_eigenvalue(const int &M, const int &N)
Nth eigenvalue from the bottom of MxM Frank matrix.
T tridiagonal_toeplitz_matrix_eigenvalue(const int &M, int N, T a, T b)
Nth smallest eigenvalue of MxM tridiagonal Toeplitz matrix.
auto device_free(T &x)
free data of GPU
auto size() const
get vector size
bool build_with_lapack()
get build option (true: with lapack, false: without lapack (=with intel mkl))
bool is_same_device_mem_stat(const T &arg1, const U &arg2)
compare same device memory status
matrix::COO< T > band_matrix(const int M, const int N, const int W, const T diag_val, const T val)
create band matrix
matrix::COO< T > eye(const int M)
create band matrix
T toeplitz_plus_hankel_matrix_eigenvalue(const int &M, int N, T a0, T a1, T a2, T b0, T b1, T b2)
Nth smallest eigenvalue of GEVP Ax=lBx of Toeplitz-plus-Hankel matrixes A, B.
matrix::COO< T > toeplitz_plus_hankel_matrix(const int &M, T a0, T a1, T a2)
create Toeplitz-plus-Hankel matrix
Coodinate (COO) format Matrix (need to sort)
void set_log_filename(const std::string filename)
Specifying the log finename.
auto recv(T &x)
recv. and free data from GPU
bool solver_check(const int err)
check error
void random_vector(vector< T > &vec, const T min, const T max)
create random vector
bool build_with_avx2()
get build option (true: with avx2, false: without avx2)
void set_log_level(const size_t Level)
Logger utils ///////////////////////////////.
T laplacian_matrix_1D_eigenvalue(const int &M, int N)
Nth smallest eigenvalue of 1D Laplacian matrix.
auto send(T &x)
send data to GPU
matrix::COO< T > laplacian_matrix_1D(const int &M)
create 1D Laplacian matrix
Compressed Row Storage (CRS) format Matrix.
bool build_with_avx512()
get build option (true: with avx512, false: without avx512)
bool build_with_mkl()
get build option (true: with intel mkl, false: without intel mkl)