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

Coodinate (COO) format Matrix (need to sort) More...

#include <monolish_coo.hpp>

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

Public Member Functions

Float at (const size_t i, const size_t j)
 Get matrix element (A(i,j)) More...
 
Float at (const size_t i, const size_t j) const
 Get matrix 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 matrix::CRS< Float > &crs)
 Create COO matrix from CRS matrix. More...
 
void convert (const matrix::Dense< Float > &dense)
 Create COO matrix from Dense matrix (drop zero) More...
 
void convert (const matrix::LinearOperator< Float > &linearoperator)
 
 COO ()
 
 COO (const matrix::COO< Float > &coo)
 Create COO matrix from COO matrix. More...
 
 COO (const matrix::COO< Float > &coo, Float value)
 Initialize COO matrix of the same size as input matrix. More...
 
 COO (const matrix::CRS< Float > &crs)
 Create COO matrix from CRS matrix. More...
 
 COO (const matrix::Dense< Float > &dense)
 Create COO matrix from Dense matrix (drop zero) More...
 
 COO (const matrix::LinearOperator< Float > &linearoperator)
 
 COO (const size_t M, const size_t N)
 Initialize M x N COO matrix. More...
 
 COO (const size_t M, const size_t N, const size_t NNZ, const int *row, const int *col, const Float *value)
 Create COO matrix from array. More...
 
 COO (const size_t M, const size_t N, const size_t NNZ, const int *row, const int *col, const Float *value, const size_t origin)
 Create COO matrix from n-origin array. More...
 
 COO (const size_t M, const size_t N, const size_t NNZ, const std::vector< int > &row, const std::vector< int > &col, const std::vector< Float > &value)
 Create COO matrix from std::vector. More...
 
 COO (const size_t M, const size_t N, const size_t NNZ, const std::vector< int > &row, const std::vector< int > &col, const std::vector< Float > &value, const size_t origin)
 Create COO matrix from n-origin array. More...
 
 COO (const size_t M, const size_t N, const size_t NNZ, const std::vector< int > &row, const std::vector< int > &col, const vector< Float > &value)
 Create COO matrix from monolish::vector. More...
 
 COO (const std::string filename)
 Create COO matrix from MatrixMarket format file (only real general) (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html) More...
 
Float * data ()
 returns a direct pointer to the vector More...
 
const Float * data () const
 returns a direct pointer to the vector More...
 
void device_free () const
 free data on GPU More...
 
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
 
bool equal (const COO< 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...
 
std::vector< int > & get_col_ind ()
 get column index More...
 
const std::vector< int > & get_col_ind () const
 get column index More...
 
double get_data_size () const
 Memory data space required by the matrix. More...
 
bool get_device_mem_stat () const
 false; // 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...
 
std::vector< int > & get_row_ptr ()
 get row index More...
 
const std::vector< int > & get_row_ptr () const
 get row index More...
 
std::vector< Float > get_val_ptr ()
 get value More...
 
const std::vector< Float > get_val_ptr () const
 get value More...
 
void input_mm (const std::string filename)
 Create COO matrix from MatrixMarket format file (only real general) (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html) More...
 
void insert (const size_t m, const size_t n, const Float val)
 insert element to (m, n) More...
 
bool operator!= (const COO< Float > &mat) const
 Comparing matrices (A != mat) More...
 
void operator= (const COO< Float > &mat)
 matrix copy More...
 
bool operator== (const COO< Float > &mat) const
 Comparing matrices (A == mat) More...
 
Float & operator[] (size_t i)
 reference to the element at position (v[i]) More...
 
void output_mm (const std::string filename) const
 output matrix elements in MatrixMarket format (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html) More...
 
void print_all (bool force_cpu=false) const
 print all elements to standard I/O More...
 
void print_all (const std::string filename) const
 print all elements to file More...
 
void recv () const
 recv data from GPU 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
 Set # of non-zero elements. More...
 
void set_col (const size_t N)
 Set col number. More...
 
void set_ptr (const size_t rN, const size_t cN, const std::vector< int > &r, const std::vector< int > &c, const size_t vsize, const Float *v)
 Set COO array from std::vector. More...
 
void set_ptr (const size_t rN, const size_t cN, const std::vector< int > &r, const std::vector< int > &c, const std::vector< Float > &v)
 Set COO array from std::vector. More...
 
void set_row (const size_t M)
 Set row number. More...
 
void sort (bool merge)
 sort COO matrix elements (and merge elements) More...
 
void transpose ()
 get transposed matrix (A^T) More...
 
void transpose (const COO &B)
 create transposed matrix from COO matrix (B = A^T) More...
 
std::string type () const
 get format name "COO" More...
 
 ~COO ()
 ; free gpu mem. More...
 

Public Attributes

std::size_t alloc_nnz = 0
 alloced matrix size More...
 
std::vector< int > col_index
 Coodinate format column index, which stores column numbers of the non-zero elements (size nnz) More...
 
std::vector< int > row_index
 Coodinate format row index, which stores row numbers of the non-zero elements (size nnz) More...
 
std::shared_ptr< Float > val
 Coodinate format value array (pointer), which stores values of the non-zero elements. More...
 
bool val_create_flag = false
 matrix create flag; More...
 
size_t val_nnz = 0
 # of non-zero element More...
 

Private Member Functions

void _q_sort (int lo, int hi)
 

Private Attributes

size_t colN
 # of col More...
 
bool gpu_status = false
 # of non-zero element More...
 
size_t rowN
 # of row More...
 

Detailed Description

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

Coodinate (COO) format Matrix (need to sort)

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

Definition at line 47 of file monolish_coo.hpp.

Constructor & Destructor Documentation

◆ COO() [1/13]

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

Definition at line 103 of file monolish_coo.hpp.

Here is the caller graph for this function:

◆ COO() [2/13]

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

Initialize M x N COO matrix.

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

Definition at line 118 of file monolish_coo.hpp.

◆ COO() [3/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const size_t  M,
const size_t  N,
const size_t  NNZ,
const int *  row,
const int *  col,
const Float *  value 
)

Create COO matrix from array.

Parameters
M# of row
N# of col
NNZ# of non-zero elements
rowrow index, which stores the row numbers of the non-zero elements (size nnz)
colcol index, which stores the column numbers of the non-zero elements (size nnz)
valuevalue index, which stores the non-zero elements (size nnz)
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ COO() [4/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const size_t  M,
const size_t  N,
const size_t  NNZ,
const std::vector< int > &  row,
const std::vector< int > &  col,
const std::vector< Float > &  value 
)
inline

Create COO matrix from std::vector.

Parameters
M# of row
N# of col
NNZ# of non-zero elements
rowrow index, which stores the row numbers of the non-zero elements (size nnz)
colcol index, which stores the column numbers of the non-zero elements (size nnz)
valuevalue index, which stores the non-zero elements (size nnz)
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 157 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ COO() [5/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const size_t  M,
const size_t  N,
const size_t  NNZ,
const std::vector< int > &  row,
const std::vector< int > &  col,
const vector< Float > &  value 
)
inline

Create COO matrix from monolish::vector.

Parameters
M# of row
N# of col
NNZ# of non-zero elements
rowrow index, which stores the row numbers of the non-zero elements (size nnz)
colcol index, which stores the column numbers of the non-zero elements (size nnz)
valuevalue index, which stores the non-zero elements (size nnz)
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false
Warning
gpu_status of input vectors must be false

Definition at line 180 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ COO() [6/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const size_t  M,
const size_t  N,
const size_t  NNZ,
const int *  row,
const int *  col,
const Float *  value,
const size_t  origin 
)

Create COO matrix from n-origin array.

Parameters
M# of row
N# of col
NNZ# of non-zero elements
rown-origin row index, which stores the row numbers of the non-zero elements (size nnz)
coln-origin col index, which stores the column numbers of the non-zero elements (size nnz)
valuen-origin value index, which stores the non-zero elements (size nnz)
originn-origin
Note
  • # of computation: 3nnz + 2nnz(adjust possition using origin)
  • Multi-threading: true
  • GPU acceleration: false

◆ COO() [7/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const size_t  M,
const size_t  N,
const size_t  NNZ,
const std::vector< int > &  row,
const std::vector< int > &  col,
const std::vector< Float > &  value,
const size_t  origin 
)
inline

Create COO matrix from n-origin array.

Parameters
M# of row
N# of col
NNZ# of non-zero elements
rown-origin row index, which stores the row numbers of the non-zero elements (size nnz)
coln-origin col index, which stores the column numbers of the non-zero elements (size nnz)
valuen-origin value, which stores the non-zero elements (size nnz)
originn-origin
Note
  • # of computation: 3nnz + 2nnz(adjust possition using origin)
  • Multi-threading: true
  • GPU acceleration: false

Definition at line 224 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ COO() [8/13]

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

Create COO matrix from COO matrix.

Parameters
cooinput COO matrix
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ COO() [9/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const matrix::COO< Float > &  coo,
Float  value 
)

Initialize COO matrix of the same size as input matrix.

Parameters
cooinput COO matrix
valuethe value to initialize elements
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ COO() [10/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const matrix::CRS< Float > &  crs)
inline

Create COO matrix from CRS matrix.

Parameters
crsinput COO matrix
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 269 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ COO() [11/13]

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

Create COO matrix from Dense matrix (drop zero)

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

Definition at line 292 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ COO() [12/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const matrix::LinearOperator< Float > &  linearoperator)
inline

Definition at line 299 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ ~COO()

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

; free gpu mem.

Warning
COO format can not use GPU function

Definition at line 374 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ COO() [13/13]

template<typename Float >
monolish::matrix::COO< Float >::COO ( const std::string  filename)
inline

Create COO matrix from MatrixMarket format file (only real general) (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html)

Parameters
filenameMatrixMarket format file name
Note
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 451 of file monolish_coo.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ _q_sort()

template<typename Float >
void monolish::matrix::COO< Float >::_q_sort ( int  lo,
int  hi 
)
private

◆ at() [1/2]

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

Get matrix element (A(i,j))

Note
  • # of computation: i*M+j
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 499 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ at() [2/2]

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

Get matrix element (A(i,j))

Note
  • # of computation: i*M+j
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ col() [1/4]

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

get column vector

Parameters
ccolumn number
veccolumn vector
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ col() [2/4]

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

◆ col() [3/4]

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

◆ col() [4/4]

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

◆ convert() [1/3]

template<typename Float >
void monolish::matrix::COO< Float >::convert ( const matrix::CRS< Float > &  crs)

Create COO matrix from CRS matrix.

Parameters
crsinput COO matrix
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ convert() [2/3]

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

Create COO matrix from Dense matrix (drop zero)

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

◆ convert() [3/3]

template<typename Float >
void monolish::matrix::COO< Float >::convert ( const matrix::LinearOperator< Float > &  linearoperator)

◆ data() [1/2]

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

returns a direct pointer to the vector

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

Definition at line 396 of file monolish_coo.hpp.

◆ data() [2/2]

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

returns a direct pointer to the vector

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

Definition at line 388 of file monolish_coo.hpp.

Here is the caller graph for this function:

◆ device_free()

template<typename Float >
void monolish::matrix::COO< Float >::device_free ( ) const
inline

free data on GPU

Warning
COO format can not use GPU function

Definition at line 359 of file monolish_coo.hpp.

Here is the caller graph for this function:

◆ diag() [1/4]

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

get diag. vector

Parameters
vecdiag. vector
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ diag() [2/4]

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

◆ diag() [3/4]

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

◆ diag() [4/4]

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

◆ equal()

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

Comparing matrices (A == mat)

Parameters
matCOO matrix
compare_cpu_and_deviceUnused options for integrity
Returns
true or false
Note
  • # of computation: 3nnz
  • Multi-threading: true
  • GPU acceleration: false

◆ fill()

template<typename Float >
void monolish::matrix::COO< 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::COO< Float >::get_col ( ) const
inline

get # of col

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

Definition at line 549 of file monolish_coo.hpp.

◆ get_col_ind() [1/2]

template<typename Float >
std::vector<int>& monolish::matrix::COO< Float >::get_col_ind ( )
inline

get column index

Returns
column index
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 588 of file monolish_coo.hpp.

◆ get_col_ind() [2/2]

template<typename Float >
const std::vector<int>& monolish::matrix::COO< Float >::get_col_ind ( ) const
inline

get column index

Returns
column index
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 626 of file monolish_coo.hpp.

◆ get_data_size()

template<typename Float >
double monolish::matrix::COO< 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 676 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ get_device_mem_stat()

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

false; // true: sended, false: not send

Returns
true is sended.
Warning
COO format can not use GPU function

Definition at line 367 of file monolish_coo.hpp.

Here is the caller graph for this function:

◆ get_nnz()

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

get # of non-zeros

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

Definition at line 558 of file monolish_coo.hpp.

Here is the caller graph for this function:

◆ get_row()

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

get # of row

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

Definition at line 540 of file monolish_coo.hpp.

◆ get_row_ptr() [1/2]

template<typename Float >
std::vector<int>& monolish::matrix::COO< Float >::get_row_ptr ( )
inline

get row index

Returns
row index
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 578 of file monolish_coo.hpp.

◆ get_row_ptr() [2/2]

template<typename Float >
const std::vector<int>& monolish::matrix::COO< Float >::get_row_ptr ( ) const
inline

get row index

Returns
row index
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 614 of file monolish_coo.hpp.

◆ get_val_ptr() [1/2]

template<typename Float >
std::vector<Float> monolish::matrix::COO< Float >::get_val_ptr ( )
inline

get value

Returns
value
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 598 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ get_val_ptr() [2/2]

template<typename Float >
const std::vector<Float> monolish::matrix::COO< Float >::get_val_ptr ( ) const
inline

get value

Returns
value
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false

Definition at line 638 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ input_mm()

template<typename Float >
void monolish::matrix::COO< Float >::input_mm ( const std::string  filename)

Create COO matrix from MatrixMarket format file (only real general) (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html)

Parameters
filenameMatrixMarket format file name
Note
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ insert()

template<typename Float >
void monolish::matrix::COO< Float >::insert ( const size_t  m,
const size_t  n,
const Float  val 
)

insert element to (m, n)

Parameters
mrow number
ncol number
valmatrix value (if multiple element exists, value will be added together)
Note
  • # of computation: 1
  • Multi-threading: false
  • GPU acceleration: false
Warning
This function does not check for duplicate values. This adds an element to the end of the array. In most cases, calling sort() is required after this function.

◆ operator!=()

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

Comparing matrices (A != mat)

Parameters
matCOO matrix
Returns
true or false
Note
  • # of computation: 3nnz
  • Multi-threading: true
  • GPU acceleration: false

◆ operator=()

template<typename Float >
void monolish::matrix::COO< Float >::operator= ( const COO< Float > &  mat)

matrix copy

Parameters
matCOO matrix
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false
Warning
src. and dst. must be same non-zero structure (dont check in this function)

◆ operator==()

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

Comparing matrices (A == mat)

Parameters
matCOO matrix
Returns
true or false
Note
  • # of computation: 3nnz
  • Multi-threading: true
  • GPU acceleration: false

◆ operator[]()

template<typename Float >
Float& monolish::matrix::COO< 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 755 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ output_mm()

template<typename Float >
void monolish::matrix::COO< Float >::output_mm ( const std::string  filename) const

output matrix elements in MatrixMarket format (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html)

Parameters
filenameMatrixMarket format file name
Note
  • Multi-threading: false
  • GPU acceleration: false

◆ print_all() [1/2]

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

print all elements to standard I/O

Parameters
force_cpuUnused options for integrity
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ print_all() [2/2]

template<typename Float >
void monolish::matrix::COO< Float >::print_all ( const std::string  filename) const

print all elements to file

Parameters
filenameoutput filename
Note
  • # of computation: 3nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ recv()

template<typename Float >
void monolish::matrix::COO< Float >::recv ( ) const
inline

recv data from GPU

Warning
COO format can not use GPU function

Definition at line 350 of file monolish_coo.hpp.

◆ resize()

template<typename Float >
void monolish::matrix::COO< 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 406 of file monolish_coo.hpp.

Here is the call graph for this function:

◆ row() [1/4]

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

get row vector

Parameters
rrow number
vecrow vector
Note
  • # of computation: nnz
  • Multi-threading: false
  • GPU acceleration: false
Here is the caller graph for this function:

◆ row() [2/4]

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

◆ row() [3/4]

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

◆ row() [4/4]

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

◆ send()

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

Set # of non-zero elements.

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

send data to GPU

Warning
COO format can not use GPU function

Definition at line 341 of file monolish_coo.hpp.

◆ set_col()

template<typename Float >
void monolish::matrix::COO< Float >::set_col ( const size_t  N)
inline

Set col number.

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

Definition at line 322 of file monolish_coo.hpp.

◆ set_ptr() [1/2]

template<typename Float >
void monolish::matrix::COO< Float >::set_ptr ( const size_t  rN,
const size_t  cN,
const std::vector< int > &  r,
const std::vector< int > &  c,
const size_t  vsize,
const Float *  v 
)

Set COO array from std::vector.

Parameters
rN# of row
cN# of column
rrow_index
ccol_index
vvalue
Note
  • # of computation: 3
  • Multi-threading: false
  • GPU acceleration: false

◆ set_ptr() [2/2]

template<typename Float >
void monolish::matrix::COO< Float >::set_ptr ( const size_t  rN,
const size_t  cN,
const std::vector< int > &  r,
const std::vector< int > &  c,
const std::vector< Float > &  v 
)

Set COO array from std::vector.

Parameters
rN# of row
cN# of column
rrow_index
ccol_index
vvalue
Note
  • # of computation: 3
  • Multi-threading: false
  • GPU acceleration: false

◆ set_row()

template<typename Float >
void monolish::matrix::COO< Float >::set_row ( const size_t  M)
inline

Set row number.

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

Definition at line 312 of file monolish_coo.hpp.

◆ sort()

template<typename Float >
void monolish::matrix::COO< Float >::sort ( bool  merge)

sort COO matrix elements (and merge elements)

Parameters
mergeneed to merge (true or false)
Note
  • # of computation: 3nnz x log(3nnz) ~ 3nnz^2
  • Multi-threading: false
  • GPU acceleration: false

◆ transpose() [1/2]

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

get transposed matrix (A^T)

Returns
tranposed matrix A^T
Note
  • # of computation: 2 * nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ transpose() [2/2]

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

create transposed matrix from COO matrix (B = A^T)

Parameters
BCOO matrix
Note
  • # of computation: 3 * nnz
  • Multi-threading: false
  • GPU acceleration: false

◆ type()

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

get format name "COO"

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

Definition at line 687 of file monolish_coo.hpp.

Member Data Documentation

◆ alloc_nnz

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

alloced matrix size

Definition at line 96 of file monolish_coo.hpp.

◆ col_index

template<typename Float >
std::vector<int> monolish::matrix::COO< Float >::col_index

Coodinate format column index, which stores column numbers of the non-zero elements (size nnz)

Definition at line 80 of file monolish_coo.hpp.

◆ colN

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

# of col

Definition at line 57 of file monolish_coo.hpp.

◆ gpu_status

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

# of non-zero element

true: sended, false: not send

Definition at line 67 of file monolish_coo.hpp.

◆ row_index

template<typename Float >
std::vector<int> monolish::matrix::COO< Float >::row_index

Coodinate format row index, which stores row numbers of the non-zero elements (size nnz)

Definition at line 74 of file monolish_coo.hpp.

◆ rowN

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

# of row

Definition at line 52 of file monolish_coo.hpp.

◆ val

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

Coodinate format value array (pointer), which stores values of the non-zero elements.

Definition at line 86 of file monolish_coo.hpp.

◆ val_create_flag

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

matrix create flag;

Definition at line 101 of file monolish_coo.hpp.

◆ val_nnz

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

# of non-zero element

Definition at line 91 of file monolish_coo.hpp.


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