27 template <
typename Float>
class vector;
30 template <
typename Float>
class Dense;
31 template <
typename Float>
class CRS;
32 template <
typename Float>
class LinearOperator;
36 template <
typename Float>
class tensor_Dense;
50 template <
typename TYPE,
typename Float>
class view_Dense {
118 const size_t row,
const size_t col)
140 const size_t row,
const size_t col)
142 first = x.get_first() + start;
162 const size_t row,
const size_t col)
164 first = x.get_first() + start;
185 const size_t start,
const size_t row,
const size_t col)
187 first = x.get_first() + start;
308 [[nodiscard]] std::string
type()
const {
309 return "view_Dense(" +
target.type() +
")";
321 [[nodiscard]] Float
at(
const size_t i)
const {
return target.at(
first + i); }
333 [[nodiscard]] Float
at(
const size_t i,
const size_t j)
const {
346 [[nodiscard]] Float
at(
const size_t i) {
360 [[nodiscard]] Float
at(
const size_t i,
const size_t j) {
373 void insert(
const size_t i,
const Float Val) {
388 void insert(
const size_t i,
const size_t j,
const Float Val) {
402 return target.get_device_mem_stat();
579 if (
target.get_device_mem_stat()) {
580 throw std::runtime_error(
"Error, GPU vector cant use operator[]");
const Float * data() const
returns a direct pointer to the matrix
const Float * data() const
returns a direct pointer to the tensor
const Float * data() const
returns a direct pointer to the vector
size_t get_nnz() const
get view_Dense size (same as size())
void insert(const size_t i, const Float Val)
set element A[i/col][jcol]
void diag_mul(const Float alpha)
Scalar and diag. vector of Dense format matrix mul.
void diag_add(const vector< Float > &vec)
Vector and diag. vector of Dense format matrix add.
void operator=(const view_Dense< tensor::tensor_Dense< Float >, Float > &mat)
matrix copy
void diag_sub(const vector< Float > &vec)
Vector and diag. vector of Dense format matrix sub.
void move(const view_tensor_Dense< TYPE, Float > &view_tensor_dense)
void recv()
recv data from GPU, and free data on GPU
void send() const
send data to GPU
void diag_div(const view1D< vector< Float >, Float > &vec)
void diag_sub(const view1D< tensor::tensor_Dense< Float >, Float > &vec)
void diag_sub(const view1D< vector< Float >, Float > &vec)
Float at(const size_t i)
get element A[i/col][icol] (only CPU)
size_t get_last() const
get end position
void diag_add(const view1D< tensor::tensor_Dense< Float >, Float > &vec)
void fill(Float value)
fill vector elements with a scalar value
size_t get_row() const
get # of row
void diag_div(const Float alpha)
Scalar and diag. vector of Dense format matrix div.
Float * data()
returns a direct pointer to the vector (dont include offset)
Float * end() const
returns a end iterator
Float at(const size_t i, const size_t j)
get element A[i][j] (only CPU)
void move(const view_tensor_Dense< TYPE, Float > &view_tensor_dense, int rowN, int colN)
void diag_div(const view1D< tensor::tensor_Dense< Float >, Float > &vec)
size_t get_device_mem_stat() const
true: sended, false: not send
void operator=(const view_Dense< vector< Float >, Float > &mat)
matrix copy
void diag_sub(const view1D< matrix::Dense< Float >, Float > &vec)
void diag_sub(const Float alpha)
Scalar and diag. vector of Dense format matrix sub.
size_t get_first() const
get first position
void diag_mul(const view1D< matrix::Dense< Float >, Float > &vec)
void diag_mul(const view1D< vector< Float >, Float > &vec)
void set_last(size_t i)
change last position
Float * begin() const
returns begin iterator (include offset)
void set_first(size_t i)
change first position
void diag_div(const vector< Float > &vec)
Vector and diag. vector of Dense format matrix div.
Float at(const size_t i, const size_t j) const
get element A[i][j]
TYPE & get_target()
returns a reference of the target
std::shared_ptr< Float > get_val() const
size_t size() const
get view_Dense size (range)
void operator=(const matrix::Dense< Float > &mat)
matrix copy
Float * data() const
returns a direct pointer to the original vector (dont include offset)
std::string type() const
get format name "view_Dense"
Float * end()
returns a end iterator
size_t get_alloc_nnz() const
get # of alloced non-zeros
size_t get_col() const
get # of col
TYPE & get_target() const
returns a reference of the target
view_Dense(matrix::Dense< Float > &A, const size_t start, const size_t row, const size_t col)
create view_Dense from Dense matrix(start:start+range)
void diag_mul(const view1D< tensor::tensor_Dense< Float >, Float > &vec)
void diag_add(const view1D< vector< Float >, Float > &vec)
void diag_div(const view1D< matrix::Dense< Float >, Float > &vec)
void diag_add(const Float alpha)
Scalar and diag. vector of Dense format matrix add.
view_Dense(vector< Float > &x, const size_t start, const size_t row, const size_t col)
create view_Dense from vector(start:start+range)
view_Dense(view_Dense< matrix::Dense< Float >, Float > &x, const size_t start, const size_t row, const size_t col)
create view_Dense from monolish::matrix::Dense(start:start+range)
void insert(const size_t i, const size_t j, const Float Val)
set element A[i][j]
size_t get_offset() const
get first position (same as get_first())
Float & operator[](const size_t i)
reference to the element at position
void resize(size_t row, size_t col)
change last postion
Float * begin()
returns begin iterator (include offset)
void diag_mul(const vector< Float > &vec)
Vector and diag. vector of Dense format matrix mul.
view_Dense(tensor::tensor_Dense< Float > &A, const size_t start, const size_t row, const size_t col)
create view_Dense from Dense tensor(start:start+range)
view_Dense(view_Dense< tensor::tensor_Dense< Float >, Float > &x, const size_t start, const size_t row, const size_t col)
create view_Dense from monolish::tensor::tensor_Dense(start:start+range)
view_Dense(view_Dense< vector< Float >, Float > &x, const size_t start, const size_t row, const size_t col)
create view_Dense from monolish::vector(start:start+range)
void print_all(bool force_cpu=false) const
print all elements to standart I/O
Float at(const size_t i) const
get element A[i/col][jcol]
void operator=(const view_Dense< matrix::Dense< Float >, Float > &mat)
matrix copy
void diag_add(const view1D< matrix::Dense< Float >, Float > &vec)