monolish
0.17.3-dev.16
MONOlithic LInear equation Solvers for Highly-parallel architecture
|
vector class More...
#include <monolish_vector.hpp>
Public Member Functions | |
Float * | begin () |
returns a begin iterator More... | |
const Float * | begin () const |
returns a begin iterator More... | |
Float * | data () |
returns a direct pointer to the vector More... | |
const Float * | data () const |
returns a direct pointer to the vector More... | |
void | device_free () const |
free data on GPU More... | |
Float * | end () |
returns a end iterator More... | |
const Float * | end () const |
returns a end iterator More... | |
bool | equal (const vector< Float > &vec, bool compare_cpu_and_device=false) const |
Comparing matrices (A == mat) More... | |
bool | equal (const view1D< matrix::Dense< Float >, Float > &vec, bool compare_cpu_and_device=false) const |
Comparing matrices (A == mat) More... | |
bool | equal (const view1D< tensor::tensor_Dense< Float >, Float > &vec, bool compare_cpu_and_device=false) const |
Comparing matrices (A == mat) More... | |
bool | equal (const view1D< vector< Float >, Float > &vec, bool compare_cpu_and_device=false) const |
Comparing matrices (A == mat) More... | |
void | fill (Float value) |
fill vector elements with a scalar value More... | |
size_t | get_alloc_nnz () const |
get # of alloced non-zeros More... | |
bool | get_device_mem_stat () const |
true: sended, false: not send More... | |
size_t | get_first () const |
get first position More... | |
std::shared_ptr< bool > | get_gpu_status () const |
gpu status shared pointer More... | |
size_t | get_nnz () const |
get vector size More... | |
size_t | get_offset () const |
get first position (same as get_first()) More... | |
void | move (const tensor::tensor_Dense< Float > &tensor_dense) |
void | move (const tensor::tensor_Dense< Float > &tensor_dense, int N) |
void | move (const view_tensor_Dense< matrix::Dense< Float >, Float > &tensor_dense) |
void | move (const view_tensor_Dense< matrix::Dense< Float >, Float > &tensor_dense, int N) |
void | move (const view_tensor_Dense< tensor::tensor_Dense< Float >, Float > &tensor_dense) |
void | move (const view_tensor_Dense< tensor::tensor_Dense< Float >, Float > &tensor_dense, int N) |
void | move (const view_tensor_Dense< vector< Float >, Float > &tensor_dense) |
void | move (const view_tensor_Dense< vector< Float >, Float > &tensor_dense, int N) |
void | nonfree_recv () |
recv data from GPU (w/o free) More... | |
bool | operator!= (const vector< Float > &vec) const |
Comparing vectors (v != vec) More... | |
bool | operator!= (const view1D< matrix::Dense< Float >, Float > &vec) const |
Comparing vectors (v != vec) More... | |
bool | operator!= (const view1D< tensor::tensor_Dense< Float >, Float > &vec) const |
Comparing vectors (v != vec) More... | |
bool | operator!= (const view1D< vector< Float >, Float > &vec) const |
Comparing vectors (v != vec) More... | |
vector< Float > | operator- () |
Sign inversion. More... | |
void | operator= (const std::vector< Float > &vec) |
copy vector from std::vector More... | |
void | operator= (const vector< Float > &vec) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More... | |
void | operator= (const view1D< matrix::Dense< Float >, Float > &vec) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More... | |
void | operator= (const view1D< tensor::tensor_Dense< Float >, Float > &vec) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More... | |
void | operator= (const view1D< vector< Float >, Float > &vec) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU ) More... | |
bool | operator== (const vector< Float > &vec) const |
Comparing vectors (v == vec) More... | |
bool | operator== (const view1D< matrix::Dense< Float >, Float > &vec) const |
Comparing vectors (v == vec) More... | |
bool | operator== (const view1D< tensor::tensor_Dense< Float >, Float > &vec) const |
Comparing vectors (v == vec) More... | |
bool | operator== (const view1D< vector< Float >, Float > &vec) const |
Comparing vectors (v == vec) More... | |
Float & | operator[] (size_t i) |
reference to the element at position (v[i]) More... | |
void | print_all (bool force_cpu=false) const |
print all elements to standart I/O More... | |
void | print_all (std::string filename) const |
print all elements to file More... | |
void | push_back (Float Val) |
Add a new element at the end of the vector (only CPU) More... | |
void | recv () |
recv data from GPU, and free data on GPU More... | |
void | resize (size_t N, Float Val=0) |
resize vector (only CPU) More... | |
void | send () const |
send data to GPU More... | |
void | set_first (size_t i) |
change first position More... | |
size_t | size () const |
get vector size More... | |
std::string | type () const |
get format name "vector" More... | |
vector () | |
vector (const Float *start, const Float *end) | |
copy from pointer More... | |
vector (const size_t N) | |
allocate size N vector More... | |
vector (const size_t N, const Float min, const Float max) | |
create N length rand(min~max) vector More... | |
vector (const size_t N, const Float min, const Float max, const std::uint32_t seed) | |
create N length rand(min~max) vector with random seed More... | |
vector (const size_t N, const Float value) | |
initialize size N vector, value to fill the container More... | |
vector (const std::initializer_list< Float > &list) | |
copy from initializer_list More... | |
vector (const std::vector< Float > &vec) | |
copy from std::vector More... | |
vector (const vector< Float > &vec) | |
copy from monolish::vector More... | |
vector (const view1D< matrix::Dense< Float >, Float > &vec) | |
copy from monolish::view1D from monolish::matrix::Dense More... | |
vector (const view1D< tensor::tensor_Dense< Float >, Float > &vec) | |
copy from monolish::view1D from monolish::tensor::tensor_Dense More... | |
vector (const view1D< vector< Float >, Float > &vec) | |
copy from monolish::view1D from vector More... | |
~vector () | |
destructor of vector, free GPU memory More... | |
Public Attributes | |
std::size_t | alloc_nnz = 0 |
alloced vector size More... | |
std::shared_ptr< Float > | val |
vector data (pointer) More... | |
bool | val_create_flag = false |
vector create flag; More... | |
std::size_t | val_nnz = 0 |
vector size More... | |
Private Attributes | |
size_t | first = 0 |
first position of data array More... | |
std::shared_ptr< bool > | gpu_status = std::make_shared<bool>(false) |
true: sended, false: not send More... | |
vector class
Definition at line 47 of file monolish_vector.hpp.
|
inline |
Definition at line 80 of file monolish_vector.hpp.
monolish::vector< Float >::vector | ( | const size_t | N | ) |
allocate size N vector
N | vector length |
monolish::vector< Float >::vector | ( | const size_t | N, |
const Float | value | ||
) |
initialize size N vector, value to fill the container
N | vector length |
value | fill Float type value to all elements |
monolish::vector< Float >::vector | ( | const std::vector< Float > & | vec | ) |
copy from std::vector
vec | input std::vector |
monolish::vector< Float >::vector | ( | const std::initializer_list< Float > & | list | ) |
copy from initializer_list
list | input initializer_list |
monolish::vector< Float >::vector | ( | const vector< Float > & | vec | ) |
copy from monolish::vector
vec | input monolish::vector |
gpu_status == true
; coping data on CPU and GPU respectivelymonolish::vector< Float >::vector | ( | const view1D< vector< Float >, Float > & | vec | ) |
copy from monolish::view1D from vector
vec | input monolish::view1D from vector |
gpu_status == true
; coping data on CPU and GPU respectivelymonolish::vector< Float >::vector | ( | const view1D< matrix::Dense< Float >, Float > & | vec | ) |
copy from monolish::view1D from monolish::matrix::Dense
vec | input monolish::view1D from monolish::matrix::Dense |
gpu_status == true
; coping data on CPU and GPU respectivelymonolish::vector< Float >::vector | ( | const view1D< tensor::tensor_Dense< Float >, Float > & | vec | ) |
copy from monolish::view1D from monolish::tensor::tensor_Dense
vec | input monolish::view1D from monolish::tensor::tensor_Dense |
gpu_status == true
; coping data on CPU and GPU respectivelymonolish::vector< Float >::vector | ( | const Float * | start, |
const Float * | end | ||
) |
copy from pointer
start | start pointer |
end | end pointer |
monolish::vector< Float >::vector | ( | const size_t | N, |
const Float | min, | ||
const Float | max | ||
) |
create N length rand(min~max) vector
N | vector length |
min | rand min |
max | rand max |
monolish::vector< Float >::vector | ( | const size_t | N, |
const Float | min, | ||
const Float | max, | ||
const std::uint32_t | seed | ||
) |
create N length rand(min~max) vector with random seed
N | vector length |
min | rand min |
max | rand max |
seed | random seed |
|
inline |
destructor of vector, free GPU memory
Definition at line 290 of file monolish_vector.hpp.
|
inline |
returns a begin iterator
Definition at line 331 of file monolish_vector.hpp.
|
inline |
returns a begin iterator
Definition at line 323 of file monolish_vector.hpp.
|
inline |
returns a direct pointer to the vector
Definition at line 315 of file monolish_vector.hpp.
|
inline |
returns a direct pointer to the vector
Definition at line 307 of file monolish_vector.hpp.
void monolish::vector< Float >::device_free | ( | ) | const |
free data on GPU
|
inline |
returns a end iterator
Definition at line 349 of file monolish_vector.hpp.
|
inline |
returns a end iterator
Definition at line 339 of file monolish_vector.hpp.
bool monolish::vector< Float >::equal | ( | const vector< Float > & | vec, |
bool | compare_cpu_and_device = false |
||
) | const |
Comparing matrices (A == mat)
vec | vector |
compare_cpu_and_device | compare data on both CPU and GPU |
bool monolish::vector< Float >::equal | ( | const view1D< matrix::Dense< Float >, Float > & | vec, |
bool | compare_cpu_and_device = false |
||
) | const |
Comparing matrices (A == mat)
vec | view1D from monolish::matrix::Dense |
compare_cpu_and_device | compare data on both CPU and GPU |
bool monolish::vector< Float >::equal | ( | const view1D< tensor::tensor_Dense< Float >, Float > & | vec, |
bool | compare_cpu_and_device = false |
||
) | const |
Comparing matrices (A == mat)
vec | view1D from monolish::tensor::tensor_Dense |
compare_cpu_and_device | compare data on both CPU and GPU |
bool monolish::vector< Float >::equal | ( | const view1D< vector< Float >, Float > & | vec, |
bool | compare_cpu_and_device = false |
||
) | const |
Comparing matrices (A == mat)
vec | view1D from monolish::vector |
compare_cpu_and_device | compare data on both CPU and GPU |
void monolish::vector< Float >::fill | ( | Float | value | ) |
fill vector elements with a scalar value
value | scalar value |
|
inline |
get # of alloced non-zeros
Definition at line 374 of file monolish_vector.hpp.
|
inline |
true: sended, false: not send
Definition at line 273 of file monolish_vector.hpp.
|
inline |
get first position
Definition at line 382 of file monolish_vector.hpp.
|
inline |
gpu status shared pointer
Definition at line 279 of file monolish_vector.hpp.
|
inline |
get vector size
Definition at line 365 of file monolish_vector.hpp.
|
inline |
get first position (same as get_first())
Definition at line 390 of file monolish_vector.hpp.
void monolish::vector< Float >::move | ( | const tensor::tensor_Dense< Float > & | tensor_dense | ) |
void monolish::vector< Float >::move | ( | const tensor::tensor_Dense< Float > & | tensor_dense, |
int | N | ||
) |
void monolish::vector< Float >::move | ( | const view_tensor_Dense< matrix::Dense< Float >, Float > & | tensor_dense | ) |
void monolish::vector< Float >::move | ( | const view_tensor_Dense< matrix::Dense< Float >, Float > & | tensor_dense, |
int | N | ||
) |
void monolish::vector< Float >::move | ( | const view_tensor_Dense< tensor::tensor_Dense< Float >, Float > & | tensor_dense | ) |
void monolish::vector< Float >::move | ( | const view_tensor_Dense< tensor::tensor_Dense< Float >, Float > & | tensor_dense, |
int | N | ||
) |
void monolish::vector< Float >::move | ( | const view_tensor_Dense< vector< Float >, Float > & | tensor_dense | ) |
void monolish::vector< Float >::move | ( | const view_tensor_Dense< vector< Float >, Float > & | tensor_dense, |
int | N | ||
) |
void monolish::vector< Float >::nonfree_recv | ( | ) |
recv data from GPU (w/o free)
bool monolish::vector< Float >::operator!= | ( | const vector< Float > & | vec | ) | const |
Comparing vectors (v != vec)
vec | vector (size N) |
gpu_status == true
; compare data on GPUbool monolish::vector< Float >::operator!= | ( | const view1D< matrix::Dense< Float >, Float > & | vec | ) | const |
Comparing vectors (v != vec)
vec | vector (size N) |
gpu_status == true
; compare data on GPUbool monolish::vector< Float >::operator!= | ( | const view1D< tensor::tensor_Dense< Float >, Float > & | vec | ) | const |
Comparing vectors (v != vec)
vec | vector (size N) |
gpu_status == true
; compare data on GPUbool monolish::vector< Float >::operator!= | ( | const view1D< vector< Float >, Float > & | vec | ) | const |
Comparing vectors (v != vec)
vec | vector (size N) |
gpu_status == true
; compare data on GPUvector<Float> monolish::vector< Float >::operator- | ( | ) |
Sign inversion.
void monolish::vector< Float >::operator= | ( | const std::vector< Float > & | vec | ) |
copy vector from std::vector
vec | source std::vector |
void monolish::vector< Float >::operator= | ( | const vector< Float > & | vec | ) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
vec | source vector |
gpu_statius == true
; coping data on GPUvoid monolish::vector< Float >::operator= | ( | const view1D< matrix::Dense< Float >, Float > & | vec | ) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
vec | source view1D from monolish::matrix::Dense |
gpu_statius == true
; coping data on GPUvoid monolish::vector< Float >::operator= | ( | const view1D< tensor::tensor_Dense< Float >, Float > & | vec | ) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
vec | source view1D from monolish::tensor::tensor_Dense |
gpu_statius == true
; coping data on GPUvoid monolish::vector< Float >::operator= | ( | const view1D< vector< Float >, Float > & | vec | ) |
copy vector, It is same as copy ( Copy the memory on CPU and GPU )
vec | source view1D from monolish::vector |
gpu_statius == true
; coping data on GPUbool monolish::vector< Float >::operator== | ( | const vector< Float > & | vec | ) | const |
Comparing vectors (v == vec)
vec | vector (size N) |
gpu_status == true
; compare data on GPUbool monolish::vector< Float >::operator== | ( | const view1D< matrix::Dense< Float >, Float > & | vec | ) | const |
Comparing vectors (v == vec)
vec | view1D from monolish::matrix::Dense (size N) |
gpu_status == true
; compare data on GPUbool monolish::vector< Float >::operator== | ( | const view1D< tensor::tensor_Dense< Float >, Float > & | vec | ) | const |
Comparing vectors (v == vec)
vec | view1D from monolish::tensor::tensor_Dense (size N) |
gpu_status == true
; compare data on GPUbool monolish::vector< Float >::operator== | ( | const view1D< vector< Float >, Float > & | vec | ) | const |
Comparing vectors (v == vec)
vec | view1D from monolish::vector (size N) |
gpu_status == true
; compare data on GPU
|
inline |
reference to the element at position (v[i])
i | Position of an element in the vector |
Definition at line 591 of file monolish_vector.hpp.
void monolish::vector< Float >::print_all | ( | bool | force_cpu = false | ) | const |
print all elements to standart I/O
force_cpu | Ignore device status and output CPU data |
void monolish::vector< Float >::print_all | ( | std::string | filename | ) | const |
print all elements to file
filename | output filename |
|
inline |
Add a new element at the end of the vector (only CPU)
val | new element |
Definition at line 464 of file monolish_vector.hpp.
void monolish::vector< Float >::recv | ( | ) |
recv data from GPU, and free data on GPU
|
inline |
resize vector (only CPU)
N | vector length |
Definition at line 437 of file monolish_vector.hpp.
void monolish::vector< Float >::send | ( | ) | const |
send data to GPU
|
inline |
|
inline |
get vector size
Definition at line 357 of file monolish_vector.hpp.
|
inline |
get format name "vector"
Definition at line 225 of file monolish_vector.hpp.
std::size_t monolish::vector< Float >::alloc_nnz = 0 |
alloced vector size
Definition at line 73 of file monolish_vector.hpp.
|
private |
first position of data array
Definition at line 57 of file monolish_vector.hpp.
|
mutableprivate |
true: sended, false: not send
Definition at line 52 of file monolish_vector.hpp.
std::shared_ptr<Float> monolish::vector< Float >::val |
vector data (pointer)
Definition at line 63 of file monolish_vector.hpp.
bool monolish::vector< Float >::val_create_flag = false |
vector create flag;
Definition at line 78 of file monolish_vector.hpp.
std::size_t monolish::vector< Float >::val_nnz = 0 |
vector size
Definition at line 68 of file monolish_vector.hpp.