monolish
0.14.0
MONOlithic LIner 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. 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::CRS< Float > &crs) | |
Create COO matrix from CRS matrix. More... | |
COO (const matrix::Dense< Float > &dense) | |
Create COO matrix from Dense matrix. 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 MatrixMatrket 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 matricies (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 MatrixMatrket 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 matricies (A != mat) More... | |
void | operator= (const COO< Float > &mat) |
matrix copy More... | |
bool | operator== (const COO< Float > &mat) const |
Comparing matricies (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... | |
COO & | transpose () |
get transposed matrix (A^T) More... | |
void | transpose (COO &B) const |
create transposed matrix from COO matrix (A = B^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 38 of file monolish_coo.hpp.
|
inline |
|
inline |
Initialize M x N COO matrix.
M | # of row |
N | # of col |
Definition at line 92 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 129 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 152 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 196 of file monolish_coo.hpp.
monolish::matrix::COO< Float >::COO | ( | const matrix::COO< Float > & | coo | ) |
|
inline |
Create COO matrix from CRS matrix.
crs | input COO matrix |
Definition at line 230 of file monolish_coo.hpp.
|
inline |
Create COO matrix from Dense matrix.
dense | input Dense matrix (size M x N) |
Definition at line 250 of file monolish_coo.hpp.
|
inline |
|
inline |
; free gpu mem.
Definition at line 328 of file monolish_coo.hpp.
|
inline |
Create COO matrix from MatrixMatrket format file (only real general) (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html)
filename | MatrixMarket format file name |
Definition at line 355 of file monolish_coo.hpp.
|
private |
Definition at line 48 of file at_insert_sort_coo.cpp.
|
inline |
Get matrix element (A(i,j))
Definition at line 403 of file monolish_coo.hpp.
template float monolish::matrix::COO< Float >::at | ( | const size_t | i, |
const size_t | j | ||
) | const |
Get matrix element (A(i,j))
Definition at line 9 of file at_insert_sort_coo.cpp.
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 313 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 |
template bool monolish::matrix::COO< Float >::equal | ( | const COO< Float > & | mat, |
bool | compare_cpu_and_device = false |
||
) | const |
Comparing matricies (A == mat)
mat | COO matrix |
compare_cpu_and_device | Unused options for integrity |
Definition at line 10 of file compare_coo.cpp.
template void monolish::matrix::COO< Float >::fill | ( | Float | value | ) |
fill matrix elements with a scalar value
value | scalar value |
Definition at line 9 of file fill_coo.cpp.
|
inline |
get # of col
Definition at line 438 of file monolish_coo.hpp.
|
inline |
get column index
Definition at line 477 of file monolish_coo.hpp.
|
inline |
get column index
Definition at line 507 of file monolish_coo.hpp.
|
inline |
Memory data space required by the matrix.
Definition at line 549 of file monolish_coo.hpp.
|
inline |
false; // true: sended, false: not send
Definition at line 321 of file monolish_coo.hpp.
|
inline |
get # of non-zeros
Definition at line 447 of file monolish_coo.hpp.
|
inline |
get # of row
Definition at line 429 of file monolish_coo.hpp.
|
inline |
get row index
Definition at line 467 of file monolish_coo.hpp.
|
inline |
get row index
Definition at line 497 of file monolish_coo.hpp.
|
inline |
get value
Definition at line 487 of file monolish_coo.hpp.
|
inline |
get value
Definition at line 517 of file monolish_coo.hpp.
template void monolish::matrix::COO< Float >::input_mm | ( | const std::string | filename | ) |
Create COO matrix from MatrixMatrket format file (only real general) (MatrixMarket format: https://math.nist.gov/MatrixMarket/formats.html)
filename | MatrixMarket format file name |
Definition at line 68 of file IO_coo.cpp.
template 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) |
Definition at line 30 of file at_insert_sort_coo.cpp.
template bool monolish::matrix::COO< Float >::operator!= | ( | const COO< Float > & | mat | ) | const |
Comparing matricies (A != mat)
mat | COO matrix |
Definition at line 83 of file compare_coo.cpp.
void monolish::matrix::COO< T >::operator= | ( | const COO< Float > & | mat | ) |
matrix copy
mat | COO matrix |
Definition at line 10 of file copy_coo.cpp.
template bool monolish::matrix::COO< Float >::operator== | ( | const COO< Float > & | mat | ) | const |
Comparing matricies (A == mat)
mat | COO matrix |
Definition at line 71 of file compare_coo.cpp.
template 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 |
Definition at line 48 of file IO_coo.cpp.
template 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 |
Definition at line 17 of file IO_coo.cpp.
template void monolish::matrix::COO< Float >::print_all | ( | const std::string | filename | ) | const |
print all elements to file
filename | output filename |
Definition at line 32 of file IO_coo.cpp.
|
inline |
recv data from GPU
Definition at line 304 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 295 of file monolish_coo.hpp.
|
inline |
Set col number.
N | # of col |
Definition at line 276 of file monolish_coo.hpp.
|
inline |
Set # of non-zero elements.
NNZ | # of non-zero elements |
Definition at line 286 of file monolish_coo.hpp.
template 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 |
Definition at line 26 of file copy_coo.cpp.
|
inline |
Set row number.
M | # of row |
Definition at line 266 of file monolish_coo.hpp.
template void monolish::matrix::COO< Float >::sort | ( | bool | merge | ) |
sort COO matrix elements (and merge elements)
merge | neet to merge (true or false) |
Definition at line 108 of file at_insert_sort_coo.cpp.
template COO< float > & monolish::matrix::COO< Float >::transpose | ( | ) |
get transposed matrix (A^T)
Definition at line 9 of file transpose_coo.cpp.
template void monolish::matrix::COO< Float >::transpose | ( | COO< Float > & | B | ) | const |
create transposed matrix from COO matrix (A = B^T)
B | COO matrix |
Definition at line 21 of file transpose_coo.cpp.
|
inline |
get format name "COO"
Definition at line 560 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 71 of file monolish_coo.hpp.
|
private |
# of col
Definition at line 48 of file monolish_coo.hpp.
|
mutableprivate |
true: sended, false: not send
Definition at line 58 of file monolish_coo.hpp.
|
private |
# of non-zero element
Definition at line 53 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 65 of file monolish_coo.hpp.
|
private |
# of row
Definition at line 43 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 77 of file monolish_coo.hpp.