monolish  0.17.3-dev.16
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 size_t pos)
 get element A[index]... (onlu CPU) More...
 
Float at (const size_t pos) const
 get element A[index]... 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...
 
Float * begin ()
 returns a begin iterator More...
 
const Float * begin () const
 returns a begin iterator 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)
 
Float * end ()
 returns a end iterator More...
 
const Float * end () const
 returns a end iterator More...
 
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...
 
size_t get_alloc_nnz () const
 get # of alloced non-zeros 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...
 
size_t get_first () const
 get first position More...
 
std::shared_ptr< bool > get_gpu_status () const
 gpu status shared pointer 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...
 
size_t get_offset () const
 get first position (same as get_first()) More...
 
std::vector< size_t > get_shape () const
 get shape More...
 
void insert (const size_t pos, const Float Val)
 set element A[index]... 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...
 
void operator= (const view_tensor_Dense< matrix::Dense< Float >, Float > &tens)
 tensor copy More...
 
void operator= (const view_tensor_Dense< tensor::tensor_Dense< Float >, Float > &tens)
 tensor copy More...
 
void operator= (const view_tensor_Dense< vector< Float >, 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_first (size_t i)
 Set # of non-zero elements. 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 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::initializer_list< size_t > &shape)
 Allocate dense tensor. 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...
 
 tensor_Dense (const view_tensor_Dense< matrix::Dense< Float >, Float > &tens)
 Create Dense matrix from view Dense matrix. More...
 
 tensor_Dense (const view_tensor_Dense< tensor::tensor_Dense< Float >, Float > &tens)
 Create Dense matrix from view Dense matrix. More...
 
 tensor_Dense (const view_tensor_Dense< vector< Float >, Float > &tens)
 Create Dense matrix from view Dense matrix. 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

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...
 
std::vector< size_t > shape
 shape More...
 

Detailed Description

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

Definition at line 13 of file monolish_tensor_dense.hpp.

Constructor & Destructor Documentation

◆ tensor_Dense() [1/15]

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

Definition at line 51 of file monolish_tensor_dense.hpp.

◆ tensor_Dense() [2/15]

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/15]

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 95 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ tensor_Dense() [4/15]

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 116 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ tensor_Dense() [5/15]

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 137 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ tensor_Dense() [6/15]

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/15]

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

Allocate dense tensor.

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

◆ tensor_Dense() [8/15]

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() [9/15]

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() [10/15]

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() [11/15]

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() [12/15]

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() [13/15]

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

Create Dense matrix from view Dense matrix.

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

◆ tensor_Dense() [14/15]

template<typename Float >
monolish::tensor::tensor_Dense< Float >::tensor_Dense ( const view_tensor_Dense< matrix::Dense< Float >, Float > &  tens)

Create Dense matrix from view Dense matrix.

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

◆ tensor_Dense() [15/15]

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

Create Dense matrix from view Dense matrix.

Parameters
denseDense format matrix
Note
  • # of computation: M*N
  • Multi-threading: true
  • GPU acceleration: true
    • # of data transfer: M*N (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 601 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ at() [1/8]

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 506 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [2/8]

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 449 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [3/8]

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

get element A[index]... (onlu CPU)

Parameters
posaligned position index
Returns
A[index]...
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 465 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [4/8]

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

get element A[index]...

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

◆ at() [5/8]

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 478 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [6/8]

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

◆ at() [7/8]

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 492 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ at() [8/8]

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 424 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ begin() [1/2]

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

returns a begin iterator

Returns
begin iterator
Note
  • # of computation: 1

Definition at line 699 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ begin() [2/2]

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

returns a begin iterator

Returns
begin iterator
Note
  • # of computation: 1

Definition at line 691 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 623 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 615 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)

◆ end() [1/2]

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

returns a end iterator

Returns
end iterator
Note
  • # of computation: 1

Definition at line 717 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ end() [2/2]

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

returns a end iterator

Returns
end iterator
Note
  • # of computation: 1

Definition at line 707 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:

◆ 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_alloc_nnz()

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

get # of alloced non-zeros

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

Definition at line 328 of file monolish_tensor_dense.hpp.

◆ 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 388 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 584 of file monolish_tensor_dense.hpp.

Here is the caller graph for this function:

◆ get_first()

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

get first position

Returns
first position
Note
  • # of computation: 1

Definition at line 336 of file monolish_tensor_dense.hpp.

Here is the caller graph for this function:

◆ get_gpu_status()

template<typename Float >
std::shared_ptr<bool> monolish::tensor::tensor_Dense< Float >::get_gpu_status ( ) const
inline

gpu status shared pointer

Returns
gpu status shared pointer

Definition at line 590 of file monolish_tensor_dense.hpp.

◆ 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 871 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 850 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 319 of file monolish_tensor_dense.hpp.

Here is the caller graph for this function:

◆ get_offset()

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

get first position (same as get_first())

Returns
first position
Note
  • # of computation: 1

Definition at line 344 of file monolish_tensor_dense.hpp.

Here is the call graph for this function:
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 310 of file monolish_tensor_dense.hpp.

◆ insert() [1/2]

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

set element A[index]...

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

◆ insert() [2/2]

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=() [1/4]

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=() [2/4]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::operator= ( const view_tensor_Dense< matrix::Dense< Float >, 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=() [3/4]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::operator= ( const view_tensor_Dense< tensor::tensor_Dense< Float >, 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=() [4/4]

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::operator= ( const view_tensor_Dense< vector< Float >, 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 795 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 916 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 900 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 633 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 662 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_first()

template<typename Float >
void monolish::tensor::tensor_Dense< Float >::set_first ( size_t  i)
inline

Set # of non-zero elements.

Parameters
NZ# of non-zero elements
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

change first position

Note
  • # of computation: 1

Definition at line 369 of file monolish_tensor_dense.hpp.

◆ set_ptr() [1/3]

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: nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ set_ptr() [2/3]

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: nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ set_ptr() [3/3]

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: nnz
  • 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 353 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 378 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 44 of file monolish_tensor_dense.hpp.

◆ first

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

first position of data array

Definition at line 28 of file monolish_tensor_dense.hpp.

◆ gpu_status

template<typename Float >
std::shared_ptr<bool> monolish::tensor::tensor_Dense< Float >::gpu_status = std::make_shared<bool>(false)
mutableprivate

true: sended, false: not send

Definition at line 23 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 18 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 34 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 49 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 39 of file monolish_tensor_dense.hpp.


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