13 #include <initializer_list>
16 #define MONOLISH_SOLVER_SUCCESS 0
17 #define MONOLISH_SOLVER_SIZE_ERROR -1
18 #define MONOLISH_SOLVER_MAXITER -2
19 #define MONOLISH_SOLVER_BREAKDOWN -3
20 #define MONOLISH_SOLVER_RESIDUAL_NAN -4
21 #define MONOLISH_SOLVER_NOT_IMPL -10
377 template <
typename T>
393 template <
typename T>
395 const std::uint32_t seed);
403 template <
typename T,
typename U>
419 template <
typename T>
435 template <
typename T,
typename U>
452 template <
typename T,
typename U>
469 template <
typename T,
typename U,
typename V>
486 template <
typename T>
501 template <
typename T>
516 template <
typename T>
531 template <
typename T>
546 template <
typename T,
typename U>
561 template <
typename T,
typename U>
576 template <
typename T,
typename U,
typename V>
591 template <
typename T>
606 template <
typename T>
621 template <
typename T,
typename U>
636 template <
typename T,
typename U>
651 template <
typename T,
typename U,
typename V>
659 template <
typename T,
typename U,
typename V,
typename... types>
661 const types &...args) {
676 template <
typename T,
typename U>
678 return x.size() == y.size();
692 template <
typename T>
707 template <
typename T>
722 template <
typename T>
737 template <
typename T>
752 template <
typename T,
typename U>
766 template <
typename T,
typename U>
780 template <
typename T,
typename U,
typename V>
795 template <
typename T>
810 template <
typename T>
825 template <
typename T,
typename U>
839 template <
typename T,
typename U>
853 template <
typename T,
typename U,
typename V>
861 template <
typename T,
typename U,
typename V,
typename... types>
862 [[nodiscard]]
bool is_same_size(
const T &arg1,
const U &arg2,
const V &arg3,
863 const types &...args) {
875 template <
typename T,
typename U>
877 return arg1.get_device_mem_stat() == arg2.get_device_mem_stat();
888 template <
typename T,
typename U,
typename... types>
890 const types &...args) {
910 template <
typename T>
912 const T diag_val,
const T val);
928 template <
typename T>
930 const int W,
const T diag_val,
931 const T Uval,
const T Lval);
945 template <
typename T>
962 template <
typename T>
980 template <
typename T>
983 const size_t nnzrow,
const T val);
998 template <
typename T>
1001 const size_t L,
const size_t nnzrow,
const T val);
1035 template <
typename T>
1049 template <
typename T>
1065 template <
typename T>
1078 template <
typename T>
1091 template <
typename T>
1105 template <
typename T>
1122 template <
typename T>
1139 template <
typename T>
1141 T a0, T a1, T a2, T b0,
1150 template <
typename T>
void send(T &x) { x.send(); }
1156 template <
typename T,
typename... Types>
void send(T &x, Types &...args) {
1166 template <
typename T>
void recv(T &x) { x.recv(); }
1172 template <
typename T,
typename... Types>
void recv(T &x, Types &...args) {
1189 template <
typename T,
typename... Types>
Coodinate (COO) format Matrix (need to sort)
Compressed Row Storage (CRS) format Matrix.
Linear Operator imitating Matrix.
size_t size() const
get vector size
size_t size() const
get view1D size (range)
int get_num_devices()
get the number of devices
bool set_default_device(size_t device_num)
set default device number
int get_default_device()
get default device number
void send(T &x)
send data to GPU
void recv(T &x)
recv. and free data from GPU
void device_free(T &x)
free data of GPU
double get_residual_l2(const matrix::Dense< double > &A, const vector< double > &x, const vector< double > &y)
get nrm |b-Ax|_2
bool build_with_mpi()
get build option (true: enable MPI, false: disable MPI)
bool build_with_gpu()
get build option (true: enable gpu, false: disable gpu)
bool build_with_avx2()
get build option (true: with avx2, false: without avx2)
bool build_with_lapack()
get build option (true: with lapack, false: without lapack (=with intel mkl))
bool build_with_cblas()
get build option (true: with cblas, false: without cblas (=with intel mkl))
bool build_with_avx()
get build option (true: with avx, false: without avx)
bool build_with_mkl()
get build option (true: with intel mkl, false: without intel mkl)
bool build_with_avx512()
get build option (true: with avx512, false: without avx512)
bool is_same_structure(const T A, const U B)
compare matrix structure
bool is_same_size(const T &x, const U &y)
compare size of vector or 1Dview (same as is_same_structure())
bool is_same_device_mem_stat(const T &arg1, const U &arg2)
compare same device memory status
bool solver_check(const int err)
check error
tensor::tensor_COO< T > random_structure_tensor(const size_t M, const size_t N, const size_t nnzrow, const T val)
create random structure tensor (index is decided by random)
void random_vector(vector< T > &vec, const T min, const T max)
create random vector
matrix::COO< T > tridiagonal_toeplitz_matrix(const int &M, T a, T b)
create tridiagonal Toeplitz matrix
matrix::COO< T > laplacian_matrix_2D_5p(const int M, const int N)
create two dimensional Laplacian matrix using the five point central difference scheme
matrix::COO< T > toeplitz_plus_hankel_matrix(const int &M, T a0, T a1, T a2)
create Toeplitz-plus-Hankel matrix
T tridiagonal_toeplitz_matrix_eigenvalue(const int &M, int N, T a, T b)
Nth smallest eigenvalue of MxM tridiagonal Toeplitz matrix.
T laplacian_matrix_1D_eigenvalue(const int &M, int N)
Nth smallest eigenvalue of 1D Laplacian matrix.
matrix::COO< T > laplacian_matrix_1D(const int &M)
create 1D Laplacian matrix
matrix::COO< T > asym_band_matrix(const int M, const int N, const int W, const T diag_val, const T Uval, const T Lval)
create asymmetric band 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)
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 > frank_matrix(const int &M)
create Frank matrix
matrix::COO< T > band_matrix(const int M, const int N, const int W, const T diag_val, const T val)
create band matrix
T frank_matrix_eigenvalue(const int &M, const int &N)
Nth eigenvalue from the bottom of MxM Frank matrix.
matrix::COO< T > eye(const int M)
create band matrix
void set_log_filename(const std::string filename)
Specifying the log finename.
void set_log_level(const size_t Level)
Specifying the log level.
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],...
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],...