monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
Functions
monolish::util Namespace Reference

monolish utilities More...

Functions

template<typename T >
matrix::COO< T > band_matrix (const int M, const int N, const int W, const T diag_val, const T val)
 create band matrix More...
 
bool build_with_avx ()
 get build option (true: with avx, false: without avx) More...
 
bool build_with_avx2 ()
 get build option (true: with avx2, false: without avx2) More...
 
bool build_with_avx512 ()
 get build option (true: with avx512, false: without avx512) More...
 
bool build_with_cblas ()
 get build option (true: with cblas, false: without cblas (=with intel mkl)) More...
 
bool build_with_gpu ()
 get build option (true: enable gpu, false: disable gpu) More...
 
bool build_with_lapack ()
 get build option (true: with lapack, false: without lapack (=with intel mkl)) More...
 
bool build_with_mkl ()
 get build option (true: with intel mkl, false: without intel mkl) More...
 
template<typename T >
auto device_free (T &x)
 free data of GPU More...
 
template<typename T , typename... Types>
auto device_free (T &x, Types &... args)
 free datas of GPU More...
 
template<typename T >
matrix::COO< T > eye (const int M)
 create band matrix More...
 
template<typename T >
matrix::COO< T > frank_matrix (const int &M)
 create Frank matrix More...
 
template<typename T >
frank_matrix_eigenvalue (const int &M, const int &N)
 Nth eigenvalue from the bottom of MxM Frank matrix. More...
 
double get_residual_l2 (const matrix::CRS< double > &A, const vector< double > &x, const vector< double > &y)
 get nrm |b-Ax|_2 More...
 
double get_residual_l2 (const matrix::CRS< double > &A, const vector< double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::CRS< double > &A, const vector< double > &x, const view1D< vector< double >, double > &y)
 
double get_residual_l2 (const matrix::CRS< double > &A, const view1D< matrix::Dense< double >, double > &x, const vector< double > &y)
 
double get_residual_l2 (const matrix::CRS< double > &A, const view1D< matrix::Dense< double >, double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::CRS< double > &A, const view1D< matrix::Dense< double >, double > &x, const view1D< vector< double >, double > &y)
 
double get_residual_l2 (const matrix::CRS< double > &A, const view1D< vector< double >, double > &x, const vector< double > &y)
 
double get_residual_l2 (const matrix::CRS< double > &A, const view1D< vector< double >, double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::CRS< double > &A, const view1D< vector< double >, double > &x, const view1D< vector< double >, double > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const vector< float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const vector< float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const vector< float > &x, const view1D< vector< float >, float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const view1D< matrix::Dense< float >, float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const view1D< matrix::Dense< float >, float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const view1D< matrix::Dense< float >, float > &x, const view1D< vector< float >, float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const view1D< vector< float >, float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const view1D< vector< float >, float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::CRS< float > &A, const view1D< vector< float >, float > &x, const view1D< vector< float >, float > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const vector< double > &x, const vector< double > &y)
 get nrm |b-Ax|_2 More...
 
double get_residual_l2 (const matrix::Dense< double > &A, const vector< double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const vector< double > &x, const view1D< vector< double >, double > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const view1D< matrix::Dense< double >, double > &x, const vector< double > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const view1D< matrix::Dense< double >, double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const view1D< matrix::Dense< double >, double > &x, const view1D< vector< double >, double > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const view1D< vector< double >, double > &x, const vector< double > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const view1D< vector< double >, double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::Dense< double > &A, const view1D< vector< double >, double > &x, const view1D< vector< double >, double > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const vector< float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const vector< float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const vector< float > &x, const view1D< vector< float >, float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const view1D< matrix::Dense< float >, float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const view1D< matrix::Dense< float >, float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const view1D< matrix::Dense< float >, float > &x, const view1D< vector< float >, float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const view1D< vector< float >, float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const view1D< vector< float >, float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::Dense< float > &A, const view1D< vector< float >, float > &x, const view1D< vector< float >, float > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const vector< double > &x, const vector< double > &y)
 get nrm |b-Ax|_2 More...
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const vector< double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const vector< double > &x, const view1D< vector< double >, double > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const view1D< matrix::Dense< double >, double > &x, const vector< double > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const view1D< matrix::Dense< double >, double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const view1D< matrix::Dense< double >, double > &x, const view1D< vector< double >, double > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const view1D< vector< double >, double > &x, const vector< double > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const view1D< vector< double >, double > &x, const view1D< matrix::Dense< double >, double > &y)
 
double get_residual_l2 (const matrix::LinearOperator< double > &A, const view1D< vector< double >, double > &x, const view1D< vector< double >, double > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const vector< float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const vector< float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const vector< float > &x, const view1D< vector< float >, float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const view1D< matrix::Dense< float >, float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const view1D< matrix::Dense< float >, float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const view1D< matrix::Dense< float >, float > &x, const view1D< vector< float >, float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const view1D< vector< float >, float > &x, const vector< float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const view1D< vector< float >, float > &x, const view1D< matrix::Dense< float >, float > &y)
 
float get_residual_l2 (const matrix::LinearOperator< float > &A, const view1D< vector< float >, float > &x, const view1D< vector< float >, float > &y)
 
template<typename T , typename U >
bool is_same_device_mem_stat (const T &arg1, const U &arg2)
 compare same device memory status More...
 
template<typename T , typename U , typename... types>
bool is_same_device_mem_stat (const T &arg1, const U &arg2, const types &... args)
 compare same device memory status More...
 
template bool is_same_size (const matrix::COO< double > &A, const matrix::COO< double > &B)
 
template bool is_same_size (const matrix::COO< float > &A, const matrix::COO< float > &B)
 
template<typename T >
bool is_same_size (const matrix::COO< T > &A, const matrix::COO< T > &B)
 compare row and col size More...
 
template bool is_same_size (const matrix::CRS< double > &A, const matrix::CRS< double > &B)
 
template bool is_same_size (const matrix::CRS< float > &A, const matrix::CRS< float > &B)
 
template<typename T >
bool is_same_size (const matrix::CRS< T > &A, const matrix::CRS< T > &B)
 compare row and col size More...
 
template bool is_same_size (const matrix::Dense< double > &A, const matrix::Dense< double > &B)
 
template bool is_same_size (const matrix::Dense< float > &A, const matrix::Dense< float > &B)
 
template<typename T >
bool is_same_size (const matrix::Dense< T > &A, const matrix::Dense< T > &B)
 compare row and col size More...
 
template bool is_same_size (const matrix::LinearOperator< double > &A, const matrix::LinearOperator< double > &B)
 
template bool is_same_size (const matrix::LinearOperator< float > &A, const matrix::LinearOperator< float > &B)
 
template<typename T >
bool is_same_size (const matrix::LinearOperator< T > &A, const matrix::LinearOperator< T > &B)
 compare row and col size More...
 
template<typename T , typename U , typename... types>
bool is_same_size (const T &arg1, const U &arg2, const types &... args)
 compare matrix size More...
 
template<typename T , typename U >
bool is_same_size (const T &x, const U &y)
 compare size of vector or 1Dview (same as is_same_structure()) More...
 
template bool is_same_structure (const matrix::COO< double > &A, const matrix::COO< double > &B)
 
template bool is_same_structure (const matrix::COO< float > &A, const matrix::COO< float > &B)
 
template<typename T >
bool is_same_structure (const matrix::COO< T > &A, const matrix::COO< T > &B)
 compare structure using col_index and row_index, M, and N More...
 
template bool is_same_structure (const matrix::CRS< double > &A, const matrix::CRS< double > &B)
 
template bool is_same_structure (const matrix::CRS< float > &A, const matrix::CRS< float > &B)
 
template<typename T >
bool is_same_structure (const matrix::CRS< T > &A, const matrix::CRS< T > &B)
 compare structure using structure_hash, M, and N More...
 
template bool is_same_structure (const matrix::Dense< double > &A, const matrix::Dense< double > &B)
 
template bool is_same_structure (const matrix::Dense< float > &A, const matrix::Dense< float > &B)
 
template<typename T >
bool is_same_structure (const matrix::Dense< T > &A, const matrix::Dense< T > &B)
 compare structure using M and N (same as is_same_size()) More...
 
template bool is_same_structure (const matrix::LinearOperator< double > &A, const matrix::LinearOperator< double > &B)
 
template bool is_same_structure (const matrix::LinearOperator< float > &A, const matrix::LinearOperator< float > &B)
 
template<typename T >
bool is_same_structure (const matrix::LinearOperator< T > &A, const matrix::LinearOperator< T > &B)
 compare structure using M and N (same as is_same_size()) More...
 
template<typename T , typename... types>
bool is_same_structure (const T &A, const T &B, const types &... args)
 compare matrix structure More...
 
template<typename T , typename U >
bool is_same_structure (const T A, const U B)
 compare matrix structure More...
 
template<typename T >
bool is_same_structure (const vector< T > &x, const vector< T > &y)
 compare structure of vector (same as is_same_size()) More...
 
template<typename T >
matrix::COO< T > laplacian_matrix_1D (const int &M)
 create 1D Laplacian matrix More...
 
template<typename T >
laplacian_matrix_1D_eigenvalue (const int &M, int N)
 Nth smallest eigenvalue of 1D Laplacian matrix. More...
 
template<typename T >
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) More...
 
template<typename T >
void random_vector (vector< T > &vec, const T min, const T max)
 create random vector More...
 
template<typename T >
auto recv (T &x)
 recv. and free data from GPU More...
 
template<typename T , typename... Types>
auto recv (T &x, Types &... args)
 recv. and free datas to GPU More...
 
template<typename T >
auto send (T &x)
 send data to GPU More...
 
template<typename T , typename... Types>
auto send (T &x, Types &... args)
 send datas to GPU More...
 
void set_log_filename (const std::string filename)
 Specifying the log finename. More...
 
void set_log_level (const size_t Level)
 Logger utils ///////////////////////////////. More...
 
bool solver_check (const int err)
 check error More...
 
template<typename T >
matrix::COO< T > toeplitz_plus_hankel_matrix (const int &M, T a0, T a1, T a2)
 create Toeplitz-plus-Hankel matrix More...
 
template<typename 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. More...
 
template<typename T >
matrix::COO< T > tridiagonal_toeplitz_matrix (const int &M, T a, T b)
 create tridiagonal Toeplitz matrix More...
 
template<typename T >
tridiagonal_toeplitz_matrix_eigenvalue (const int &M, int N, T a, T b)
 Nth smallest eigenvalue of MxM tridiagonal Toeplitz matrix. More...
 

Detailed Description

monolish utilities

Function Documentation

◆ band_matrix()

template<typename T >
matrix::COO< T > monolish::util::band_matrix ( const int  M,
const int  N,
const int  W,
const T  diag_val,
const T  val 
)

create band matrix

Parameters
M# of Row
N# of col.
Whalf-bandwidth (bandwidth is 2*W+1)
diag_valvalue of diagonal elements
valvalue of non-diagonal elements
Note
  • # of computation: M*W
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 7 of file band_matrix.cpp.

Here is the call graph for this function:

◆ build_with_avx()

bool monolish::util::build_with_avx ( )

get build option (true: with avx, false: without avx)

Definition at line 6 of file system_util.cpp.

◆ build_with_avx2()

bool monolish::util::build_with_avx2 ( )

get build option (true: with avx2, false: without avx2)

Definition at line 14 of file system_util.cpp.

◆ build_with_avx512()

bool monolish::util::build_with_avx512 ( )

get build option (true: with avx512, false: without avx512)

Definition at line 22 of file system_util.cpp.

◆ build_with_cblas()

bool monolish::util::build_with_cblas ( )

get build option (true: with cblas, false: without cblas (=with intel mkl))

Definition at line 54 of file system_util.cpp.

◆ build_with_gpu()

bool monolish::util::build_with_gpu ( )

get build option (true: enable gpu, false: disable gpu)

Definition at line 30 of file system_util.cpp.

◆ build_with_lapack()

bool monolish::util::build_with_lapack ( )

get build option (true: with lapack, false: without lapack (=with intel mkl))

Definition at line 46 of file system_util.cpp.

◆ build_with_mkl()

bool monolish::util::build_with_mkl ( )

get build option (true: with intel mkl, false: without intel mkl)

Definition at line 38 of file system_util.cpp.

◆ device_free() [1/2]

template<typename T >
auto monolish::util::device_free ( T &  x)

free data of GPU

Definition at line 627 of file monolish_common.hpp.

Here is the caller graph for this function:

◆ device_free() [2/2]

template<typename T , typename... Types>
auto monolish::util::device_free ( T &  x,
Types &...  args 
)

free datas of GPU

Definition at line 633 of file monolish_common.hpp.

Here is the call graph for this function:

◆ eye()

template<typename T >
template matrix::COO< float > monolish::util::eye ( const int  M)

create band matrix

Parameters
M# of Row and col.
Note
  • # of computation: M
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 6 of file eye.cpp.

Here is the call graph for this function:

◆ frank_matrix()

template<typename T >
template matrix::COO< float > monolish::util::frank_matrix ( const int &  M)

create Frank matrix

Parameters
M# of row and col
Note
  • # of computation: M^2
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 6 of file frank.cpp.

Here is the call graph for this function:

◆ frank_matrix_eigenvalue()

template<typename T >
template float monolish::util::frank_matrix_eigenvalue ( const int &  M,
const int &  N 
)

Nth eigenvalue from the bottom of MxM Frank matrix.

Parameters
Mdimension of Frank matrix
N#-th eigenvalue from the bottom
Note
  • # of computation: O(1)
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 26 of file frank.cpp.

◆ get_residual_l2() [1/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const vector< double > &  x,
const vector< double > &  y 
)

get nrm |b-Ax|_2

Parameters
ACRS matrix (size M x N)
xmonolish vector (size N)
ymonolish vector (size M)
Note
  • # of computation: 2*M*nnz + N
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: 0

Definition at line 157 of file equation_utils.cpp.

◆ get_residual_l2() [2/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const vector< double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 165 of file equation_utils.cpp.

◆ get_residual_l2() [3/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const vector< double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 161 of file equation_utils.cpp.

◆ get_residual_l2() [4/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const vector< double > &  y 
)

Definition at line 184 of file equation_utils.cpp.

◆ get_residual_l2() [5/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 194 of file equation_utils.cpp.

◆ get_residual_l2() [6/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 189 of file equation_utils.cpp.

◆ get_residual_l2() [7/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const view1D< vector< double >, double > &  x,
const vector< double > &  y 
)

Definition at line 169 of file equation_utils.cpp.

◆ get_residual_l2() [8/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const view1D< vector< double >, double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 179 of file equation_utils.cpp.

◆ get_residual_l2() [9/54]

double monolish::util::get_residual_l2 ( const matrix::CRS< double > &  A,
const view1D< vector< double >, double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 174 of file equation_utils.cpp.

◆ get_residual_l2() [10/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const vector< float > &  x,
const vector< float > &  y 
)

Definition at line 199 of file equation_utils.cpp.

◆ get_residual_l2() [11/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const vector< float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 207 of file equation_utils.cpp.

◆ get_residual_l2() [12/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const vector< float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 203 of file equation_utils.cpp.

◆ get_residual_l2() [13/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const vector< float > &  y 
)

Definition at line 226 of file equation_utils.cpp.

◆ get_residual_l2() [14/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 236 of file equation_utils.cpp.

◆ get_residual_l2() [15/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 231 of file equation_utils.cpp.

◆ get_residual_l2() [16/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const view1D< vector< float >, float > &  x,
const vector< float > &  y 
)

Definition at line 211 of file equation_utils.cpp.

◆ get_residual_l2() [17/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const view1D< vector< float >, float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 221 of file equation_utils.cpp.

◆ get_residual_l2() [18/54]

float monolish::util::get_residual_l2 ( const matrix::CRS< float > &  A,
const view1D< vector< float >, float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 216 of file equation_utils.cpp.

◆ get_residual_l2() [19/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const vector< double > &  x,
const vector< double > &  y 
)

get nrm |b-Ax|_2

Parameters
ADense matrix (size M x N)
xmonolish vector (size N)
ymonolish vector (size M)
Note
  • # of computation: 2*M*nnz + N
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: 0

Definition at line 72 of file equation_utils.cpp.

◆ get_residual_l2() [20/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const vector< double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 80 of file equation_utils.cpp.

◆ get_residual_l2() [21/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const vector< double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 76 of file equation_utils.cpp.

◆ get_residual_l2() [22/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const vector< double > &  y 
)

Definition at line 99 of file equation_utils.cpp.

◆ get_residual_l2() [23/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 109 of file equation_utils.cpp.

◆ get_residual_l2() [24/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 104 of file equation_utils.cpp.

◆ get_residual_l2() [25/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const view1D< vector< double >, double > &  x,
const vector< double > &  y 
)

Definition at line 84 of file equation_utils.cpp.

◆ get_residual_l2() [26/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const view1D< vector< double >, double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 94 of file equation_utils.cpp.

◆ get_residual_l2() [27/54]

double monolish::util::get_residual_l2 ( const matrix::Dense< double > &  A,
const view1D< vector< double >, double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 89 of file equation_utils.cpp.

◆ get_residual_l2() [28/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const vector< float > &  x,
const vector< float > &  y 
)

Definition at line 114 of file equation_utils.cpp.

◆ get_residual_l2() [29/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const vector< float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 122 of file equation_utils.cpp.

◆ get_residual_l2() [30/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const vector< float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 118 of file equation_utils.cpp.

◆ get_residual_l2() [31/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const vector< float > &  y 
)

Definition at line 141 of file equation_utils.cpp.

◆ get_residual_l2() [32/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 151 of file equation_utils.cpp.

◆ get_residual_l2() [33/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 146 of file equation_utils.cpp.

◆ get_residual_l2() [34/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const view1D< vector< float >, float > &  x,
const vector< float > &  y 
)

Definition at line 126 of file equation_utils.cpp.

◆ get_residual_l2() [35/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const view1D< vector< float >, float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 136 of file equation_utils.cpp.

◆ get_residual_l2() [36/54]

float monolish::util::get_residual_l2 ( const matrix::Dense< float > &  A,
const view1D< vector< float >, float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 131 of file equation_utils.cpp.

◆ get_residual_l2() [37/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const vector< double > &  x,
const vector< double > &  y 
)

get nrm |b-Ax|_2

Parameters
ALinearOperator (size M x N)
xmonolish vector (size N)
ymonolish vector (size M)
Note
  • # of computation: 2*M*nnz + N
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: 0

Definition at line 242 of file equation_utils.cpp.

◆ get_residual_l2() [38/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const vector< double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 251 of file equation_utils.cpp.

◆ get_residual_l2() [39/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const vector< double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 246 of file equation_utils.cpp.

◆ get_residual_l2() [40/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const vector< double > &  y 
)

Definition at line 271 of file equation_utils.cpp.

◆ get_residual_l2() [41/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 281 of file equation_utils.cpp.

◆ get_residual_l2() [42/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const view1D< matrix::Dense< double >, double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 276 of file equation_utils.cpp.

◆ get_residual_l2() [43/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const view1D< vector< double >, double > &  x,
const vector< double > &  y 
)

Definition at line 256 of file equation_utils.cpp.

◆ get_residual_l2() [44/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const view1D< vector< double >, double > &  x,
const view1D< matrix::Dense< double >, double > &  y 
)

Definition at line 266 of file equation_utils.cpp.

◆ get_residual_l2() [45/54]

double monolish::util::get_residual_l2 ( const matrix::LinearOperator< double > &  A,
const view1D< vector< double >, double > &  x,
const view1D< vector< double >, double > &  y 
)

Definition at line 261 of file equation_utils.cpp.

◆ get_residual_l2() [46/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const vector< float > &  x,
const vector< float > &  y 
)

Definition at line 286 of file equation_utils.cpp.

◆ get_residual_l2() [47/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const vector< float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 295 of file equation_utils.cpp.

◆ get_residual_l2() [48/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const vector< float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 290 of file equation_utils.cpp.

◆ get_residual_l2() [49/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const vector< float > &  y 
)

Definition at line 315 of file equation_utils.cpp.

◆ get_residual_l2() [50/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 325 of file equation_utils.cpp.

◆ get_residual_l2() [51/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const view1D< matrix::Dense< float >, float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 320 of file equation_utils.cpp.

◆ get_residual_l2() [52/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const view1D< vector< float >, float > &  x,
const vector< float > &  y 
)

Definition at line 300 of file equation_utils.cpp.

◆ get_residual_l2() [53/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const view1D< vector< float >, float > &  x,
const view1D< matrix::Dense< float >, float > &  y 
)

Definition at line 310 of file equation_utils.cpp.

◆ get_residual_l2() [54/54]

float monolish::util::get_residual_l2 ( const matrix::LinearOperator< float > &  A,
const view1D< vector< float >, float > &  x,
const view1D< vector< float >, float > &  y 
)

Definition at line 305 of file equation_utils.cpp.

◆ is_same_device_mem_stat() [1/2]

template<typename T , typename U >
bool monolish::util::is_same_device_mem_stat ( const T &  arg1,
const U &  arg2 
)

compare same device memory status

Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 431 of file monolish_common.hpp.

Here is the caller graph for this function:

◆ is_same_device_mem_stat() [2/2]

template<typename T , typename U , typename... types>
bool monolish::util::is_same_device_mem_stat ( const T &  arg1,
const U &  arg2,
const types &...  args 
)

compare same device memory status

Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 443 of file monolish_common.hpp.

Here is the call graph for this function:

◆ is_same_size() [1/14]

template bool monolish::util::is_same_size ( const matrix::COO< double > &  A,
const matrix::COO< double > &  B 
)

◆ is_same_size() [2/14]

template bool monolish::util::is_same_size ( const matrix::COO< float > &  A,
const matrix::COO< float > &  B 
)

◆ is_same_size() [3/14]

template<typename T >
bool monolish::util::is_same_size ( const matrix::COO< T > &  A,
const matrix::COO< T > &  B 
)

compare row and col size

Parameters
ACOO matrix
BCOO matrix
Returns
true is same size
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 134 of file compare_coo.cpp.

Here is the call graph for this function:

◆ is_same_size() [4/14]

template bool monolish::util::is_same_size ( const matrix::CRS< double > &  A,
const matrix::CRS< double > &  B 
)

◆ is_same_size() [5/14]

template bool monolish::util::is_same_size ( const matrix::CRS< float > &  A,
const matrix::CRS< float > &  B 
)

◆ is_same_size() [6/14]

template<typename T >
bool monolish::util::is_same_size ( const matrix::CRS< T > &  A,
const matrix::CRS< T > &  B 
)

compare row and col size

Parameters
ACOO matrix
BCOO matrix
Returns
true is same size
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 125 of file compare_crs.cpp.

Here is the call graph for this function:

◆ is_same_size() [7/14]

template bool monolish::util::is_same_size ( const matrix::Dense< double > &  A,
const matrix::Dense< double > &  B 
)

◆ is_same_size() [8/14]

template bool monolish::util::is_same_size ( const matrix::Dense< float > &  A,
const matrix::Dense< float > &  B 
)

◆ is_same_size() [9/14]

template<typename T >
bool monolish::util::is_same_size ( const matrix::Dense< T > &  A,
const matrix::Dense< T > &  B 
)

compare row and col size

Parameters
ADense matrix
BDense matrix
Returns
true is same size
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 95 of file compare_dense.cpp.

Here is the call graph for this function:

◆ is_same_size() [10/14]

template bool monolish::util::is_same_size ( const matrix::LinearOperator< double > &  A,
const matrix::LinearOperator< double > &  B 
)

◆ is_same_size() [11/14]

template bool monolish::util::is_same_size ( const matrix::LinearOperator< float > &  A,
const matrix::LinearOperator< float > &  B 
)

◆ is_same_size() [12/14]

template<typename T >
bool monolish::util::is_same_size ( const matrix::LinearOperator< T > &  A,
const matrix::LinearOperator< T > &  B 
)

compare row and col size

Parameters
ALinearOperator matrix
BLinearOperator matrix
Returns
true is same size
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 32 of file compare_linearoperator.cpp.

Here is the call graph for this function:

◆ is_same_size() [13/14]

template<typename T , typename U , typename... types>
bool monolish::util::is_same_size ( const T &  arg1,
const U &  arg2,
const types &...  args 
)

compare matrix size

Definition at line 419 of file monolish_common.hpp.

Here is the call graph for this function:

◆ is_same_size() [14/14]

template<typename T , typename U >
bool monolish::util::is_same_size ( const T &  x,
const U &  y 
)

compare size of vector or 1Dview (same as is_same_structure())

Parameters
xmonolish vector
ymonolish vector
Returns
true is same size
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 358 of file monolish_common.hpp.

Here is the caller graph for this function:

◆ is_same_structure() [1/15]

template bool monolish::util::is_same_structure ( const matrix::COO< double > &  A,
const matrix::COO< double > &  B 
)

◆ is_same_structure() [2/15]

template bool monolish::util::is_same_structure ( const matrix::COO< float > &  A,
const matrix::COO< float > &  B 
)

◆ is_same_structure() [3/15]

template<typename T >
bool monolish::util::is_same_structure ( const matrix::COO< T > &  A,
const matrix::COO< T > &  B 
)

compare structure using col_index and row_index, M, and N

Parameters
ACOO matrix
BCOO matrix
Returns
true is same structure
Note
  • # of computation: 2nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 102 of file compare_coo.cpp.

Here is the call graph for this function:

◆ is_same_structure() [4/15]

template bool monolish::util::is_same_structure ( const matrix::CRS< double > &  A,
const matrix::CRS< double > &  B 
)

◆ is_same_structure() [5/15]

template bool monolish::util::is_same_structure ( const matrix::CRS< float > &  A,
const matrix::CRS< float > &  B 
)

◆ is_same_structure() [6/15]

template<typename T >
bool monolish::util::is_same_structure ( const matrix::CRS< T > &  A,
const matrix::CRS< T > &  B 
)

compare structure using structure_hash, M, and N

Parameters
ACRS matrix
BCRS matrix
Returns
true is same structure
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 99 of file compare_crs.cpp.

Here is the call graph for this function:

◆ is_same_structure() [7/15]

template bool monolish::util::is_same_structure ( const matrix::Dense< double > &  A,
const matrix::Dense< double > &  B 
)

◆ is_same_structure() [8/15]

template bool monolish::util::is_same_structure ( const matrix::Dense< float > &  A,
const matrix::Dense< float > &  B 
)

◆ is_same_structure() [9/15]

template<typename T >
bool monolish::util::is_same_structure ( const matrix::Dense< T > &  A,
const matrix::Dense< T > &  B 
)

compare structure using M and N (same as is_same_size())

Parameters
ADense matrix
BDense matrix
Returns
true is same structure
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 74 of file compare_dense.cpp.

Here is the call graph for this function:

◆ is_same_structure() [10/15]

template bool monolish::util::is_same_structure ( const matrix::LinearOperator< double > &  A,
const matrix::LinearOperator< double > &  B 
)

◆ is_same_structure() [11/15]

template bool monolish::util::is_same_structure ( const matrix::LinearOperator< float > &  A,
const matrix::LinearOperator< float > &  B 
)

◆ is_same_structure() [12/15]

template<typename T >
bool monolish::util::is_same_structure ( const matrix::LinearOperator< T > &  A,
const matrix::LinearOperator< T > &  B 
)

compare structure using M and N (same as is_same_size())

Parameters
ALinearOperator matrix
BLinearOperator matrix
Returns
true is same structure
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 10 of file compare_linearoperator.cpp.

Here is the call graph for this function:

◆ is_same_structure() [13/15]

template<typename T , typename... types>
bool monolish::util::is_same_structure ( const T &  A,
const T &  B,
const types &...  args 
)

compare matrix structure

Definition at line 344 of file monolish_common.hpp.

Here is the call graph for this function:

◆ is_same_structure() [14/15]

template<typename T , typename U >
bool monolish::util::is_same_structure ( const T  A,
const U  B 
)

compare matrix structure

Definition at line 268 of file monolish_common.hpp.

Here is the caller graph for this function:

◆ is_same_structure() [15/15]

template<typename T >
bool monolish::util::is_same_structure ( const vector< T > &  x,
const vector< T > &  y 
)

compare structure of vector (same as is_same_size())

Parameters
xmonolish vector
ymonolish vector
Returns
true is same structure
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 283 of file monolish_common.hpp.

Here is the call graph for this function:

◆ laplacian_matrix_1D()

template<typename T >
template matrix::COO< float > monolish::util::laplacian_matrix_1D ( const int &  M)

create 1D Laplacian matrix

Parameters
M# of row and col
Note
  • # of computation: M
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 6 of file laplacian.cpp.

◆ laplacian_matrix_1D_eigenvalue()

template<typename T >
template float monolish::util::laplacian_matrix_1D_eigenvalue ( const int &  M,
int  N 
)

Nth smallest eigenvalue of 1D Laplacian matrix.

Parameters
Mdimension of tridiagonal Toeplitz matrix
N#-th eigenvalue from the bottom
Note
  • # of computation: O(1)
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 13 of file laplacian.cpp.

◆ random_structure_matrix()

template<typename T >
matrix::COO< T > monolish::util::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)

Parameters
M# of Row
N# of col.
nnzrownon-zero elements per row
valvalue of elements
Note
  • # of computation: M*nnzrow
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 8 of file random_stracture.cpp.

Here is the call graph for this function:

◆ random_vector()

template<typename T >
void monolish::util::random_vector ( vector< T > &  vec,
const T  min,
const T  max 
)

create random vector

Parameters
vecallocated vector
minmin. of random
maxmin. of random
Note
the ramdom number generator is random generator is mt19937
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 252 of file monolish_common.hpp.

Here is the call graph for this function:

◆ recv() [1/2]

template<typename T >
auto monolish::util::recv ( T &  x)

recv. and free data from GPU

Definition at line 612 of file monolish_common.hpp.

Here is the caller graph for this function:

◆ recv() [2/2]

template<typename T , typename... Types>
auto monolish::util::recv ( T &  x,
Types &...  args 
)

recv. and free datas to GPU

Definition at line 617 of file monolish_common.hpp.

Here is the call graph for this function:

◆ send() [1/2]

template<typename T >
auto monolish::util::send ( T &  x)

send data to GPU

Definition at line 598 of file monolish_common.hpp.

Here is the caller graph for this function:

◆ send() [2/2]

template<typename T , typename... Types>
auto monolish::util::send ( T &  x,
Types &...  args 
)

send datas to GPU

Definition at line 603 of file monolish_common.hpp.

Here is the call graph for this function:

◆ set_log_filename()

void monolish::util::set_log_filename ( const std::string  filename)

Specifying the log finename.

Parameters
filenamethe log filename

Definition at line 161 of file logger_utils.cpp.

Here is the call graph for this function:

◆ set_log_level()

void monolish::util::set_log_level ( const size_t  Level)

Logger utils ///////////////////////////////.

logger util ///

Specifying the log level

Parameters
Levelloglevel
Note
loglevel is
  1. logging solvers (CG, Jacobi, LU...etc.)
  2. logging solvers and BLAS functions (matmul, matvec, arithmetic operators..etc.)
  3. logging solvers and BLAS functions and utils (send, recv, allocation...etc.)

Definition at line 156 of file logger_utils.cpp.

Here is the call graph for this function:

◆ solver_check()

bool monolish::util::solver_check ( const int  err)

check error

Parameters
[in]errsolver err code
Note
  • MONOLISH_SOLVER_SUCCESS 0
  • MONOLISH_SOLVER_SIZE_ERROR -1
  • MONOLISH_SOLVER_MAXITER -2
  • MONOLISH_SOLVER_BREAKDOWN -3
  • MONOLISH_SOLVER_RESIDUAL_NAN -4
  • MONOLISH_SOLVER_NOT_IMPL -10

Definition at line 7 of file equation_utils.cpp.

◆ toeplitz_plus_hankel_matrix()

template<typename T >
matrix::COO< T > monolish::util::toeplitz_plus_hankel_matrix ( const int &  M,
a0,
a1,
a2 
)

create Toeplitz-plus-Hankel matrix

Parameters
M# of row and col
a0value of diagonal elements
a1value of next-to-diagonal elements
a2value of second-next-to-diagonal elements
Note
  • taken from arxiv:2007.08130
  • (0, 0) and (M-1, M-1) elements are modified to a0-a2
  • both A and B of the GEVP have same structure
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 7 of file toeplitz_plus_hankel.cpp.

Here is the call graph for this function:

◆ toeplitz_plus_hankel_matrix_eigenvalue()

template<typename T >
T monolish::util::toeplitz_plus_hankel_matrix_eigenvalue ( const int &  M,
int  N,
a0,
a1,
a2,
b0,
b1,
b2 
)

Nth smallest eigenvalue of GEVP Ax=lBx of Toeplitz-plus-Hankel matrixes A, B.

Parameters
Mdimension of Toeplitz-plus-Hankel marices
N#-th eigenvalue from the bottom
a0,a1,a2value of Toeplitz-plus-Hankel matrix A
b0,b1,b2value of TOeplitz-plus-Hankel matrix B
Note
  • # of computation: O(1)
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 46 of file toeplitz_plus_hankel.cpp.

◆ tridiagonal_toeplitz_matrix()

template<typename T >
matrix::COO< T > monolish::util::tridiagonal_toeplitz_matrix ( const int &  M,
a,
b 
)

create tridiagonal Toeplitz matrix

Parameters
M# of row and col
avalue of diagonal elements
bvalue of next-to-diagonal elements
Note
  • # of computation: M
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 7 of file tridiagonal_toeplitz.cpp.

Here is the call graph for this function:

◆ tridiagonal_toeplitz_matrix_eigenvalue()

template<typename T >
T monolish::util::tridiagonal_toeplitz_matrix_eigenvalue ( const int &  M,
int  N,
a,
b 
)

Nth smallest eigenvalue of MxM tridiagonal Toeplitz matrix.

Parameters
Mdimension of tridiagonal Toeplitz matrix
N#-th eigenvalue from the bottom
avalue of diagonal elements
bvalue of next-to-diagonal elements
Note
  • # of computation: O(1)
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 31 of file tridiagonal_toeplitz.cpp.