|
DOLFINx 0.11.0.0
DOLFINx C++
|
Fetch the rows of B that correspond to the ghost columns of A. More...
Classes | |
| struct | Sparsity |
| Lightweight sparsity descriptor satisfying the SparsityImplementation concept required by the MatrixCSR constructor. More... | |
Functions | |
| template<typename T> | |
| std::tuple< std::shared_ptr< common::IndexMap >, std::vector< std::int32_t >, std::vector< std::int32_t >, std::vector< T > > | fetch_ghost_rows (const dolfinx::la::MatrixCSR< T > &A, const dolfinx::la::MatrixCSR< T > &B) |
| Fetch the rows of Matrix B which are referenced by the ghost columns of Matrix A. | |
| template<typename T> | |
| std::tuple< std::vector< std::int64_t >, std::vector< std::int32_t >, std::vector< std::int32_t >, std::vector< T > > | matmul (const dolfinx::la::MatrixCSR< T > &A, const dolfinx::la::MatrixCSR< T > &B, std::shared_ptr< const common::IndexMap > new_col_map, std::span< const std::int32_t > ghost_row_ptr, std::span< const std::int32_t > ghost_cols, std::span< const T > ghost_vals) |
| Compute the sparsity pattern and values of C = A*B in a single pass. | |
| template<int BS0, int BS1, typename OP, typename U, typename V, typename W, typename X, typename Y> | |
| void | insert_csr (U &&data, const V &cols, const W &row_ptr, const X &x, const Y &xrows, const Y &xcols, OP op, typename Y::value_type num_rows) |
| Incorporate data into a CSR matrix. | |
| template<int BS0, int BS1, typename OP, typename U, typename V, typename W, typename X, typename Y> | |
| void | insert_blocked_csr (U &&data, const V &cols, const W &row_ptr, const X &x, const Y &xrows, const Y &xcols, OP op, typename Y::value_type num_rows) |
| Incorporate blocked data with given block sizes into a non-blocked MatrixCSR. | |
| template<typename OP, typename U, typename V, typename W, typename X, typename Y> | |
| void | insert_nonblocked_csr (U &&data, const V &cols, const W &row_ptr, const X &x, const Y &xrows, const Y &xcols, OP op, typename Y::value_type num_rows, int bs0, int bs1) |
| Incorporate non-blocked data into a blocked matrix (data block size=1). | |
| template<typename T, int BS1> | |
| void | spmv (std::span< const T > values, std::span< const std::int64_t > row_begin, std::span< const std::int64_t > row_end, std::span< const std::int32_t > indices, std::span< const T > x, std::span< T > y, int bs0, int bs1) |
| Sparse matrix-vector product implementation. | |
| template<typename T, int BS1> | |
| void | spmvT (std::span< const T > values, std::span< const std::int64_t > row_begin, std::span< const std::int64_t > row_end, std::span< const std::int32_t > indices, std::span< const T > x, std::span< T > y, int bs0, int bs1) |
| Sparse matrix-vector transpose product implementation. | |
| template<typename T, int BS0 = -1, int BS1 = -1> | |
| std::tuple< std::vector< std::int32_t >, std::vector< std::int64_t >, std::vector< T > > | local_transpose (const dolfinx::la::MatrixCSR< T > &A) |
| Compute the local (diagonal-block) transpose of A. | |
Fetch the rows of B that correspond to the ghost columns of A.
For computing the product A*B, each rank needs the rows of B whose global indices match the ghost columns of A. Those ghost columns are owned by remote ranks, so we request those rows via neighbourhood communication.
| A | Matrix whose ghost column indices determine which rows of B are needed. |
| B | Matrix whose rows are fetched. |
| std::tuple< std::shared_ptr< common::IndexMap >, std::vector< std::int32_t >, std::vector< std::int32_t >, std::vector< T > > fetch_ghost_rows | ( | const dolfinx::la::MatrixCSR< T > & | A, |
| const dolfinx::la::MatrixCSR< T > & | B ) |
| void insert_blocked_csr | ( | U && | data, |
| const V & | cols, | ||
| const W & | row_ptr, | ||
| const X & | x, | ||
| const Y & | xrows, | ||
| const Y & | xcols, | ||
| OP | op, | ||
| typename Y::value_type | num_rows ) |
Incorporate blocked data with given block sizes into a non-blocked MatrixCSR.
| BS0 | Row block size of data. |
| BS1 | Column block size of data. |
| OP | The operation (usually "set" or "add"). |
| [out] | data | CSR matrix data. |
| [in] | cols | CSR column indices. |
| [in] | row_ptr | Pointer to the ith row in the CSR data. |
| [in] | x | The m by n dense block of values (row-major) to add to the matrix. |
| [in] | xrows | Row indices of x. |
| [in] | xcols | Column indices of x. |
| [in] | op | The operation (set or add). |
| [in] | num_rows | Maximum row index that can be set. Used when debugging to check that rows beyond a permitted range are not being set. |
| void insert_csr | ( | U && | data, |
| const V & | cols, | ||
| const W & | row_ptr, | ||
| const X & | x, | ||
| const Y & | xrows, | ||
| const Y & | xcols, | ||
| OP | op, | ||
| typename Y::value_type | num_rows ) |
Incorporate data into a CSR matrix.
| BS0 | Row block size (of both matrix and data). |
| BS1 | Column block size (of both matrix and data). |
| OP | The operation (usually "set" or "add"). |
| [out] | data | CSR matrix data. |
| [in] | cols | CSR column indices. |
| [in] | row_ptr | Pointer to the ith row in the CSR data. |
| [in] | x | The m by n dense block of values (row-major) to add to the matrix. |
| [in] | xrows | Row indices of x. |
| [in] | xcols | Column indices of x. |
| [in] | op | The operation (set or add), |
| [in] | num_rows | Maximum row index that can be set. Used when debugging to check that rows beyond a permitted range are not being set. |
0 1 | 2 3
8 9 | 10 11 12 13 | 14 15
| void insert_nonblocked_csr | ( | U && | data, |
| const V & | cols, | ||
| const W & | row_ptr, | ||
| const X & | x, | ||
| const Y & | xrows, | ||
| const Y & | xcols, | ||
| OP | op, | ||
| typename Y::value_type | num_rows, | ||
| int | bs0, | ||
| int | bs1 ) |
Incorporate non-blocked data into a blocked matrix (data block size=1).
| [out] | data | CSR matrix data. |
| [in] | cols | CSR column indices. |
| [in] | row_ptr | Pointer to the ith row in the CSR data. |
| [in] | x | The m by n dense block of values (row-major) to add to the matrix. |
| [in] | xrows | Rrow indices of x. |
| [in] | xcols | Column indices of x. |
| [in] | op | The operation (set or add). |
| [in] | num_rows | Maximum row index that can be set. Used when debugging to check that rows beyond a permitted range are not being set. |
| [in] | bs0 | Row block size of matrix. |
| [in] | bs1 | Column block size of matrix. |
| std::tuple< std::vector< std::int32_t >, std::vector< std::int64_t >, std::vector< T > > local_transpose | ( | const dolfinx::la::MatrixCSR< T > & | A | ) |
Compute the local (diagonal-block) transpose of A.
Iterates over owned rows of A and the owned-column entries within each row (indices [row_ptr[i], off_diag_offset[i])), building the transpose CSR in one bucket-fill pass. The resulting column indices are original row indices (0-based local), so columns within every output row are already in ascending order.
| A | MatrixCSR |
| T | Scalar type |
| BS0 | row block size, must match row block size of A, or use -1 for non-optimized |
| BS1 | col block size, must match col block size of A, or use -1 for non-optimized |
| std::tuple< std::vector< std::int64_t >, std::vector< std::int32_t >, std::vector< std::int32_t >, std::vector< T > > matmul | ( | const dolfinx::la::MatrixCSR< T > & | A, |
| const dolfinx::la::MatrixCSR< T > & | B, | ||
| std::shared_ptr< const common::IndexMap > | new_col_map, | ||
| std::span< const std::int32_t > | ghost_row_ptr, | ||
| std::span< const std::int32_t > | ghost_cols, | ||
| std::span< const T > | ghost_vals ) |
Compute the sparsity pattern and values of C = A*B in a single pass.
Uses a dense accumulator (one entry per possible output column) to simultaneously detect nonzero columns and accumulate A[i,j]*B[j,k], eliminating the separate value-fill loop and the per-entry lower_bound search that a two-pass approach requires.
| A | Left matrix. |
| B | Right matrix (local rows only). |
| new_col_map | Extended column IndexMap for C, from fetch_ghost_rows. |
| ghost_row_ptr | CSR row pointer for the ghost rows of B. |
| ghost_cols | Local column indices (w.r.t. new_col_map) for ghost rows. |
| ghost_vals | Values for the ghost rows of B. |
| void spmv | ( | std::span< const T > | values, |
| std::span< const std::int64_t > | row_begin, | ||
| std::span< const std::int64_t > | row_end, | ||
| std::span< const std::int32_t > | indices, | ||
| std::span< const T > | x, | ||
| std::span< T > | y, | ||
| int | bs0, | ||
| int | bs1 ) |
Sparse matrix-vector product implementation.
| T | |
| BS1 |
| values | |
| row_begin | |
| row_end | |
| indices | |
| x | |
| y | |
| bs0 | |
| bs1 |
| void spmvT | ( | std::span< const T > | values, |
| std::span< const std::int64_t > | row_begin, | ||
| std::span< const std::int64_t > | row_end, | ||
| std::span< const std::int32_t > | indices, | ||
| std::span< const T > | x, | ||
| std::span< T > | y, | ||
| int | bs0, | ||
| int | bs1 ) |
Sparse matrix-vector transpose product implementation.
Computes y += A^T x where A is given in CSR format. The transpose is applied implicitly: for each nonzero A(i, indices[j]) the contribution A(i,j) * x[i] is scattered into y[indices[j]].
| T | Scalar type of the matrix and vector entries. |
| BS1 | Compile-time column block size. Pass -1 to use the runtime value bs1 instead. |
| [in] | values | Nonzero values of A, stored block-row-major. Length: nnz * bs0 * bs1. |
| [in] | row_begin | Start positions in values/indices for each row of A. Length: number of rows of A. |
| [in] | row_end | End positions in values/indices for each row of A. Length: number of rows of A. |
| [in] | indices | Column indices of each nonzero block entry of A. Length: nnz. |
| [in] | x | Input vector, indexed by the rows of A. Length: num_rows * bs0. |
| [in,out] | y | Output vector, indexed by the columns of A, accumulated into. Length: num_cols * bs1. |
| [in] | bs0 | Row block size (runtime value). |
| [in] | bs1 | Column block size (runtime value, used when BS1 == -1). |