|
monolish
0.16.1
MONOlithic LInear equation Solvers for Highly-parallel architecture
|
Coodinate (COO) format Matrix (need to sort) More...
#include <monolish_coo.hpp>

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< 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... | |
| 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< 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... | |
| 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 | 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< vector< Float >, Float > &vec) const |
| void | send () const |
| send data to GPU More... | |
| void | set_col (const size_t N) |
| Set col number. More... | |
| void | set_nnz (const size_t NNZ) |
| Set # of non-zero elements. 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::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::vector< Float > | val |
| Coodinate format value array, which stores values of the non-zero elements (size nnz) More... | |
Private Member Functions | |
| void | _q_sort (int lo, int hi) |
Private Attributes | |
| size_t | colN |
| # of col More... | |
| bool | gpu_status = false |
| true: sended, false: not send More... | |
| size_t | nnz |
| # of non-zero element More... | |
| size_t | rowN |
| # of row More... | |
Coodinate (COO) format Matrix (need to sort)
Definition at line 43 of file monolish_coo.hpp.
|
inline |
|
inline |
Initialize M x N COO matrix.
| M | # of row |
| N | # of col |
Definition at line 97 of file monolish_coo.hpp.
| 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.
| M | # of row |
| N | # of col |
| NNZ | # of non-zero elements |
| row | row index, which stores the row numbers of the non-zero elements (size nnz) |
| col | col index, which stores the column numbers of the non-zero elements (size nnz) |
| value | value index, which stores the non-zero elements (size nnz) |
|
inline |
Create COO matrix from std::vector.
| M | # of row |
| N | # of col |
| NNZ | # of non-zero elements |
| row | row index, which stores the row numbers of the non-zero elements (size nnz) |
| col | col index, which stores the column numbers of the non-zero elements (size nnz) |
| value | value index, which stores the non-zero elements (size nnz) |
Definition at line 134 of file monolish_coo.hpp.

|
inline |
Create COO matrix from monolish::vector.
| M | # of row |
| N | # of col |
| NNZ | # of non-zero elements |
| row | row index, which stores the row numbers of the non-zero elements (size nnz) |
| col | col index, which stores the column numbers of the non-zero elements (size nnz) |
| value | value index, which stores the non-zero elements (size nnz) |
Definition at line 157 of file monolish_coo.hpp.

| 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.
| M | # of row |
| N | # of col |
| NNZ | # of non-zero elements |
| row | n-origin row index, which stores the row numbers of the non-zero elements (size nnz) |
| col | n-origin col index, which stores the column numbers of the non-zero elements (size nnz) |
| value | n-origin value index, which stores the non-zero elements (size nnz) |
| origin | n-origin |
|
inline |
Create COO matrix from n-origin array.
| M | # of row |
| N | # of col |
| NNZ | # of non-zero elements |
| row | n-origin row index, which stores the row numbers of the non-zero elements (size nnz) |
| col | n-origin col index, which stores the column numbers of the non-zero elements (size nnz) |
| value | n-origin value index, which stores the non-zero elements (size nnz) |
| origin | n-origin |
Definition at line 201 of file monolish_coo.hpp.

| monolish::matrix::COO< Float >::COO | ( | const matrix::COO< Float > & | coo | ) |
| monolish::matrix::COO< Float >::COO | ( | const matrix::COO< Float > & | coo, |
| Float | value | ||
| ) |
|
inline |
Create COO matrix from CRS matrix.
| crs | input COO matrix |
Definition at line 246 of file monolish_coo.hpp.

|
inline |
Create COO matrix from Dense matrix (drop zero)
| dense | input Dense matrix (size M x N) |
Definition at line 266 of file monolish_coo.hpp.

|
inline |
|
inline |
; free gpu mem.
Definition at line 344 of file monolish_coo.hpp.

|
inline |
Create COO matrix from MatrixMarket format file (only real general) (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html)
| filename | MatrixMarket format file name |
Definition at line 371 of file monolish_coo.hpp.

|
private |
|
inline |
Get matrix element (A(i,j))
Definition at line 419 of file monolish_coo.hpp.

| Float monolish::matrix::COO< Float >::at | ( | const size_t | i, |
| const size_t | j | ||
| ) | const |
Get matrix element (A(i,j))

| void monolish::matrix::COO< Float >::col | ( | const size_t | c, |
| vector< Float > & | vec | ||
| ) | const |
get column vector
| c | column number |
| vec | column vector |

| void monolish::matrix::COO< Float >::col | ( | const size_t | c, |
| view1D< matrix::Dense< Float >, Float > & | vec | ||
| ) | const |
| void monolish::matrix::COO< Float >::col | ( | const size_t | c, |
| view1D< vector< Float >, Float > & | vec | ||
| ) | const |
| void monolish::matrix::COO< Float >::convert | ( | const matrix::CRS< Float > & | crs | ) |
| void monolish::matrix::COO< Float >::convert | ( | const matrix::Dense< Float > & | dense | ) |
| void monolish::matrix::COO< Float >::convert | ( | const matrix::LinearOperator< Float > & | linearoperator | ) |
|
inline |
free data on GPU
Definition at line 329 of file monolish_coo.hpp.

| void monolish::matrix::COO< Float >::diag | ( | vector< Float > & | vec | ) | const |
get diag. vector
| vec | diag. vector |
| void monolish::matrix::COO< Float >::diag | ( | view1D< matrix::Dense< Float >, Float > & | vec | ) | const |
| void monolish::matrix::COO< Float >::diag | ( | view1D< vector< Float >, Float > & | vec | ) | const |
| bool monolish::matrix::COO< Float >::equal | ( | const COO< Float > & | mat, |
| bool | compare_cpu_and_device = false |
||
| ) | const |
Comparing matrices (A == mat)
| mat | COO matrix |
| compare_cpu_and_device | Unused options for integrity |
| void monolish::matrix::COO< Float >::fill | ( | Float | value | ) |
fill matrix elements with a scalar value
| value | scalar value |
|
inline |
get # of col
Definition at line 454 of file monolish_coo.hpp.
|
inline |
get column index
Definition at line 493 of file monolish_coo.hpp.
|
inline |
get column index
Definition at line 525 of file monolish_coo.hpp.
|
inline |
Memory data space required by the matrix.
Definition at line 569 of file monolish_coo.hpp.

|
inline |
false; // true: sended, false: not send
Definition at line 337 of file monolish_coo.hpp.

|
inline |
get # of non-zeros
Definition at line 463 of file monolish_coo.hpp.

|
inline |
get # of row
Definition at line 445 of file monolish_coo.hpp.
|
inline |
get row index
Definition at line 483 of file monolish_coo.hpp.
|
inline |
get row index
Definition at line 513 of file monolish_coo.hpp.
|
inline |
get value
Definition at line 503 of file monolish_coo.hpp.
|
inline |
get value
Definition at line 537 of file monolish_coo.hpp.
| 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)
| filename | MatrixMarket format file name |

| void monolish::matrix::COO< Float >::insert | ( | const size_t | m, |
| const size_t | n, | ||
| const Float | val | ||
| ) |
insert element to (m, n)
| m | row number |
| n | col number |
| val | matrix value (if multiple element exists, value will be added together) |
| bool monolish::matrix::COO< Float >::operator!= | ( | const COO< Float > & | mat | ) | const |
Comparing matrices (A != mat)
| mat | COO matrix |
| void monolish::matrix::COO< Float >::operator= | ( | const COO< Float > & | mat | ) |
matrix copy
| mat | COO matrix |
| bool monolish::matrix::COO< Float >::operator== | ( | const COO< Float > & | mat | ) | const |
Comparing matrices (A == mat)
| mat | COO matrix |
| 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)
| filename | MatrixMarket format file name |
| void monolish::matrix::COO< Float >::print_all | ( | bool | force_cpu = false | ) | const |
print all elements to standard I/O
| force_cpu | Unused options for integrity |
| void monolish::matrix::COO< Float >::print_all | ( | const std::string | filename | ) | const |
print all elements to file
| filename | output filename |
|
inline |
recv data from GPU
Definition at line 320 of file monolish_coo.hpp.
| void monolish::matrix::COO< Float >::row | ( | const size_t | r, |
| vector< Float > & | vec | ||
| ) | const |
get row vector
| r | row number |
| vec | row vector |

| void monolish::matrix::COO< Float >::row | ( | const size_t | r, |
| view1D< matrix::Dense< Float >, Float > & | vec | ||
| ) | const |
| void monolish::matrix::COO< Float >::row | ( | const size_t | r, |
| view1D< vector< Float >, Float > & | vec | ||
| ) | const |
|
inline |
send data to GPU
Definition at line 311 of file monolish_coo.hpp.
|
inline |
Set col number.
| N | # of col |
Definition at line 292 of file monolish_coo.hpp.
|
inline |
Set # of non-zero elements.
| NNZ | # of non-zero elements |
Definition at line 302 of file monolish_coo.hpp.
| 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.
| rN | # of row |
| cN | # of column |
| r | row_index |
| c | col_index |
| v | value |
|
inline |
Set row number.
| M | # of row |
Definition at line 282 of file monolish_coo.hpp.
| void monolish::matrix::COO< Float >::sort | ( | bool | merge | ) |
sort COO matrix elements (and merge elements)
| merge | need to merge (true or false) |
| void monolish::matrix::COO< Float >::transpose | ( | ) |
get transposed matrix (A^T)
| void monolish::matrix::COO< Float >::transpose | ( | const COO< Float > & | B | ) |
|
inline |
get format name "COO"
Definition at line 580 of file monolish_coo.hpp.
| 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 76 of file monolish_coo.hpp.
|
private |
# of col
Definition at line 53 of file monolish_coo.hpp.
|
mutableprivate |
true: sended, false: not send
Definition at line 63 of file monolish_coo.hpp.
|
private |
# of non-zero element
Definition at line 58 of file monolish_coo.hpp.
| 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 70 of file monolish_coo.hpp.
|
private |
# of row
Definition at line 48 of file monolish_coo.hpp.
| std::vector<Float> monolish::matrix::COO< Float >::val |
Coodinate format value array, which stores values of the non-zero elements (size nnz)
Definition at line 82 of file monolish_coo.hpp.