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 view1D {
124 first = x.get_first() + start;
143 first = x.get_first() + start;
162 first = x.get_first() + start;
175 [[nodiscard]] std::string
type()
const {
176 return "view1D(" +
target.type() +
")";
269 return target.get_device_mem_stat();
437 if (
target.get_device_mem_stat()) {
438 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
view1D(tensor::tensor_Dense< Float > &A, const size_t start, const size_t size)
create view1D(start:start+range) from Dense tensor
void operator=(const view1D< tensor::tensor_Dense< Float >, Float > &vec)
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
view1D(vector< Float > &x, const size_t start, const size_t size)
create view1D(start:start+range) from vector
void recv()
recv data from GPU, and free data on GPU
size_t get_alloc_nnz() const
size_t get_last() const
get end position
Float * data()
returns a direct pointer to the vector (dont include offset)
void operator=(const view1D< matrix::Dense< Float >, Float > &vec)
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
Float * end() const
returns a end iterator
view1D(view1D< vector< Float >, Float > &x, const size_t start, const size_t size)
create view1D(start:start+range) from monolish::vector
Float * begin()
returns begin iterator (include offset)
std::shared_ptr< Float > get_val() const
void operator=(const view1D< vector< Float >, Float > &vec)
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
void fill(Float value)
fill vector elements with a scalar value
Float * data() const
returns a direct pointer to the original vector (dont include offset)
void print_all(bool force_cpu=false) const
print all elements to standart I/O
size_t get_device_mem_stat() const
true: sended, false: not send
void operator=(const std::vector< Float > &vec)
copy vector from std::vector
view1D(view1D< tensor::tensor_Dense< Float >, Float > &x, const size_t start, const size_t size)
create view1D(start:start+range) from monolish::tensor::tensor_Dense
view1D(matrix::Dense< Float > &A, const size_t start, const size_t size)
create view1D(start:start+range) from Dense matrix
size_t get_nnz() const
get view1D size (same as size())
Float & operator[](const size_t i)
reference to the element at position
void operator=(const vector< Float > &vec)
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
void set_last(size_t i)
change last position
size_t get_first() const
get first position
size_t size() const
get view1D size (range)
Float * end()
returns a end iterator
void set_first(size_t i)
change first position
size_t get_offset() const
get first position (same as get_first())
view1D(view1D< matrix::Dense< Float >, Float > &x, const size_t start, const size_t size)
create view1D(start:start+range) from monolish::matrix::Dense
void send() const
send data to GPU
Float * begin() const
returns begin iterator (include offset)
std::string type() const
get format name "view1D"
void resize(size_t N)
change last postion