Template Class CooMatrix
Defined in File CooMatrix.hpp
Class Documentation
-
template<typename RealT, typename IdxT>
class CooMatrix Public Functions
-
CooMatrix(IdxT n, IdxT m, IdxT nnz)
basic constructor. It DOES NOT allocate any memory!
- Parameters:
n – [in] - number of rows
m – [in] - number of columns
nnz_ – [in] - number of non-zeros
-
CooMatrix(IdxT n, IdxT m, IdxT nnz, IdxT **rows, IdxT **cols, RealT **vals, memory::MemorySpace memspace_src = memory::HOST, memory::MemorySpace memspace_dst = memory::HOST)
Hijacking constructor.
- Parameters:
n – [in]
m – [in]
nnz_ – [in]
rows – [inout]
cols – [inout]
vals – [inout]
memspace_src – [in]
memspace_dst – [in]
-
int setDataPointers(IdxT *row_data, IdxT *col_data, RealT *val_data, memory::MemorySpace memspace)
Set the pointers for matrix row, column, value data.
Useful if interfacing with other codes - this function only assigns pointers, but it does not allocate nor copy anything. The data ownership flags would be set to false (default).
- Parameters:
row_data – [in] - pointer to row data (array of integers)
col_data – [in] - pointer to column data (array of integers)
val_data – [in] - pointer to value data (array of real numbers)
memspace – [in] - memory space (HOST or DEVICE) of incoming data
- Returns:
0 if successful, 1 if not.
-
int destroyMatrixData(memory::MemorySpace memspace)
destroy matrix data (HOST or DEVICE) if the matrix owns it (will attempt to destroy all three arrays).
- Parameters:
memspace – [in] - memory space (HOST or DEVICE) of incoming data
- Returns:
0 if successful, -1 if not.
-
void print(std::ostream &file_out = std::cout, IdxT indexing_base = 0)
Prints matrix data.
- Parameters:
out – - Output stream where the matrix data is printed
-
int syncData(memory::MemorySpace memspace_out)
Sync data in memspace with the updated memory space.
See also
CooMatrix::setUpdated
- Parameters:
memspace – - memory space to be synced up (HOST or DEVICE)
- Returns:
int - 0 if successful, error code otherwise
- Pre:
The memory space other than
memspacemust be up-to-date. Otherwise, this function will return an error.
-
CooMatrix(IdxT n, IdxT m, IdxT nnz)