ILU(k) level scheduling, test-matrix generation and workspace queries.
| Matrix< T, MatrixFormat::CSR > batchlas::csr_generators::random_sparse_hermitian_csr | ( | int | n, |
| float | density, | ||
| int | batch_size = 1, | ||
| unsigned | seed = 42, | ||
| typename base_type< T >::type | diagonal_boost = typename base_type< T >::type(1), | ||
| bool | shared_pattern = true ) |
Generates a batch of random sparse symmetric (real) or Hermitian (complex) n x n CSR matrices.
Every row holds its diagonal entry. Off-diagonal entries come in (i, j) / (j, i) pairs with conjugate values, drawn uniformly from [-1, 1] (real and imaginary parts independently). Each diagonal is real and set to the row's off-diagonal absolute sum (|re| + |im| for complex) plus diagonal_boost, so the matrix is strictly diagonally dominant with a positive diagonal. Column indices are sorted within each row. Storage is allocated and filled on the device; the call waits before returning. Equivalent to Matrix::RandomSparseHermitian().
| T | float, double, std::complex<float> or std::complex<double> |
| n | matrix order |
| density | target fraction of stored entries over the full n x n matrix, diagonal included; clamped to [0, 1]. The count is rounded to nearest, raised to at least n, its off-diagonal part rounded up to even, and capped at n * n. |
| batch_size | number of matrices |
| seed | RNG seed; equal seeds give identical matrices |
| diagonal_boost | margin added to each diagonal above its off-diagonal row sum |
| shared_pattern | true: every batch item has the same sparsity pattern (values still differ); false: one pattern per item |
| batchlas::invalid_argument | if n <= 0 or batch_size <= 0 |
| void batchlas::iluk_build_level_schedule | ( | ILUKPreconditioner< T > & | M | ) |
Builds the triangular-solve level schedule from M.lu's sparsity pattern.
iluk_factorize already does this; call it only for an ILUKPreconditioner assembled by hand, because iluk_apply requires a valid schedule. Runs on the host and reads M.lu's row offsets and column indices.
| M | factor whose lu, n are set; its schedule fields are overwritten |
| batchlas::invalid_argument | if M.n <= 0 |
| size_t batchlas::iluk_buffer_size | ( | Queue & | ctx, |
| const MatrixView< T, MatrixFormat::CSR > & | A, | ||
| const ILUKParams< T > & | params = ILUKParams< T >() ) |
Bytes of workspace the Span overload of iluk_factorize needs for A.
An upper bound: it sizes against the symbolic ILU(k) pattern, and the numeric phase only prunes. Costs one host-side symbolic factorization of item 0.
| ctx | queue the factorization will run on |
| A | the matrix batch that will be factored |
| params | the parameters that will be used |
| batchlas::invalid_argument | for a non-square A, out-of-range params, or validate_batch_sparsity == false with a batch of more than one |
| size_t batchlas::iluk_apply_buffer_size | ( | Queue & | ctx, |
| const ILUKView< T > & | M, | ||
| const MatrixView< T, MatrixFormat::Dense > & | rhs, | ||
| const MatrixView< T, MatrixFormat::Dense > & | out ) |
Bytes of workspace iluk_apply needs; currently always 0.
| size_t batchlas::iluk_apply_buffer_size | ( | Queue & | ctx, |
| const ILUKPreconditioner< T > & | M, | ||
| const MatrixView< T, MatrixFormat::Dense > & | rhs, | ||
| const MatrixView< T, MatrixFormat::Dense > & | out ) |
| size_t batchlas::spmm_buffer_size | ( | Queue & | ctx, |
| const MatrixView< T, MFormat > & | A, | ||
| const MatrixView< T, MatrixFormat::Dense > & | B_mat, | ||
| const MatrixView< T, MatrixFormat::Dense > & | C, | ||
| T | alpha, | ||
| T | beta, | ||
| Transpose | transA, | ||
| Transpose | transB ) |
Bytes of workspace spmm needs for these arguments.
Resolves the same route as spmm and returns that route's need; a natively routed call needs zero bytes and is sized without touching device memory. Pass exactly the arguments the spmm call will get.
| B | backend the call is compiled for |
| T | scalar type |
| MFormat | storage format of A; only MatrixFormat::CSR is instantiated |
| ctx | queue the call will run on |
| A | the sparse operand of the spmm call |
| B_mat | the dense operand of the spmm call |
| C | the output of the spmm call |
| alpha | the spmm call's alpha |
| beta | the spmm call's beta |
| transA | the spmm call's transA |
| transB | the spmm call's transB |
| batchlas::NoRouteError | under the same conditions as spmm |