monolish
0.17.3-dev.16
MONOlithic LInear equation Solvers for Highly-parallel architecture
|
#include <monolish_tensor_coo.hpp>
Public Member Functions | |
Float | at (const std::vector< size_t > &pos) |
get element A[pos[0]][pos[1]]... (onlu CPU) More... | |
Float | at (const std::vector< size_t > &pos) const |
get element A[pos[0]][pos[1]]... More... | |
Float * | begin () |
returns a begin iterator More... | |
const Float * | begin () const |
returns a begin iterator More... | |
void | convert (const tensor::tensor_Dense< Float > &tens) |
Create tensor_COO tensor from tensor_Dense tensor. More... | |
Float * | data () |
returns a direct pointer to the tensor More... | |
const Float * | data () const |
returns a direct pointer to the tensor More... | |
void | diag (vector< Float > &vec) const |
get diag. vector More... | |
void | diag (view1D< matrix::Dense< Float >, Float > &vec) const |
void | diag (view1D< tensor::tensor_Dense< Float >, Float > &vec) const |
void | diag (view1D< vector< Float >, Float > &vec) const |
Float * | end () |
returns a end iterator More... | |
const Float * | end () const |
returns a end iterator More... | |
bool | equal (const tensor_COO< Float > &tens, bool compare_cpu_and_device=false) const |
Comparing tensors (A == tens) More... | |
void | fill (Float value) |
fill tensor elements with a scalar value More... | |
double | get_data_size () const |
Memory data space required by the matrix. More... | |
bool | get_device_mem_stat () const |
true: sended, false: not send More... | |
std::vector< size_t > | get_index (const size_t pos) |
get vector index from aligned index (A[pos[0]][pos[1]]... = A[ind]) More... | |
size_t | get_index (const std::vector< size_t > &pos) |
get aligned index from vector index (A[pos] = A[ind[0]][ind[1]]...) More... | |
size_t | get_nnz () const |
get # of non-zeros More... | |
std::vector< size_t > | get_shape () const |
get shape More... | |
void | insert (const std::vector< size_t > &pos, const Float val) |
insert element A[pos[0]][pos[1]]... More... | |
bool | operator!= (const tensor_COO< Float > &tens) const |
Comparing tensors (A != tens) More... | |
void | operator= (const tensor_COO< Float > &tens) |
tensor copy More... | |
bool | operator== (const tensor_COO< Float > &tens) const |
Comparing tensors (A == tens) 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 standard I/O More... | |
void | print_all (const std::string filename) const |
print all elements to file More... | |
void | resize (const size_t N, Float Val=0) |
resize tensor value More... | |
void | set_ptr (const std::vector< size_t > &shape, const std::vector< std::vector< size_t >> &index, const size_t vsize, const Float *v) |
Set tensor_COO array from array. More... | |
void | set_ptr (const std::vector< size_t > &shape, const std::vector< std::vector< size_t >> &index, const size_t vsize, const Float v) |
Set tensor_COO array from array. More... | |
void | set_ptr (const std::vector< size_t > &shape, const std::vector< std::vector< size_t >> &index, const std::vector< Float > &v) |
Set tensor_COO array from std::vector. More... | |
void | set_shape (const std::vector< size_t > &shape) |
Set shape. More... | |
void | sort (bool merge) |
sort tensor_COO tensor elements (and merge elements) More... | |
tensor_COO () | |
tensor_COO (const std::initializer_list< size_t > &shape_) | |
Initialize tensor_COO tensor. More... | |
tensor_COO (const std::vector< size_t > &shape_) | |
Initialize tensor_COO tensor. More... | |
tensor_COO (const std::vector< size_t > &shape_, const std::vector< std::vector< size_t >> &index_, const Float *value) | |
Create tensor_COO tensor from n-origin array. More... | |
tensor_COO (const tensor::tensor_Dense< Float > &tens) | |
Create tensor_COO tensor from tensor_Dense tensor. More... | |
tensor_COO (const tensor_COO< Float > &coo) | |
Create tensor_COO tensor from tensor_COO tensor. More... | |
tensor_COO (const tensor_COO< Float > &coo, Float value) | |
Initialize tensor_COO tensor of the same size as input tensor. More... | |
std::string | type () const |
get format name "tensor_COO" More... | |
Public Attributes | |
std::size_t | alloc_nnz = 0 |
alloced matrix size More... | |
std::vector< std::vector< size_t > > | index |
Coodinate format index, which stores index numbers of the non-zero elements (size nnz) More... | |
std::shared_ptr< Float > | val |
Coodinate format value array (pointer), which stores values of the non-zero elements. More... | |
bool | val_create_flag = false |
matrix create flag; More... | |
size_t | val_nnz = 0 |
# of non-zero element More... | |
Private Member Functions | |
void | _q_sort (int lo, int hi) |
Private Attributes | |
bool | gpu_status = false |
true: sended, false: not send More... | |
std::vector< size_t > | shape |
shape More... | |
Definition at line 11 of file monolish_tensor_coo.hpp.
|
inline |
Definition at line 51 of file monolish_tensor_coo.hpp.
|
inline |
Initialize tensor_COO tensor.
shape | shape of tensor |
Definition at line 63 of file monolish_tensor_coo.hpp.
|
inline |
Initialize tensor_COO tensor.
shape | shape of tensor |
Definition at line 76 of file monolish_tensor_coo.hpp.
|
inline |
Create tensor_COO tensor from tensor_Dense tensor.
tens | input tensor_Dense tensor |
Definition at line 99 of file monolish_tensor_coo.hpp.
monolish::tensor::tensor_COO< Float >::tensor_COO | ( | const std::vector< size_t > & | shape_, |
const std::vector< std::vector< size_t >> & | index_, | ||
const Float * | value | ||
) |
Create tensor_COO tensor from n-origin array.
shape_ | shape of tensor |
index_ | n-origin index, which stores the numbers of the non-zero elements (size nnz) |
value | n-origin value, which stores the non-zero elements (size nnz) |
monolish::tensor::tensor_COO< Float >::tensor_COO | ( | const tensor_COO< Float > & | coo | ) |
Create tensor_COO tensor from tensor_COO tensor.
tens | input tensor_COO tensor |
monolish::tensor::tensor_COO< Float >::tensor_COO | ( | const tensor_COO< Float > & | coo, |
Float | value | ||
) |
Initialize tensor_COO tensor of the same size as input tensor.
tens | input tensor_COO tensor |
value | the value to initialize elements |
|
private |
|
inline |
get element A[pos[0]][pos[1]]... (onlu CPU)
pos | std::vector position |
Definition at line 192 of file monolish_tensor_coo.hpp.
Float monolish::tensor::tensor_COO< Float >::at | ( | const std::vector< size_t > & | pos | ) | const |
get element A[pos[0]][pos[1]]...
pos | std::vector position |
|
inline |
returns a begin iterator
Definition at line 353 of file monolish_tensor_coo.hpp.
|
inline |
returns a begin iterator
Definition at line 345 of file monolish_tensor_coo.hpp.
void monolish::tensor::tensor_COO< Float >::convert | ( | const tensor::tensor_Dense< Float > & | tens | ) |
Create tensor_COO tensor from tensor_Dense tensor.
tens | input tensor_Dense tensor |
|
inline |
returns a direct pointer to the tensor
Definition at line 297 of file monolish_tensor_coo.hpp.
|
inline |
returns a direct pointer to the tensor
Definition at line 289 of file monolish_tensor_coo.hpp.
void monolish::tensor::tensor_COO< Float >::diag | ( | vector< Float > & | vec | ) | const |
get diag. vector
vec | diag. vector |
void monolish::tensor::tensor_COO< Float >::diag | ( | view1D< matrix::Dense< Float >, Float > & | vec | ) | const |
void monolish::tensor::tensor_COO< Float >::diag | ( | view1D< tensor::tensor_Dense< Float >, Float > & | vec | ) | const |
void monolish::tensor::tensor_COO< Float >::diag | ( | view1D< vector< Float >, Float > & | vec | ) | const |
|
inline |
returns a end iterator
Definition at line 369 of file monolish_tensor_coo.hpp.
|
inline |
returns a end iterator
Definition at line 361 of file monolish_tensor_coo.hpp.
bool monolish::tensor::tensor_COO< Float >::equal | ( | const tensor_COO< Float > & | tens, |
bool | compare_cpu_and_device = false |
||
) | const |
Comparing tensors (A == tens)
tens | tensor_COO tensor |
compare_cpu_and_device | compare data on both CPU and GPU |
void monolish::tensor::tensor_COO< Float >::fill | ( | Float | value | ) |
fill tensor elements with a scalar value
value | scalar value |
|
inline |
Memory data space required by the matrix.
Definition at line 168 of file monolish_tensor_coo.hpp.
|
inline |
true: sended, false: not send
Definition at line 281 of file monolish_tensor_coo.hpp.
|
inline |
get vector index from aligned index (A[pos[0]][pos[1]]... = A[ind])
pos | position (scalar) |
Definition at line 481 of file monolish_tensor_coo.hpp.
|
inline |
get aligned index from vector index (A[pos] = A[ind[0]][ind[1]]...)
pos | position (std::vector) |
Definition at line 460 of file monolish_tensor_coo.hpp.
|
inline |
get # of non-zeros
Definition at line 256 of file monolish_tensor_coo.hpp.
|
inline |
get shape
Definition at line 247 of file monolish_tensor_coo.hpp.
void monolish::tensor::tensor_COO< Float >::insert | ( | const std::vector< size_t > & | pos, |
const Float | val | ||
) |
insert element A[pos[0]][pos[1]]...
pos | std::vector position |
val | scalar value |
bool monolish::tensor::tensor_COO< Float >::operator!= | ( | const tensor_COO< Float > & | tens | ) | const |
Comparing tensors (A != tens)
tens | tensor_COO tensor |
gpu_status == true
; compare data on GPUvoid monolish::tensor::tensor_COO< Float >::operator= | ( | const tensor_COO< Float > & | tens | ) |
tensor copy
tens | COO tensor |
bool monolish::tensor::tensor_COO< Float >::operator== | ( | const tensor_COO< Float > & | tens | ) | const |
Comparing tensors (A == tens)
tens | tensor_COO tensor |
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 405 of file monolish_tensor_coo.hpp.
void monolish::tensor::tensor_COO< Float >::print_all | ( | bool | force_cpu = false | ) | const |
print all elements to standard I/O
force_cpu | Unused options for integrity |
void monolish::tensor::tensor_COO< Float >::print_all | ( | const std::string | filename | ) | const |
print all elements to file
filename | output filename |
|
inline |
resize tensor value
N | tensor size |
Definition at line 307 of file monolish_tensor_coo.hpp.
void monolish::tensor::tensor_COO< Float >::set_ptr | ( | const std::vector< size_t > & | shape, |
const std::vector< std::vector< size_t >> & | index, | ||
const size_t | vsize, | ||
const Float * | v | ||
) |
Set tensor_COO array from array.
shape | shape of tensor |
indix | index fo tensor |
vsize | size of value |
v | value |
void monolish::tensor::tensor_COO< Float >::set_ptr | ( | const std::vector< size_t > & | shape, |
const std::vector< std::vector< size_t >> & | index, | ||
const size_t | vsize, | ||
const Float | v | ||
) |
Set tensor_COO array from array.
shape | shape of tensor |
indix | index fo tensor |
vsize | size of value |
v | value |
void monolish::tensor::tensor_COO< Float >::set_ptr | ( | const std::vector< size_t > & | shape, |
const std::vector< std::vector< size_t >> & | index, | ||
const std::vector< Float > & | v | ||
) |
Set tensor_COO array from std::vector.
shape | shape of tensor |
indix | index fo tensor |
v | value |
|
inline |
Set shape.
shape | shape of tensor
|
Definition at line 275 of file monolish_tensor_coo.hpp.
void monolish::tensor::tensor_COO< Float >::sort | ( | bool | merge | ) |
sort tensor_COO tensor elements (and merge elements)
merge | need to merge (true or false) |
|
inline |
get format name "tensor_COO"
Definition at line 337 of file monolish_tensor_coo.hpp.
std::size_t monolish::tensor::tensor_COO< Float >::alloc_nnz = 0 |
alloced matrix size
Definition at line 44 of file monolish_tensor_coo.hpp.
|
mutableprivate |
true: sended, false: not send
Definition at line 21 of file monolish_tensor_coo.hpp.
std::vector<std::vector<size_t> > monolish::tensor::tensor_COO< Float >::index |
Coodinate format index, which stores index numbers of the non-zero elements (size nnz)
Definition at line 28 of file monolish_tensor_coo.hpp.
|
private |
shape
Definition at line 16 of file monolish_tensor_coo.hpp.
std::shared_ptr<Float> monolish::tensor::tensor_COO< Float >::val |
Coodinate format value array (pointer), which stores values of the non-zero elements.
Definition at line 34 of file monolish_tensor_coo.hpp.
bool monolish::tensor::tensor_COO< Float >::val_create_flag = false |
matrix create flag;
Definition at line 49 of file monolish_tensor_coo.hpp.
size_t monolish::tensor::tensor_COO< Float >::val_nnz = 0 |
# of non-zero element
Definition at line 39 of file monolish_tensor_coo.hpp.