monolish
0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
|
Go to the documentation of this file.
17 template <
typename Float>
class vector;
18 template <
typename TYPE,
typename Float>
class view1D;
20 template <
typename Float>
class Dense;
21 template <
typename Float>
class COO;
29 template <
typename Float>
class CRS {
61 std::vector<Float>
val;
87 CRS(
const size_t M,
const size_t N,
const size_t NNZ);
104 CRS(
const size_t M,
const size_t N,
const size_t NNZ,
const int *rowptr,
105 const int *colind,
const Float *value);
123 CRS(
const size_t M,
const size_t N,
const size_t NNZ,
const int *rowptr,
124 const int *colind,
const Float *value,
const size_t origin);
140 CRS(
const size_t M,
const size_t N,
const std::vector<int> &rowptr,
141 const std::vector<int> &colind,
const std::vector<Float> &value);
157 CRS(
const size_t M,
const size_t N,
const std::vector<int> &rowptr,
216 void set_ptr(
const size_t M,
const size_t N,
const std::vector<int> &rowptr,
217 const std::vector<int> &colind,
const std::vector<Float> &value);
227 void print_all(
bool force_cpu =
false)
const;
263 std::string
type()
const {
return "CRS"; }
387 return (
get_nnz() *
sizeof(Float) + (
get_row() + 1) *
sizeof(
int) +
400 void fill(Float value);
424 bool equal(
const CRS<Float> &mat,
bool compare_cpu_and_device =
false)
const;
void fill(Float value)
fill matrix elements with a scalar value
double get_data_size() const
std::vector< Float > val
CRS format value, which stores values of the non-zero elements (size nnz)
CRS(COO< Float > &coo)
Create CRS matrix from COO matrix, also compute the hash.
std::string type() const
get format name "CRS"
void nonfree_recv()
recv. data to GPU (w/o free)
void operator=(const CRS< Float > &mat)
matrix copy
size_t get_hash() const
get index array hash (to compare structure)
size_t get_nnz() const
get # of non-zeros
size_t nnz
# of non-zero element
bool operator!=(const CRS< Float > &mat) const
Comparing matricies (A != mat)
std::vector< int > col_ind
CRS format column index, which stores column numbers of the non-zero elements (size nnz)
bool gpu_status
true: sended, false: not send
void col(const size_t c, vector< Float > &vec) const
get column vector
~CRS()
destructor of CRS matrix, free GPU memory
size_t structure_hash
hash, created from row_ptr and col_ind
void print_all(bool force_cpu=false) const
print all elements to standard I/O
bool operator==(const CRS< Float > &mat) const
Comparing matricies (A == mat)
void row(const size_t r, vector< Float > &vec) const
get row vector
size_t get_row() const
get # of row
Coodinate (COO) format Matrix (need to sort)
void convert(COO< Float > &coo)
Convert CRS matrix from COO matrix, also compute the hash.
void recv()
recv. data to GPU, and free data on GPU
bool get_device_mem_stat() const
true: sended, false: not send
void diag(vector< Float > &vec) const
get diag. vector
void compute_hash()
compute index array hash (to compare structure)
void send() const
send data to GPU
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.
size_t get_col() const
get # of col
bool equal(const CRS< Float > &mat, bool compare_cpu_and_device=false) const
Comparing matricies (A == mat)
std::vector< int > row_ptr
CRS format row pointer, which stores the starting points of the rows of the arrays value and col_ind ...
Compressed Row Storage (CRS) format Matrix.
void device_free() const
free data on GPU