monolish
0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
|
Go to the documentation of this file.
36 template <
typename Float>
class vector {
41 std::vector<Float>
val;
71 vector(
const size_t N,
const Float value);
81 vector(
const std::vector<Float> &vec);
91 vector(
const std::initializer_list<Float> &list);
144 vector(
const Float *start,
const Float *
end);
156 vector(
const size_t N,
const Float
min,
const Float
max);
230 const Float *
data()
const {
return val.data(); }
250 throw std::runtime_error(
"Error, GPU vector cant use resize");
263 throw std::runtime_error(
"Error, GPU vector cant use push_back");
324 void fill(Float value);
334 void print_all(
bool force_cpu =
false)
const;
344 void print_all(std::string filename)
const;
400 void operator=(
const std::vector<Float> &vec);
423 throw std::runtime_error(
"Error, GPU vector cant use operator[]");
439 bool compare_cpu_and_device =
false)
const;
452 bool compare_cpu_and_device =
false)
const;
465 bool compare_cpu_and_device =
false)
const;
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],...
std::vector< Float > val
size N vector data
Float * data()
returns a direct pointer to the vector
size_t get_offset() const
vector< Float > operator-()
Sign inversion.
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],...
const Float * end() const
returns a end iterator
auto size() const
get vector size
auto get_nnz() const
get vector size
Float * end()
returns a end iterator
const Float * data() const
returns a direct pointer to the vector
void operator=(const vector< Float > &vec)
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
Float & operator[](size_t i)
refetrence to the element at position (v[i])
void push_back(Float val)
Add a new element at the end of the vector (only CPU)
void nonfree_recv()
recv data from GPU (w/o free)
~vector()
destructor of vector, free GPU memory
void print_all(bool force_cpu=false) const
print all elements to standart I/O
bool get_device_mem_stat() const
true: sended, false: not send
const Float * begin() const
returns a begin iterator
bool operator!=(const vector< Float > &vec) const
Comparing vectors (v != vec)
void fill(Float value)
fill vector elements with a scalar value
Float * begin()
returns a begin iterator
bool operator==(const vector< Float > &vec) const
Comparing vectors (v == vec)
void device_free() const
free data on GPU
void send() const
send data to GPU
bool equal(const vector< Float > &vec, bool compare_cpu_and_device=false) const
Comparing matricies (A == mat)
void resize(size_t N)
resize vector (only CPU)
void recv()
recv data from GPU, and free data on GPU
bool gpu_status
true: sended, false: not send