monolish
0.16.0
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;
20 template <
typename Float>
class Dense {
46 std::vector<Float>
val;
118 Dense(
const size_t M,
const size_t N);
130 Dense(
const size_t M,
const size_t N,
const Float *value);
142 Dense(
const size_t M,
const size_t N,
const std::vector<Float> &value);
166 Dense(
const size_t M,
const size_t N,
167 const std::initializer_list<Float> &list);
181 Dense(
const size_t M,
const size_t N,
const Float
min,
const Float
max);
195 Dense(
const size_t M,
const size_t N,
const Float
min,
const Float
max,
196 const std::uint32_t seed);
208 Dense(
const size_t M,
const size_t N,
const Float value);
220 void set_ptr(
const size_t M,
const size_t N,
const std::vector<Float> &value);
283 [[nodiscard]] std::string
type()
const {
return "Dense"; }
315 return get_nnz() *
sizeof(Float) / 1.0e+9;
328 [[nodiscard]] Float
at(
const size_t i,
const size_t j)
const;
340 [[nodiscard]] Float
at(
const size_t i,
const size_t j) {
341 return static_cast<const Dense *
>(
this)->
at(i, j);
355 void insert(
const size_t i,
const size_t j,
const Float Val);
365 void print_all(
bool force_cpu =
false)
const;
473 void fill(Float value);
501 throw std::runtime_error(
"Error, GPU matrix dense cant use operator[]");
517 bool compare_cpu_and_device =
false)
const;
bool operator!=(const Dense< Float > &mat) const
Comparing matrices (A != mat)
void transpose()
get transposed matrix (A = A^T)
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
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 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],...
bool operator==(const Dense< Float > &mat) const
Comparing matrices (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
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 matrices (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