monolish
0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
|
Compressed Row Storage (CRS) format Matrix. More...
#include <monolish_coo.hpp>
Public Member Functions | |
void | col (const size_t c, vector< Float > &vec) const |
get column vector More... | |
void | col (const size_t c, view1D< matrix::Dense< Float >, Float > &vec) const |
void | col (const size_t c, view1D< vector< Float >, Float > &vec) const |
void | compute_hash () |
compute index array hash (to compare structure) More... | |
void | convert (COO< Float > &coo) |
Convert CRS matrix from COO matrix, also compute the hash. More... | |
void | convert (CRS< Float > &crs) |
Convert CRS matrix from COO matrix. More... | |
CRS () | |
CRS (const CRS< Float > &mat) | |
Create CRS matrix from CRS matrix. More... | |
CRS (const size_t M, const size_t N, const size_t NNZ) | |
declare CRS matrix More... | |
CRS (const size_t M, const size_t N, const size_t NNZ, const int *rowptr, const int *colind, const Float *value) | |
Create CRS matrix from array, also compute the hash. More... | |
CRS (const size_t M, const size_t N, const size_t NNZ, const int *rowptr, const int *colind, const Float *value, const size_t origin) | |
Create CRS matrix from array, also compute the hash. More... | |
CRS (const size_t M, const size_t N, const std::vector< int > &rowptr, const std::vector< int > &colind, const std::vector< Float > &value) | |
Create CRS matrix from std::vector, also compute the hash. More... | |
CRS (const size_t M, const size_t N, const std::vector< int > &rowptr, const std::vector< int > &colind, const vector< Float > &value) | |
Create CRS matrix from std::vector, also compute the hash. More... | |
CRS (COO< Float > &coo) | |
Create CRS matrix from COO matrix, also compute the hash. More... | |
void | device_free () const |
free data on GPU More... | |
void | diag (vector< Float > &vec) const |
get diag. vector More... | |
void | diag (view1D< matrix::Dense< Float >, Float > &vec) const |
void | diag (view1D< vector< Float >, Float > &vec) const |
bool | equal (const CRS< Float > &mat, bool compare_cpu_and_device=false) const |
Comparing matricies (A == mat) More... | |
void | fill (Float value) |
fill matrix elements with a scalar value More... | |
size_t | get_col () const |
get # of col More... | |
double | get_data_size () const |
bool | get_device_mem_stat () const |
true: sended, false: not send More... | |
size_t | get_hash () const |
get index array hash (to compare structure) More... | |
size_t | get_nnz () const |
get # of non-zeros More... | |
size_t | get_row () const |
get # of row More... | |
void | nonfree_recv () |
recv. data to GPU (w/o free) More... | |
bool | operator!= (const CRS< Float > &mat) const |
Comparing matricies (A != mat) More... | |
void | operator= (const CRS< Float > &mat) |
matrix copy More... | |
bool | operator== (const CRS< Float > &mat) const |
Comparing matricies (A == mat) More... | |
void | print_all (bool force_cpu=false) const |
print all elements to standard I/O More... | |
void | recv () |
recv. data to GPU, and free data on GPU More... | |
void | row (const size_t r, vector< Float > &vec) const |
get row vector More... | |
void | row (const size_t r, view1D< matrix::Dense< Float >, Float > &vec) const |
void | row (const size_t r, view1D< vector< Float >, Float > &vec) const |
void | send () const |
send data to GPU More... | |
void | set_ptr (const size_t M, const size_t N, const std::vector< int > &rowptr, const std::vector< int > &colind, const std::vector< Float > &value) |
Set CRS array from std::vector. More... | |
std::string | type () const |
get format name "CRS" More... | |
~CRS () | |
destructor of CRS matrix, free GPU memory More... | |
Public Attributes | |
std::vector< int > | col_ind |
CRS format column index, which stores column numbers of the non-zero elements (size nnz) More... | |
std::vector< int > | row_ptr |
CRS format row pointer, which stores the starting points of the rows of the arrays value and col_ind (size M+1) More... | |
std::vector< Float > | val |
CRS format value, which stores values of the non-zero elements (size nnz) More... | |
Private Attributes | |
size_t | colN |
# of col More... | |
bool | gpu_status = false |
true: sended, false: not send More... | |
size_t | nnz |
# of non-zero element More... | |
size_t | rowN |
# of row More... | |
size_t | structure_hash |
hash, created from row_ptr and col_ind More... | |
Compressed Row Storage (CRS) format Matrix.
Definition at line 29 of file monolish_coo.hpp.
|
inline |
Definition at line 75 of file monolish_crs.hpp.
template monolish::matrix::CRS< Float >::CRS | ( | const size_t | M, |
const size_t | N, | ||
const size_t | NNZ | ||
) |
declare CRS matrix
M | # of row |
N | # of col |
NNZ | # of nnz |
Definition at line 11 of file crs_constructor.cpp.
monolish::matrix::CRS< Float >::CRS | ( | const size_t | M, |
const size_t | N, | ||
const size_t | NNZ, | ||
const int * | rowptr, | ||
const int * | colind, | ||
const Float * | value | ||
) |
Create CRS matrix from array, also compute the hash.
M | # of row |
N | # of col |
NNZ | # of non-zero elements |
rowptr | row_ptr, which stores the starting points of the rows of the arrays value and col_ind (size M+1) |
colind | col_ind, which stores the column numbers of the non-zero elements (size nnz) |
value | value index, which stores the non-zero elements (size nnz) |
monolish::matrix::CRS< Float >::CRS | ( | const size_t | M, |
const size_t | N, | ||
const size_t | NNZ, | ||
const int * | rowptr, | ||
const int * | colind, | ||
const Float * | value, | ||
const size_t | origin | ||
) |
Create CRS matrix from array, also compute the hash.
M | # of row |
N | # of col |
NNZ | # of non-zero elements |
rowptr | row_ptr, which stores the starting points of the rows of the arrays value and col_ind (size M+1) |
colind | n-origin col_ind, which stores the column numbers of the non-zero elements (size nnz) |
value | value index, which stores the non-zero elements (size nnz) |
monolish::matrix::CRS< Float >::CRS | ( | const size_t | M, |
const size_t | N, | ||
const std::vector< int > & | rowptr, | ||
const std::vector< int > & | colind, | ||
const std::vector< Float > & | value | ||
) |
Create CRS matrix from std::vector, also compute the hash.
M | # of row |
N | # of col |
rowptr | row_ptr, which stores the starting points of the rows of the arrays value and col_ind (size M+1) |
colind | col_ind, which stores the column numbers of the non-zero elements (size nnz) |
value | value index, which stores the non-zero elements (size nnz) |
monolish::matrix::CRS< Float >::CRS | ( | const size_t | M, |
const size_t | N, | ||
const std::vector< int > & | rowptr, | ||
const std::vector< int > & | colind, | ||
const vector< Float > & | value | ||
) |
Create CRS matrix from std::vector, also compute the hash.
M | # of row |
N | # of col |
rowptr | row_ptr, which stores the starting points of the rows of the arrays value and col_ind (size M+1) |
colind | col_ind, which stores the column numbers of the non-zero elements (size nnz) |
value | value index, which stores the non-zero elements (size nnz) |
|
inline |
monolish::matrix::CRS< Float >::CRS | ( | const CRS< Float > & | mat | ) |
|
inline |
destructor of CRS matrix, free GPU memory
Definition at line 332 of file monolish_crs.hpp.
void monolish::matrix::CRS< Float >::col | ( | const size_t | c, |
vector< Float > & | vec | ||
) | const |
get column vector
c | column number |
vec | column vector |
void monolish::matrix::CRS< Float >::col | ( | const size_t | c, |
view1D< matrix::Dense< Float >, Float > & | vec | ||
) | const |
void monolish::matrix::CRS< Float >::col | ( | const size_t | c, |
view1D< vector< Float >, Float > & | vec | ||
) | const |
template void monolish::matrix::CRS< Float >::compute_hash | ( | ) |
void monolish::matrix::CRS< Float >::convert | ( | COO< Float > & | coo | ) |
void monolish::matrix::CRS< Float >::convert | ( | CRS< Float > & | crs | ) |
template void monolish::matrix::CRS< Float >::device_free | ( | ) | const |
free data on GPU
Definition at line 153 of file gpu_comm.cpp.
void monolish::matrix::CRS< Float >::diag | ( | vector< Float > & | vec | ) | const |
get diag. vector
vec | diag. vector |
void monolish::matrix::CRS< Float >::diag | ( | view1D< matrix::Dense< Float >, Float > & | vec | ) | const |
void monolish::matrix::CRS< Float >::diag | ( | view1D< vector< Float >, Float > & | vec | ) | const |
template bool monolish::matrix::CRS< Float >::equal | ( | const CRS< Float > & | mat, |
bool | compare_cpu_and_device = false |
||
) | const |
Comparing matricies (A == mat)
mat | CRS matrix |
compare_cpu_and_device | compare data on both CPU and GPU |
Definition at line 10 of file compare_crs.cpp.
template void monolish::matrix::CRS< Float >::fill | ( | Float | value | ) |
fill matrix elements with a scalar value
value | scalar value |
Definition at line 9 of file fill_crs.cpp.
|
inline |
get # of col
Definition at line 245 of file monolish_crs.hpp.
|
inline |
|
inline |
true: sended, false: not send
Definition at line 323 of file monolish_crs.hpp.
|
inline |
get index array hash (to compare structure)
Definition at line 279 of file monolish_crs.hpp.
|
inline |
get # of non-zeros
Definition at line 254 of file monolish_crs.hpp.
|
inline |
get # of row
Definition at line 236 of file monolish_crs.hpp.
template void monolish::matrix::CRS< Float >::nonfree_recv | ( | ) |
recv. data to GPU (w/o free)
Definition at line 134 of file gpu_comm.cpp.
template bool monolish::matrix::CRS< Float >::operator!= | ( | const CRS< Float > & | mat | ) | const |
Comparing matricies (A != mat)
mat | CRS matrix |
gpu_status == true
; compare data on GPUDefinition at line 80 of file compare_crs.cpp.
template void monolish::matrix::CRS< Float >::operator= | ( | const CRS< Float > & | mat | ) |
matrix copy
gpu_status == true
; coping data on GPUDefinition at line 10 of file copy_crs.cpp.
template bool monolish::matrix::CRS< Float >::operator== | ( | const CRS< Float > & | mat | ) | const |
Comparing matricies (A == mat)
mat | CRS matrix |
gpu_status == true
; compare data on GPUDefinition at line 68 of file compare_crs.cpp.
template void monolish::matrix::CRS< Float >::print_all | ( | bool | force_cpu = false | ) | const |
print all elements to standard I/O
force_cpu | Ignore device status and output CPU data |
Definition at line 17 of file IO_crs.cpp.
template void monolish::matrix::CRS< Float >::recv | ( | ) |
recv. data to GPU, and free data on GPU
Definition at line 113 of file gpu_comm.cpp.
void monolish::matrix::CRS< Float >::row | ( | const size_t | r, |
vector< Float > & | vec | ||
) | const |
get row vector
r | row number |
vec | row vector |
void monolish::matrix::CRS< Float >::row | ( | const size_t | r, |
view1D< matrix::Dense< Float >, Float > & | vec | ||
) | const |
void monolish::matrix::CRS< Float >::row | ( | const size_t | r, |
view1D< vector< Float >, Float > & | vec | ||
) | const |
template void monolish::matrix::CRS< Float >::send | ( | ) | const |
send data to GPU
Definition at line 89 of file gpu_comm.cpp.
template void monolish::matrix::CRS< Float >::set_ptr | ( | const size_t | M, |
const size_t | N, | ||
const std::vector< int > & | rowptr, | ||
const std::vector< int > & | colind, | ||
const std::vector< Float > & | value | ||
) |
Set CRS array from std::vector.
M | # of row |
N | # of col |
rowptr | row_ptr, which stores the starting points of the rows of the arrays value and col_ind (size M+1) |
colind | col_ind, which stores the column numbers of the non-zero elements (size nnz) |
value | value index, which stores the non-zero elements (size nnz) |
Definition at line 41 of file copy_crs.cpp.
|
inline |
get format name "CRS"
Definition at line 263 of file monolish_crs.hpp.
std::vector<int> monolish::matrix::CRS< Float >::col_ind |
CRS format column index, which stores column numbers of the non-zero elements (size nnz)
Definition at line 67 of file monolish_crs.hpp.
|
private |
# of col
Definition at line 39 of file monolish_crs.hpp.
|
mutableprivate |
true: sended, false: not send
Definition at line 49 of file monolish_crs.hpp.
|
private |
# of non-zero element
Definition at line 44 of file monolish_crs.hpp.
std::vector<int> monolish::matrix::CRS< Float >::row_ptr |
CRS format row pointer, which stores the starting points of the rows of the arrays value and col_ind (size M+1)
Definition at line 73 of file monolish_crs.hpp.
|
private |
# of row
Definition at line 34 of file monolish_crs.hpp.
|
private |
hash, created from row_ptr and col_ind
Definition at line 54 of file monolish_crs.hpp.
std::vector<Float> monolish::matrix::CRS< Float >::val |
CRS format value, which stores values of the non-zero elements (size nnz)
Definition at line 61 of file monolish_crs.hpp.