monolish  0.17.1
MONOlithic LInear equation Solvers for Highly-parallel architecture
Public Member Functions | Public Attributes | Private Attributes | List of all members
monolish::tensor::tensor_Dense< Float > Class Template Reference

#include <monolish_tensor_dense.hpp>

Collaboration diagram for monolish::tensor::tensor_Dense< Float >:
Collaboration graph

Public Member Functions

template<typename... Args>
Float at (const size_t dim, const Args... args)
 get element A[pos[0]][pos[1]]... (onlu CPU) More...
 
template<typename... Args>
Float at (const size_t dim, const Args... args) const
 get element A[pos[0]][pos[1]]... More...
 
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...
 
template<typename... Args>
Float at (const std::vector< size_t > &pos, const Args... args)
 get element A[pos[0]][pos[1]]... (onlu CPU) More...
 
template<typename... Args>
Float at (const std::vector< size_t > &pos, const size_t dim, const Args... args) const
 get element A[pos[0]][pos[1]]... More...
 
void convert (const matrix::Dense< Float > &dense)
 create tensor_Dense tensor from Dense matrix More...
 
void convert (const tensor::tensor_COO< Float > &tens)
 Create tensor_Dense tensor from tensor_COO tensor. More...
 
void convert (const tensor::tensor_Dense< Float > &tens)
 Create tensor_Dense tensor from tensor_Dense tensor. More...
 
void convert (const vector< Float > &vec)
 create tensor_Dense tensor from vector More...
 
Float * data ()
 returns a direct pointer to the tensor More...
 
const Float * data () const
 returns a direct pointer to the tensor More...
 
void device_free () const
 free data on GPU More...
 
void diag_add (const Float alpha)
 Scalar and diag. vector of Dense format matrix add. More...
 
void diag_add (const vector< Float > &vec)
 Vector and diag. vector of Dense format matrix add. More...
 
void diag_add (const view1D< matrix::Dense< Float >, Float > &vec)
 
void diag_add (const view1D< tensor::tensor_Dense< Float >, Float > &vec)
 
void diag_add (const view1D< vector< Float >, Float > &vec)
 
void diag_div (const Float alpha)
 Scalar and diag. vector of Dense format matrix div. More...
 
void diag_div (const vector< Float > &vec)
 Vector and diag. vector of Dense format matrix div. More...
 
void diag_div (const view1D< matrix::Dense< Float >, Float > &vec)
 
void diag_div (const view1D< tensor::tensor_Dense< Float >, Float > &vec)
 
void diag_div (const view1D< vector< Float >, Float > &vec)
 
void diag_mul (const Float alpha)
 Scalar and diag. vector of Dense format matrix mul. More...
 
void diag_mul (const vector< Float > &vec)
 Vector and diag. vector of Dense format matrix mul. More...
 
void diag_mul (const view1D< matrix::Dense< Float >, Float > &vec)
 
void diag_mul (const view1D< tensor::tensor_Dense< Float >, Float > &vec)
 
void diag_mul (const view1D< vector< Float >, Float > &vec)
 
void diag_sub (const Float alpha)
 Scalar and diag. vector of Dense format matrix sub. More...
 
void diag_sub (const vector< Float > &vec)
 Vector and diag. vector of Dense format matrix sub. More...
 
void diag_sub (const view1D< matrix::Dense< Float >, Float > &vec)
 
void diag_sub (const view1D< tensor::tensor_Dense< Float >, Float > &vec)
 
void diag_sub (const view1D< vector< Float >, Float > &vec)
 
bool equal (const tensor_Dense< 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) const
 get vector index from aligned index (A[pos[0]][pos[1]]... = A[ind]) More...
 
size_t get_index (const std::vector< size_t > &pos) const
 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)
 set element A[pos[0]][pos[1]]... More...
 
void move (const matrix::Dense< Float > &dense)
 move tensor_Dense tensor from Dense matrix More...
 
void move (const vector< Float > &vec)
 move tensor_Dense tensor from vector More...
 
void nonfree_recv ()
 recv. data to GPU (w/o free) More...
 
bool operator!= (const tensor_Dense< Float > &tens) const
 Comparing tensors (A != tens) More...
 
void operator= (const tensor_Dense< Float > &tens)
 tensor copy More...
 
bool operator== (const tensor_Dense< 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 recv ()
 recv. data to GPU, and free data on GPU More...
 
template<typename... Args>
void reshape (const int dim, const Args... args)
 Reshape tensor. More...
 
void reshape (const std::vector< int > &shape)
 Reshape tensor. More...
 
template<typename... Args>
void reshape (const std::vector< int > &shape, const size_t dim, const Args... args)
 Reshape tensor. More...
 
void resize (const size_t N, Float Val=0)
 resize tensor value More...
 
void resize (const std::vector< size_t > &shape, Float val=0)
 resize tensor value More...
 
void send () const
 send data to GPU More...
 
void set_ptr (const std::vector< size_t > &shape, const Float *value)
 Set tensor_Dense array from array. More...
 
void set_ptr (const std::vector< size_t > &shape, const std::vector< Float > &value)
 Set tensor_Dense array from std::vector. More...
 
void set_shape (const std::vector< size_t > &shape)
 Set shape. More...
 
 tensor_Dense ()
 
 tensor_Dense (const matrix::Dense< Float > &dense)
 Create tensor_Dense tensor from Dense matrix. More...
 
 tensor_Dense (const std::vector< size_t > &shape)
 Allocate dense tensor. More...
 
 tensor_Dense (const std::vector< size_t > &shape, const Float *value)
 Allocate dense tensor. More...
 
 tensor_Dense (const std::vector< size_t > &shape, const Float min, const Float max)
 Allocate tensor_Dense tensor. More...
 
 tensor_Dense (const std::vector< size_t > &shape, const Float min, const Float max, const std::uint32_t seed)
 Allocate tensor_Dense tensor. More...
 
 tensor_Dense (const std::vector< size_t > &shape, const std::vector< Float > &value)
 Allocate tensor_Dense tensor. More...
 
 tensor_Dense (const tensor::tensor_COO< Float > &tens)
 Create tensor_Dense tensor from tensor_COO tensor. More...
 
 tensor_Dense (const tensor::tensor_Dense< Float > &tens)
 Create tensor_Dense tensor from tensor_Dense tensor. More...
 
 tensor_Dense (const tensor_Dense< Float > &tens, Float value)
 Create tensor_Dense tensor of the same size as input tensor. More...
 
 tensor_Dense (const vector< Float > &vec)
 create tensor_Dense tensor from vector More...
 
std::string type () const
 get format name "tensor_Dense" More...
 
 ~tensor_Dense ()
 destructor of dense tensor, free GPU memory More...
 

Public Attributes

size_t alloc_nnz = 0
 allocated tensor size More...
 
std::shared_ptr< Float > val
 Dense tensor format value (pointer) More...
 
bool val_create_flag = false
 tensor create flag More...
 
size_t val_nnz = 0
 # of non-zero element (M * N) More...
 

Private Attributes

bool gpu_status = false
 true: sended, false: not send More...
 
std::vector< size_t > shape
 shape More...
 

Detailed Description

template<typename Float>
class monolish::tensor::tensor_Dense< Float >

Definition at line 11 of file monolish_tensor_dense.hpp.

Constructor & Destructor Documentation

◆ tensor_Dense() [1/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( )
inline

Definition at line 44 of file monolish_tensor_dense.hpp.

◆ tensor_Dense() [2/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const tensor::tensor_Dense< Float > &  tens)

Create tensor_Dense tensor from tensor_Dense tensor.

Parameters
tenstensor_Dense format tensor
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: size (only allocation)
      • if dense.gpu_status == true; coping data on CPU and GPU respectively
      • else; coping data only on CPU

◆ tensor_Dense() [3/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const tensor::tensor_COO< Float > &  tens)
inline

Create tensor_Dense tensor from tensor_COO tensor.

Parameters
tensinput tensor_COO tensor
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: false

Definition at line 88 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ tensor_Dense() [4/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const matrix::Dense< Float > &  dense)
inline

Create tensor_Dense tensor from Dense matrix.

Parameters
denseinput Dense matrix (size M x N)
  • # of computation: M*N
  • Multi-threading: true
  • GPU acceleration: false

Definition at line 109 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ tensor_Dense() [5/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const vector< Float > &  vec)
inline

create tensor_Dense tensor from vector

Parameters
vecinput vector (size M)
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: false

Definition at line 130 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ tensor_Dense() [6/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const std::vector< size_t > &  shape)

Allocate dense tensor.

Parameters
shapeshape of tensor
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ tensor_Dense() [7/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const std::vector< size_t > &  shape,
const Float *  value 
)

Allocate dense tensor.

Parameters
shapeshape of tensor
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ tensor_Dense() [8/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const std::vector< size_t > &  shape,
const std::vector< Float > &  value 
)

Allocate tensor_Dense tensor.

Parameters
shapeshape of tensor
valuevalue std::vector
Note
  • # of computation: size
  • Multi-threading: false
  • GPU acceleration: false

◆ tensor_Dense() [9/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const std::vector< size_t > &  shape,
const Float  min,
const Float  max 
)

Allocate tensor_Dense tensor.

Parameters
shapeshape of tensor
minrand min
maxrand max
Note
  • # of computation: size
  • Multi-threading: false
  • GPU acceleration: false

◆ tensor_Dense() [10/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const std::vector< size_t > &  shape,
const Float  min,
const Float  max,
const std::uint32_t  seed 
)

Allocate tensor_Dense tensor.

Parameters
shapeshape of tensor
minrand min
maxrand max
seedrandom seed
Note
  • # of computation: size
  • Multi-threading: false
  • GPU acceleration: false

◆ tensor_Dense() [11/11]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const tensor_Dense< Float > &  tens,
Float  value 
)

Create tensor_Dense tensor of the same size as input tensor.

Parameters
tensinput tensor_Dense tensor
valuethe value to initialize elements
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: size (only allocation)
      • if dense.gpu_status == true; coping data on CPU and GPU respectively
      • else; coping data only on CPU

◆ ~tensor_Dense()

template<typename Float >
monolish::tensor::tensor_Dense< Float >::~tensor_Dense ( )
inline

destructor of dense tensor, free GPU memory

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: 0

Definition at line 437 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ at() [1/6]

template<typename Float >
template<typename... Args>
Float monolish::tensor::tensor_Dense< Float >::at ( const size_t  dim,
const Args...  args 
)
inline

get element A[pos[0]][pos[1]]... (onlu CPU)

Parameters
posstd::vector position
Returns
A[pos[0]][pos[1]]...
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 361 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [2/6]

template<typename Float >
template<typename... Args>
Float monolish::tensor::tensor_Dense< Float >::at ( const size_t  dim,
const Args...  args 
) const
inline

get element A[pos[0]][pos[1]]...

Parameters
posstd::vector position
Returns
A[pos[0]][pos[1]]...
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 318 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [3/6]

template<typename Float >
Float monolish::tensor::tensor_Dense< Float >::at ( const std::vector< size_t > &  pos)
inline

get element A[pos[0]][pos[1]]... (onlu CPU)

Parameters
posstd::vector position
Returns
A[pos[0]][pos[1]]...
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 333 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [4/6]

template<typename Float >
Float monolish::tensor::tensor_Dense< Float >::at ( const std::vector< size_t > &  pos) const

get element A[pos[0]][pos[1]]...

Parameters
posstd::vector position
Returns
A[pos[0]][pos[1]]...
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ at() [5/6]

template<typename Float >
template<typename... Args>
Float monolish::tensor::tensor_Dense< Float >::at ( const std::vector< size_t > &  pos,
const Args...  args 
)
inline

get element A[pos[0]][pos[1]]... (onlu CPU)

Parameters
posstd::vector position
Returns
A[pos[0]][pos[1]]...
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 347 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [6/6]

template<typename Float >
template<typename... Args>
Float monolish::tensor::tensor_Dense< Float >::at ( const std::vector< size_t > &  pos,
const size_t  dim,
const Args...  args 
) const
inline

get element A[pos[0]][pos[1]]...

Parameters
posstd::vector position
Returns
A[pos[0]][pos[1]]...
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 301 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ convert() [1/4]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::convert ( const matrix::Dense< Float > &  dense)

create tensor_Dense tensor from Dense matrix

Parameters
denseinput Dense matrix (size M x N)
  • # of computation: M*N
  • Multi-threading: true
  • GPU acceleration: false

◆ convert() [2/4]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::convert ( const tensor::tensor_COO< Float > &  tens)

Create tensor_Dense tensor from tensor_COO tensor.

Parameters
tensinput tensor_Dense tensor
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: false

◆ convert() [3/4]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::convert ( const tensor::tensor_Dense< Float > &  tens)

Create tensor_Dense tensor from tensor_Dense tensor.

Parameters
tensinput tensor_Dense tensor
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: false
Here is the caller graph for this function:

◆ convert() [4/4]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::convert ( const vector< Float > &  vec)

create tensor_Dense tensor from vector

Parameters
vecinput vector (size M)
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: false

◆ data() [1/2]

template<typename Float >
Float* monolish::tensor::tensor_Dense< Float >::data ( )
inline

returns a direct pointer to the tensor

Returns
A pointer to the first element
Note
  • # of computation: 1

Definition at line 459 of file monolish_tensor_dense.hpp.

◆ data() [2/2]

template<typename Float >
const Float* monolish::tensor::tensor_Dense< Float >::data ( ) const
inline

returns a direct pointer to the tensor

Returns
A const pointer to the first element
Note
  • # of computation: 1

Definition at line 451 of file monolish_tensor_dense.hpp.

Here is the caller graph for this function:

◆ device_free()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::device_free ( ) const

free data on GPU

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: 0
Here is the caller graph for this function:

◆ diag_add() [1/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_add ( const Float  alpha)

Scalar and diag. vector of Dense format matrix add.

Parameters
alphascalar
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_add() [2/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_add ( const vector< Float > &  vec)

Vector and diag. vector of Dense format matrix add.

Parameters
vecvector
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_add() [3/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_add ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_add() [4/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_add ( const view1D< tensor::tensor_Dense< Float >, Float > &  vec)

◆ diag_add() [5/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_add ( const view1D< vector< Float >, Float > &  vec)

◆ diag_div() [1/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_div ( const Float  alpha)

Scalar and diag. vector of Dense format matrix div.

Parameters
alphascalar
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_div() [2/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_div ( const vector< Float > &  vec)

Vector and diag. vector of Dense format matrix div.

Parameters
vecvector
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_div() [3/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_div ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_div() [4/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_div ( const view1D< tensor::tensor_Dense< Float >, Float > &  vec)

◆ diag_div() [5/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_div ( const view1D< vector< Float >, Float > &  vec)

◆ diag_mul() [1/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_mul ( const Float  alpha)

Scalar and diag. vector of Dense format matrix mul.

Parameters
alphascalar
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_mul() [2/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_mul ( const vector< Float > &  vec)

Vector and diag. vector of Dense format matrix mul.

Parameters
vecvector
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_mul() [3/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_mul ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_mul() [4/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_mul ( const view1D< tensor::tensor_Dense< Float >, Float > &  vec)

◆ diag_mul() [5/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_mul ( const view1D< vector< Float >, Float > &  vec)

◆ diag_sub() [1/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_sub ( const Float  alpha)

Scalar and diag. vector of Dense format matrix sub.

Parameters
alphascalar
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_sub() [2/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_sub ( const vector< Float > &  vec)

Vector and diag. vector of Dense format matrix sub.

Parameters
vecvector
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag_sub() [3/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_sub ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_sub() [4/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_sub ( const view1D< tensor::tensor_Dense< Float >, Float > &  vec)

◆ diag_sub() [5/5]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::diag_sub ( const view1D< vector< Float >, Float > &  vec)

◆ equal()

template<typename Float >
bool monolish::tensor::tensor_Dense< Float >::equal ( const tensor_Dense< Float > &  tens,
bool  compare_cpu_and_device = false 
) const

Comparing tensors (A == tens)

Parameters
tenstensor_Dense tensor
compare_cpu_and_devicecompare data on both CPU and GPU
Returns
true or false
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: true

◆ fill()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::fill ( Float  value)

fill tensor elements with a scalar value

Parameters
valuescalar value
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: true

◆ get_data_size()

template<typename Float >
double monolish::tensor::tensor_Dense< Float >::get_data_size ( ) const
inline

Memory data space required by the matrix.

Note
  • # of computation: 3
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 276 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ get_device_mem_stat()

template<typename Float >
bool monolish::tensor::tensor_Dense< Float >::get_device_mem_stat ( ) const
inline

true: sended, false: not send

Returns
gpu status

Definition at line 428 of file monolish_tensor_dense.hpp.

Here is the caller graph for this function:

◆ get_index() [1/2]

template<typename Float >
std::vector<size_t> monolish::tensor::tensor_Dense< Float >::get_index ( const size_t  pos) const
inline

get vector index from aligned index (A[pos[0]][pos[1]]... = A[ind])

Parameters
posposition (scalar)
Returns
vector position
Note
  • # of computation: shape size
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 630 of file monolish_tensor_dense.hpp.

◆ get_index() [2/2]

template<typename Float >
size_t monolish::tensor::tensor_Dense< Float >::get_index ( const std::vector< size_t > &  pos) const
inline

get aligned index from vector index (A[pos] = A[ind[0]][ind[1]]...)

Parameters
posposition (std::vector)
Returns
aligned position
Note
  • # of computation: shape size
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 609 of file monolish_tensor_dense.hpp.

◆ get_nnz()

template<typename Float >
size_t monolish::tensor::tensor_Dense< Float >::get_nnz ( ) const
inline

get # of non-zeros

Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 248 of file monolish_tensor_dense.hpp.

Here is the caller graph for this function:

◆ get_shape()

template<typename Float >
std::vector<size_t> monolish::tensor::tensor_Dense< Float >::get_shape ( ) const
inline

get shape

Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 239 of file monolish_tensor_dense.hpp.

◆ insert()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::insert ( const std::vector< size_t > &  pos,
const Float  Val 
)

set element A[pos[0]][pos[1]]...

Parameters
posstd::vector position
Valscalar value
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

◆ move() [1/2]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::move ( const matrix::Dense< Float > &  dense)

move tensor_Dense tensor from Dense matrix

Parameters
denseinput Dense matrix (size M x N)
  • # of computation: 1

◆ move() [2/2]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::move ( const vector< Float > &  vec)

move tensor_Dense tensor from vector

Parameters
vecinput vector (size M)
  • # of computation: 1

◆ nonfree_recv()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::nonfree_recv ( )

recv. data to GPU (w/o free)

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: size

◆ operator!=()

template<typename Float >
bool monolish::tensor::tensor_Dense< Float >::operator!= ( const tensor_Dense< Float > &  tens) const

Comparing tensors (A != tens)

Parameters
tenstensor_Dense tensor
Returns
true or false
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator=()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::operator= ( const tensor_Dense< Float > &  tens)

tensor copy

Parameters
tensDense tensor
Returns
copied dense tensor
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: 0
      • if gpu_statius == true; coping data on CPU
      • else; coping data on CPU

◆ operator==()

template<typename Float >
bool monolish::tensor::tensor_Dense< Float >::operator== ( const tensor_Dense< Float > &  tens) const

Comparing tensors (A == tens)

Parameters
tenstensor_Dense tensor
Returns
true or false
Note
  • # of computation: size
  • Multi-threading: true
  • GPU acceleration: true
    • if gpu_status == true; compare data on GPU
    • else; compare data on CPU

◆ operator[]()

template<typename Float >
Float& monolish::tensor::tensor_Dense< Float >::operator[] ( size_t  i)
inline

reference to the element at position (v[i])

Parameters
iPosition of an element in the vector
Returns
vector element (v[i])
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 554 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ print_all()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::print_all ( bool  force_cpu = false) const

print all elements to standard I/O

Parameters
force_cpuIgnore device status and output CPU data
Note
  • # of computation: size
  • Multi-threading: false
  • GPU acceleration: false

◆ recv()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::recv ( )

recv. data to GPU, and free data on GPU

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: size

◆ reshape() [1/3]

template<typename Float >
template<typename... Args>
void monolish::tensor::tensor_Dense< Float >::reshape ( const int  dim,
const Args...  args 
)
inline

Reshape tensor.

Parameters
shape
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 675 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ reshape() [2/3]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::reshape ( const std::vector< int > &  shape)

Reshape tensor.

Parameters
shape
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ reshape() [3/3]

template<typename Float >
template<typename... Args>
void monolish::tensor::tensor_Dense< Float >::reshape ( const std::vector< int > &  shape,
const size_t  dim,
const Args...  args 
)
inline

Reshape tensor.

Parameters
shape
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 659 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ resize() [1/2]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::resize ( const size_t  N,
Float  Val = 0 
)
inline

resize tensor value

Parameters
Ntensor size
Note
  • # of computation: N
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 469 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize() [2/2]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::resize ( const std::vector< size_t > &  shape,
Float  val = 0 
)
inline

resize tensor value

Parameters
shapetensor shape
Note
  • # of computation: size
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 498 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ send()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::send ( ) const

send data to GPU

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: size

◆ set_ptr() [1/2]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::set_ptr ( const std::vector< size_t > &  shape,
const Float *  value 
)

Set tensor_Dense array from array.

Parameters
shapeshape of tensor
valuevalue (size nnz)
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

◆ set_ptr() [2/2]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::set_ptr ( const std::vector< size_t > &  shape,
const std::vector< Float > &  value 
)

Set tensor_Dense array from std::vector.

Parameters
shapeshape of tensor
valuevalue (size nnz)
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

◆ set_shape()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::set_shape ( const std::vector< size_t > &  shape)
inline

Set shape.

Parameters
shapeshape of tensor
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 257 of file monolish_tensor_dense.hpp.

◆ type()

template<typename Float >
std::string monolish::tensor::tensor_Dense< Float >::type ( ) const
inline

get format name "tensor_Dense"

Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 266 of file monolish_tensor_dense.hpp.

Member Data Documentation

◆ alloc_nnz

template<typename Float >
size_t monolish::tensor::tensor_Dense< Float >::alloc_nnz = 0

allocated tensor size

Definition at line 37 of file monolish_tensor_dense.hpp.

◆ gpu_status

template<typename Float >
bool monolish::tensor::tensor_Dense< Float >::gpu_status = false
mutableprivate

true: sended, false: not send

Definition at line 21 of file monolish_tensor_dense.hpp.

◆ shape

template<typename Float >
std::vector<size_t> monolish::tensor::tensor_Dense< Float >::shape
private

shape

Definition at line 16 of file monolish_tensor_dense.hpp.

◆ val

template<typename Float >
std::shared_ptr<Float> monolish::tensor::tensor_Dense< Float >::val

Dense tensor format value (pointer)

Definition at line 27 of file monolish_tensor_dense.hpp.

◆ val_create_flag

template<typename Float >
bool monolish::tensor::tensor_Dense< Float >::val_create_flag = false

tensor create flag

Definition at line 42 of file monolish_tensor_dense.hpp.

◆ val_nnz

template<typename Float >
size_t monolish::tensor::tensor_Dense< Float >::val_nnz = 0

# of non-zero element (M * N)

Definition at line 32 of file monolish_tensor_dense.hpp.


The documentation for this class was generated from the following files: