|
| | SpMatrix ()=default |
| |
| | SpMatrix (AlgPartition partition, int nnz_per_row) |
| | Construct a sparse matrix with a fixed number of nonzeros per row.
|
| |
| | SpMatrix (AlgPartition partition, csr_type csr) |
| | Construct a sparse matrix from a given Partition and CSR.
|
| |
| | SpMatrix (SpMatrix const &)=delete |
| |
| SpMatrix & | operator= (SpMatrix const &)=delete |
| |
| | SpMatrix (SpMatrix &&)=default |
| |
| SpMatrix & | operator= (SpMatrix &&)=default |
| |
| | ~SpMatrix ()=default |
| |
| void | define (AlgPartition partition, int nnz_per_row) |
| | Allocate storage for a default-constructed matrix with a fixed number of nonzeros per row.
|
| |
| void | define (AlgPartition partition, T const *mat, Long const *col_index, Long nentries, Long const *row_offset, CsrSorted is_sorted, CsrValid is_valid) |
| | Define a default-constructed matrix from given CSR arrays.
|
| |
| void | define (AlgPartition partition, csr_type csr, CsrSorted is_sorted) |
| | Define a default-constructed matrix from a given CSR.
|
| |
| AlgPartition const & | partition () const |
| |
| AlgPartition const & | columnPartition () const |
| | Return the column partition used for matrix-vector and matrix-matrix multiplications.
|
| |
| Long | numLocalRows () const |
| |
| Long | numGlobalRows () const |
| |
| Long | numLocalNonZeros () const |
| |
| Long | globalRowBegin () const |
| | Inclusive global index begin.
|
| |
| Long | globalRowEnd () const |
| | Exclusive global index end.
|
| |
| T * | data () |
| | Don't use this beyond initial setup.
|
| |
| Long * | columnIndex () |
| | Don't use this beyond initial setup.
|
| |
| Long * | rowOffset () |
| | Don't use this beyond initial setup.
|
| |
| void | printToFile (std::string const &file) const |
| |
| template<typename F > |
| void | setVal (F const &f, CsrSorted is_sorted) |
| | Initialize matrix entries using a row-wise functor.
|
| |
| void | sortCSR () |
| |
| AlgVector< T, AllocT > const & | diagonalVector () const |
| | Return diagonal elements in a square matrix.
|
| |
| AlgVector< T, AllocT > | rowSum () const |
| | Return row-sum vector.
|
| |
| ParCsr< T > | parcsr () |
| |
| ParCsr< T const > | parcsr () const |
| |
| ParCsr< T const > | const_parcsr () const |
| |
| void | define_doit (int nnz_per_row) |
| | Private function, but public for cuda.
|
| |
| template<typename I > |
| void | define_and_filter_doit (T const *mat, Long const *col_index, Long nentries, Long const *row_offset) |
| | Private function, but public for cuda.
|
| |
| void | startComm_mv (AlgVector< T, AllocT > const &x) |
| |
| void | finishComm_mv (AlgVector< T, AllocT > &y) |
| |
| void | startComm_tr (AlgPartition const &col_partition) |
| |
| void | finishComm_tr (SpMatrix< T, Allocator > &AT) |
| |
| void | split_csr (AlgPartition const &col_partition) |
| |
| template<typename C > |
| void | update_remote_col_index (C &csrr, bool in_device_memory) |
| |
| void | prepare_comm_mv (AlgPartition const &col_partition) |
| |
| void | pack_buffer_mv (AlgVector< T, AllocT > const &v) |
| |
| void | unpack_buffer_mv (AlgVector< T, AllocT > &v) |
| |
| void | unpack_buffer_tr (CommTR const &ctr, AlgPartition const &col_partition) |
| |
template<typename T , template< typename > class Allocator>
Construct a sparse matrix with a fixed number of nonzeros per row.
This constructor allocates the required storage and initializes the row offsets. The matrix entries themselves are left uninitialized. Matrix values can be written through the pointer returned by data() and the corresponding column indices through the pointer returned by the columnIndex(). Alternatively, the matrix may be initialized using setVal(). In either case, the CSR data must not contain duplicated entries or invalid entries (i.e., negative column indices). If the matrix is set manually through pointers and the entries within each row are not sorted by column index, the user must call sortCSR after all data have been set.
- Parameters
-
| partition | Parallel partition information. |
| nnz_per_row | Number of nonzeros per row. |
template<typename T , template< typename > class Allocator>
Allocate storage for a default-constructed matrix with a fixed number of nonzeros per row.
This allocates the required storage and initializes the row offsets. The matrix entries themselves are left uninitialized. Matrix values can be written through the pointer returned by data() and the corresponding column indices through the pointer returned by the columnIndex(). Alternatively, the matrix may be initialized using setVal().
- Parameters
-
| partition | Parallel partition information. |
| nnz_per_row | Number of nonzeros per row. |
template<typename T , template< typename > class Allocator>
Define a default-constructed matrix from given CSR arrays.
The CSR arrays describe the portion of the matrix local to this process.
If is_valid indicates that the input CSR may contain invalid entries, this function will filter the input and omit such entries from the resulting matrix. An entry is considered invalid if its column index is negative. In addition, when is_valid is false, this function also removes entries whose values are zero. The input CSR is not allowed to contain duplicated valid entries.
It is not an error to specify is_sorted = false when the input CSR is in fact sorted, nor to specify is_valid = false when the input CSR contains no invalid entries. In these cases, the result is correct, but the function may perform unnecessary work and therefore result in a performance penalty. If the input properties are not known, it is safe to set both flags to false.
The input data can be freed after this function call. For GPU builds, the data are expected to be in GPU memory.
- Parameters
-
| partition | Parallel partition information. |
| mat | CSR values array (length nentries). |
| col_index | CSR column indices array (length nentries). |
| nentries | Number of entries. |
| row_offset | CSR row offsets array (length num_local_rows + 1). |
| is_sorted | Indicates whether the CSR entries are sorted (within each row). |
| is_valid | Indicates whether the input CSR is guaranteed to be valid (i.e., contains no negative column indices). |
template<typename T , template< typename > class Allocator>
Initialize matrix entries using a row-wise functor.
The functor must have the signature
amrex_long Long
Definition AMReX_INT.H:30
and is responsible for setting the global column indices and values for the row specified by the global row index.
This function is intended to be used after define(AlgPartition,int), when the storage has been allocated. It should only be used during initial matrix setup and not for modifying an already assembled matrix.
The CSR data must not contain duplicated entries or invalid entries (i.e., negative column indices).
- Parameters
-
| f | Functor void(Long,Long*,T*) |
| is_sorted | Indicates whether the CSR entries are sorted (within each row). |