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

Dense format Matrix. More...

#include <monolish_dense.hpp>

Collaboration diagram for monolish::matrix::Dense< Float >:
Collaboration graph

Public Member Functions

Float at (const size_t i, const size_t j)
 get element A[i][j] (only CPU) More...
 
Float at (const size_t i, const size_t j) const
 get element A[i][j] More...
 
void col (const size_t c, vector< Float > &vec) const
 get column vector More...
 
void col (const size_t c, view1D< matrix::Dense< Float >, Float > &vec) const
 
void col (const size_t c, view1D< tensor::tensor_Dense< Float >, Float > &vec) const
 
void col (const size_t c, view1D< vector< Float >, Float > &vec) const
 
void convert (const COO< Float > &coo)
 Create Dense matrix from COO matrix. More...
 
void convert (const Dense< Float > &dense)
 Create Dense matrix from Dense matrix. More...
 
Float * data ()
 returns a direct pointer to the matrix More...
 
const Float * data () const
 returns a direct pointer to the matrix More...
 
 Dense ()
 
 Dense (const COO< Float > &coo)
 Create dense matrix from COO matrix. More...
 
 Dense (const Dense< Float > &dense)
 Create Dense matrix from Dense matrix. More...
 
 Dense (const Dense< Float > &dense, Float value)
 Create Dense matrix of the same size as input matrix. More...
 
 Dense (const size_t M, const size_t N)
 Allocate dense matrix. More...
 
 Dense (const size_t M, const size_t N, const Float *value)
 Create dense matrix from array. More...
 
 Dense (const size_t M, const size_t N, const Float min, const Float max)
 Create random dense matrix from dense matrix. More...
 
 Dense (const size_t M, const size_t N, const Float min, const Float max, const std::uint32_t seed)
 Create random dense matrix from dense matrix. More...
 
 Dense (const size_t M, const size_t N, const Float value)
 Create construct dense matrix. More...
 
 Dense (const size_t M, const size_t N, const std::initializer_list< Float > &list)
 Create dense matrix from std::initializer_list. More...
 
 Dense (const size_t M, const size_t N, const std::vector< Float > &value)
 Create dense matrix from std::vector. More...
 
 Dense (const size_t M, const size_t N, const vector< Float > &value)
 Create dense matrix from monolish::vector. More...
 
void device_free () const
 free data on GPU 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
 
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 Dense< Float > &mat, bool compare_cpu_and_device=false) const
 Comparing matrices (A == mat) More...
 
void fill (Float value)
 fill matrix elements with a scalar value More...
 
size_t get_col () const
 get # of col 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_nnz () const
 get # of non-zeros More...
 
size_t get_row () const
 get # of row More...
 
void insert (const size_t i, const size_t j, const Float Val)
 set element A[i][j] More...
 
void move (const tensor::tensor_Dense< Float > &tensor_dense)
 
void move (const tensor::tensor_Dense< Float > &tensor_dense, int rowN, int colN)
 
void nonfree_recv ()
 recv. data to GPU (w/o free) More...
 
bool operator!= (const Dense< Float > &mat) const
 Comparing matrices (A != mat) More...
 
void operator= (const Dense< Float > &mat)
 matrix copy More...
 
bool operator== (const Dense< Float > &mat) const
 Comparing matrices (A == mat) 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...
 
void reshape (const size_t row, const size_t col)
 Reshape matrix. More...
 
void resize (size_t N, Float Val=0)
 resize matrix value More...
 
void row (const size_t r, vector< Float > &vec) const
 get row vector More...
 
void row (const size_t r, view1D< matrix::Dense< Float >, Float > &vec) const
 
void row (const size_t r, view1D< tensor::tensor_Dense< Float >, Float > &vec) const
 
void row (const size_t r, view1D< vector< Float >, Float > &vec) const
 
void send () const
 send data to GPU More...
 
void set_col (const size_t M)
 Set column number. More...
 
void set_ptr (const size_t M, const size_t N, const Float *value)
 Set Dense array from std::vector. More...
 
void set_ptr (const size_t M, const size_t N, const std::vector< Float > &value)
 Set Dense array from std::vector. More...
 
void set_row (const size_t N)
 Set row number. More...
 
void transpose ()
 get transposed matrix (A = A^T) More...
 
void transpose (const Dense &B)
 create transposed matrix from Dense format matrix (A = B^T) More...
 
std::string type () const
 Set # of non-zero elements. More...
 
 ~Dense ()
 destructor of Dense matrix, free GPU memory More...
 

Public Attributes

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

Private Attributes

size_t colN
 # of col More...
 
bool gpu_status = false
 # of non-zero element (M * N) More...
 
size_t rowN
 # of row More...
 

Detailed Description

template<typename Float>
class monolish::matrix::Dense< Float >

Dense format Matrix.

Note
  • Multi-threading: true
  • GPU acceleration: true

Definition at line 21 of file monolish_dense.hpp.

Constructor & Destructor Documentation

◆ Dense() [1/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( )
inline

Definition at line 64 of file monolish_dense.hpp.

◆ Dense() [2/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const COO< Float > &  coo)
inline

Create dense matrix from COO matrix.

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

Definition at line 94 of file monolish_dense.hpp.

Here is the call graph for this function:

◆ Dense() [3/12]

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

Create Dense matrix from 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

◆ Dense() [4/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const Dense< Float > &  dense,
Float  value 
)

Create Dense matrix of the same size as input matrix.

Parameters
denseinput Dense matrix
valuethe value to initialize elements
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

◆ Dense() [5/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N 
)

Allocate dense matrix.

Parameters
M# of row
N# of col
Note
  • # of computation: M*N
  • Multi-threading: false
  • GPU acceleration: false

◆ Dense() [6/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N,
const Float *  value 
)

Create dense matrix from array.

Parameters
M# of row
N# of col
valuevalue array
Note
  • # of computation: M*N
  • Multi-threading: false
  • GPU acceleration: false

◆ Dense() [7/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N,
const std::vector< Float > &  value 
)

Create dense matrix from std::vector.

Parameters
M# of row
N# of col
valuevalue std::vector (size M x N)
Note
  • # of computation: M*N
  • Multi-threading: false
  • GPU acceleration: false

◆ Dense() [8/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N,
const vector< Float > &  value 
)

Create dense matrix from monolish::vector.

Parameters
M# of row
N# of col
valuevalue std::vector (size M x N)
Note
  • # of computation: M*N
  • Multi-threading: false
  • GPU acceleration: true

◆ Dense() [9/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N,
const std::initializer_list< Float > &  list 
)

Create dense matrix from std::initializer_list.

Parameters
M# of row
N# of col
listvalue std::initializer_list (size M x N)
Note
  • # of computation: M*N
  • Multi-threading: false
  • GPU acceleration: false

◆ Dense() [10/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N,
const Float  min,
const Float  max 
)

Create random dense matrix from dense matrix.

Parameters
M# of row
N# of col
minrand min
maxrand max
Note
The ramdom number generator is random generator is mt19937
  • # of computation: M*N
  • Multi-threading: true
  • GPU acceleration: false

◆ Dense() [11/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N,
const Float  min,
const Float  max,
const std::uint32_t  seed 
)

Create random dense matrix from dense matrix.

Parameters
M# of row
N# of col
minrand min
maxrand max
seedrandom seed
Note
  • # of computation: M*N
  • Multi-threading: false
  • GPU acceleration: false

◆ Dense() [12/12]

template<typename Float >
monolish::matrix::Dense< Float >::Dense ( const size_t  M,
const size_t  N,
const Float  value 
)

Create construct dense matrix.

Parameters
M# of row
N# of col
valuevalue
Note
  • # of computation: M*N
  • Multi-threading: true
  • GPU acceleration: false

◆ ~Dense()

template<typename Float >
monolish::matrix::Dense< Float >::~Dense ( )
inline

destructor of Dense matrix, free GPU memory

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

Definition at line 448 of file monolish_dense.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ at() [1/2]

template<typename Float >
Float monolish::matrix::Dense< Float >::at ( const size_t  i,
const size_t  j 
)
inline

get element A[i][j] (only CPU)

Parameters
irow
jcol
Returns
A[i][j]
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 371 of file monolish_dense.hpp.

Here is the call graph for this function:

◆ at() [2/2]

template<typename Float >
Float monolish::matrix::Dense< Float >::at ( const size_t  i,
const size_t  j 
) const

get element A[i][j]

Parameters
irow
jcol
Returns
A[i][j]
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ col() [1/4]

template<typename Float >
void monolish::matrix::Dense< Float >::col ( const size_t  c,
vector< Float > &  vec 
) const

get column vector

Parameters
ccolumn number
veccolumn vector
Note
  • # of computation: about nnz
  • Multi-threading: true
  • GPU acceleration: true

◆ col() [2/4]

template<typename Float >
void monolish::matrix::Dense< Float >::col ( const size_t  c,
view1D< matrix::Dense< Float >, Float > &  vec 
) const

◆ col() [3/4]

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

◆ col() [4/4]

template<typename Float >
void monolish::matrix::Dense< Float >::col ( const size_t  c,
view1D< vector< Float >, Float > &  vec 
) const

◆ convert() [1/2]

template<typename Float >
void monolish::matrix::Dense< Float >::convert ( const COO< Float > &  coo)

Create Dense matrix from COO matrix.

Parameters
cooinput COO matrix (size M x N)
Note
  • # of computation: M*N + nnz
  • Multi-threading: true
  • GPU acceleration: false
Here is the caller graph for this function:

◆ convert() [2/2]

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

Create Dense matrix from Dense matrix.

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

◆ data() [1/2]

template<typename Float >
Float* monolish::matrix::Dense< Float >::data ( )
inline

returns a direct pointer to the matrix

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

Definition at line 470 of file monolish_dense.hpp.

◆ data() [2/2]

template<typename Float >
const Float* monolish::matrix::Dense< Float >::data ( ) const
inline

returns a direct pointer to the matrix

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

Definition at line 462 of file monolish_dense.hpp.

Here is the caller graph for this function:

◆ device_free()

template<typename Float >
void monolish::matrix::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() [1/4]

template<typename Float >
void monolish::matrix::Dense< Float >::diag ( vector< Float > &  vec) const

get diag. vector

Parameters
vecdiag. vector
Note
  • # of computation: M
  • Multi-threading: true
  • GPU acceleration: true

◆ diag() [2/4]

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

◆ diag() [3/4]

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

◆ diag() [4/4]

template<typename Float >
void monolish::matrix::Dense< Float >::diag ( view1D< vector< Float >, Float > &  vec) const

◆ diag_add() [1/5]

template<typename Float >
void monolish::matrix::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::matrix::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::matrix::Dense< Float >::diag_add ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_add() [4/5]

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

◆ diag_add() [5/5]

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

◆ diag_div() [1/5]

template<typename Float >
void monolish::matrix::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::matrix::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::matrix::Dense< Float >::diag_div ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_div() [4/5]

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

◆ diag_div() [5/5]

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

◆ diag_mul() [1/5]

template<typename Float >
void monolish::matrix::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::matrix::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::matrix::Dense< Float >::diag_mul ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_mul() [4/5]

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

◆ diag_mul() [5/5]

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

◆ diag_sub() [1/5]

template<typename Float >
void monolish::matrix::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::matrix::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::matrix::Dense< Float >::diag_sub ( const view1D< matrix::Dense< Float >, Float > &  vec)

◆ diag_sub() [4/5]

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

◆ diag_sub() [5/5]

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

◆ equal()

template<typename Float >
bool monolish::matrix::Dense< Float >::equal ( const Dense< Float > &  mat,
bool  compare_cpu_and_device = false 
) const

Comparing matrices (A == mat)

Parameters
matDense matrix
compare_cpu_and_devicecompare data on both CPU and GPU
Returns
true or false
Note
  • # of computation: M*N
  • Multi-threading: true
  • GPU acceleration: true

◆ fill()

template<typename Float >
void monolish::matrix::Dense< Float >::fill ( Float  value)

fill matrix elements with a scalar value

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

◆ get_col()

template<typename Float >
size_t monolish::matrix::Dense< Float >::get_col ( ) const
inline

get # of col

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

Definition at line 269 of file monolish_dense.hpp.

Here is the caller graph for this function:

◆ get_data_size()

template<typename Float >
double monolish::matrix::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 345 of file monolish_dense.hpp.

Here is the call graph for this function:

◆ get_device_mem_stat()

template<typename Float >
bool monolish::matrix::Dense< Float >::get_device_mem_stat ( ) const
inline

true: sended, false: not send

Returns
gpu status

Definition at line 439 of file monolish_dense.hpp.

Here is the caller graph for this function:

◆ get_nnz()

template<typename Float >
size_t monolish::matrix::Dense< Float >::get_nnz ( ) const
inline

get # of non-zeros

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

Definition at line 278 of file monolish_dense.hpp.

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

◆ get_row()

template<typename Float >
size_t monolish::matrix::Dense< Float >::get_row ( ) const
inline

get # of row

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

Definition at line 260 of file monolish_dense.hpp.

Here is the caller graph for this function:

◆ insert()

template<typename Float >
void monolish::matrix::Dense< Float >::insert ( const size_t  i,
const size_t  j,
const Float  Val 
)

set element A[i][j]

Parameters
irow
jcol
Valscalar value
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

◆ move() [1/2]

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

◆ move() [2/2]

template<typename Float >
void monolish::matrix::Dense< Float >::move ( const tensor::tensor_Dense< Float > &  tensor_dense,
int  rowN,
int  colN 
)

◆ nonfree_recv()

template<typename Float >
void monolish::matrix::Dense< Float >::nonfree_recv ( )

recv. data to GPU (w/o free)

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: M*N

◆ operator!=()

template<typename Float >
bool monolish::matrix::Dense< Float >::operator!= ( const Dense< Float > &  mat) const

Comparing matrices (A != mat)

Parameters
matDense matrix
Returns
true or false
Note
  • # of computation: M*N
  • 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::matrix::Dense< Float >::operator= ( const Dense< Float > &  mat)

matrix copy

Parameters
matDense matrix
Returns
copied dense matrix
Note
  • # of computation: M*N
  • 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::matrix::Dense< Float >::operator== ( const Dense< Float > &  mat) const

Comparing matrices (A == mat)

Parameters
matDense matrix
Returns
true or false
Note
  • # of computation: M*N
  • 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::matrix::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 585 of file monolish_dense.hpp.

Here is the call graph for this function:

◆ print_all()

template<typename Float >
void monolish::matrix::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: M*N
  • Multi-threading: false
  • GPU acceleration: false

◆ recv()

template<typename Float >
void monolish::matrix::Dense< Float >::recv ( )

recv. data to GPU, and free data on GPU

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: M*N

◆ reshape()

template<typename Float >
void monolish::matrix::Dense< Float >::reshape ( const size_t  row,
const size_t  col 
)

Reshape matrix.

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

◆ resize()

template<typename Float >
void monolish::matrix::Dense< Float >::resize ( size_t  N,
Float  Val = 0 
)
inline

resize matrix value

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

Definition at line 480 of file monolish_dense.hpp.

Here is the call graph for this function:

◆ row() [1/4]

template<typename Float >
void monolish::matrix::Dense< Float >::row ( const size_t  r,
vector< Float > &  vec 
) const

get row vector

Parameters
rrow number
vecrow vector
Note
  • # of computation: about nnz / M
  • Multi-threading: true
  • GPU acceleration: true

◆ row() [2/4]

template<typename Float >
void monolish::matrix::Dense< Float >::row ( const size_t  r,
view1D< matrix::Dense< Float >, Float > &  vec 
) const

◆ row() [3/4]

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

◆ row() [4/4]

template<typename Float >
void monolish::matrix::Dense< Float >::row ( const size_t  r,
view1D< vector< Float >, Float > &  vec 
) const

◆ send()

template<typename Float >
void monolish::matrix::Dense< Float >::send ( ) const

send data to GPU

Note
  • Multi-threading: false
  • GPU acceleration: true
    • # of data transfer: M*N

◆ set_col()

template<typename Float >
void monolish::matrix::Dense< Float >::set_col ( const size_t  M)
inline

Set column number.

Parameters
M# of col
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 296 of file monolish_dense.hpp.

◆ set_ptr() [1/2]

template<typename Float >
void monolish::matrix::Dense< Float >::set_ptr ( const size_t  M,
const size_t  N,
const Float *  value 
)

Set Dense array from std::vector.

Parameters
M# of row
N# of col
valuevalue (size nnz)
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

◆ set_ptr() [2/2]

template<typename Float >
void monolish::matrix::Dense< Float >::set_ptr ( const size_t  M,
const size_t  N,
const std::vector< Float > &  value 
)

Set Dense array from std::vector.

Parameters
M# of row
N# of col
valuevalue (size nnz)
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

◆ set_row()

template<typename Float >
void monolish::matrix::Dense< Float >::set_row ( const size_t  N)
inline

Set row number.

Parameters
N# of row
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 287 of file monolish_dense.hpp.

◆ transpose() [1/2]

template<typename Float >
void monolish::matrix::Dense< Float >::transpose ( )

get transposed matrix (A = A^T)

Note
  • # of computation: M*N/2-M (square) or M*N (non-square)
  • Multi-threading: yes
  • GPU acceleration: false
  • If matrix is non-square, This function need MxN temporary matrix.
  • This function transposes in place, it's performance is lower than A.transpose(B).

◆ transpose() [2/2]

template<typename Float >
void monolish::matrix::Dense< Float >::transpose ( const Dense< Float > &  B)

create transposed matrix from Dense format matrix (A = B^T)

Parameters
BDense format matrix
Note
  • # of computation: M*N
  • Multi-threading: yes
  • GPU acceleration: false

◆ type()

template<typename Float >
std::string monolish::matrix::Dense< Float >::type ( ) const
inline

Set # of non-zero elements.

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

get format name "Dense"

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

Definition at line 314 of file monolish_dense.hpp.

Member Data Documentation

◆ alloc_nnz

template<typename Float >
std::size_t monolish::matrix::Dense< Float >::alloc_nnz = 0

alloced matrix size

Definition at line 57 of file monolish_dense.hpp.

◆ colN

template<typename Float >
size_t monolish::matrix::Dense< Float >::colN
private

# of col

Definition at line 31 of file monolish_dense.hpp.

◆ gpu_status

template<typename Float >
bool monolish::matrix::Dense< Float >::gpu_status = false
mutableprivate

# of non-zero element (M * N)

true: sended, false: not send

Definition at line 41 of file monolish_dense.hpp.

◆ rowN

template<typename Float >
size_t monolish::matrix::Dense< Float >::rowN
private

# of row

Definition at line 26 of file monolish_dense.hpp.

◆ val

template<typename Float >
std::shared_ptr<Float> monolish::matrix::Dense< Float >::val

Dense format value (pointer)

Definition at line 47 of file monolish_dense.hpp.

◆ val_create_flag

template<typename Float >
bool monolish::matrix::Dense< Float >::val_create_flag = false

matrix create flag;

Definition at line 62 of file monolish_dense.hpp.

◆ val_nnz

template<typename Float >
size_t monolish::matrix::Dense< Float >::val_nnz = 0

# of non-zero element (M * N)

Definition at line 52 of file monolish_dense.hpp.


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