monolish
0.15.1
MONOlithic LInear equation Solvers for Highly-parallel architecture
|
Go to the documentation of this file.
5 template <
typename Float>
class vector;
6 template <
typename TYPE,
typename Float>
class view1D;
14 template <
typename Float>
class Dense {
40 std::vector<Float>
val;
97 Dense(
const size_t M,
const size_t N);
109 Dense(
const size_t M,
const size_t N,
const Float *value);
121 Dense(
const size_t M,
const size_t N,
const std::vector<Float> &value);
145 Dense(
const size_t M,
const size_t N,
146 const std::initializer_list<Float> &list);
159 Dense(
const size_t M,
const size_t N,
const Float
min,
const Float
max);
171 Dense(
const size_t M,
const size_t N,
const Float value);
183 void set_ptr(
const size_t M,
const size_t N,
const std::vector<Float> &value);
246 [[nodiscard]] std::string
type()
const {
return "Dense"; }
278 return get_nnz() *
sizeof(Float) / 1.0e+9;
291 [[nodiscard]] Float
at(
const size_t i,
const size_t j)
const;
303 [[nodiscard]] Float
at(
const size_t i,
const size_t j) {
304 return static_cast<const Dense *
>(
this)->
at(i, j);
318 void insert(
const size_t i,
const size_t j,
const Float Val);
328 void print_all(
bool force_cpu =
false)
const;
436 void fill(Float value);
464 throw std::runtime_error(
"Error, GPU matrix dense cant use operator[]");
480 bool compare_cpu_and_device =
false)
const;
bool operator!=(const Dense< Float > &mat) const
Comparing matricies (A != mat)
void transpose()
get transposed matrix (A = A^T)
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],...
void insert(const size_t i, const size_t j, const Float Val)
get element A[i][j]
void operator=(const Dense< Float > &mat)
matrix copy
bool operator==(const Dense< Float > &mat) const
Comparing matricies (A == mat)
void diag_div(const Float alpha)
Scalar and diag. vector of dense matrix div.
~Dense()
destructor of CRS matrix, free GPU memory
bool get_device_mem_stat() const
true: sended, false: not send
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],...
size_t get_row() const
get # of row
std::vector< Float > val
Dense format value(size M x N)
Float * operator[](size_t m)
reference to the pointer of the begining of the m-th row
double get_data_size() const
Memory data space required by the matrix.
void fill(Float value)
fill matrix elements with a scalar value
void print_all(bool force_cpu=false) const
print all elements to standard I/O
void set_col(const size_t M)
Set column number.
void convert(const COO< Float > &coo)
Create Dense matrix from COO matrix.
void col(const size_t c, vector< Float > &vec) const
get column vector
void diag_add(const Float alpha)
Scalar and diag. vector of dense matrix add.
void diag_sub(const Float alpha)
Scalar and diag. vector of dense matrix sub.
size_t nnz
# of non-zero element (M * N)
bool gpu_status
true: sended, false: not send
void nonfree_recv()
recv. data to GPU (w/o free)
void diag_mul(const Float alpha)
Scalar and diag. vector of dense matrix mul.
void set_nnz(const size_t NZ)
Set # of non-zero elements.
std::string type() const
get format name "Dense"
Coodinate (COO) format Matrix (need to sort)
bool equal(const Dense< Float > &mat, bool compare_cpu_and_device=false) const
Comparing matricies (A == mat)
void send() const
send data to GPU
void set_ptr(const size_t M, const size_t N, const std::vector< Float > &value)
Set Dense array from std::vector.
size_t get_col() const
get # of col
size_t get_nnz() const
get # of non-zeros
void device_free() const
free data on GPU
Float at(const size_t i, const size_t j)
get element A[i][j] (only CPU)
Dense(const COO< Float > &coo)
Create dense matrix from COO matrix.
Float at(const size_t i, const size_t j) const
get element A[i][j]
void recv()
recv. data to GPU, and free data on GPU
void row(const size_t r, vector< Float > &vec) const
get row vector
void set_row(const size_t N)
Set row number.
void diag(vector< Float > &vec) const
get diag. vector