CSR direct solve#
No backend solver has a native SparseMatrixCSR path. pde_solve, sparse_factorize and refactor! convert a CSR matrix to SparseMatrixCSC first, a re-layout of the triplets that costs O(nnz) and reads the index base off rowptr, so a zero-based matrix converts too. The function is _csr_to_csc in src/solvers/sparse_solvers.jl.
Refilling a VectorElement from a factorization#
LinearAlgebra.ldiv! — Tuple{Bramble.VectorElement, LinearAlgebra.Factorization, AbstractVector}
source
ldiv!(uₕ::VectorElement, A::Factorization, F) -> VectorElement
Solve A \ F and write the result into uₕ in place, mutating parent(uₕ) rather than allocating a new vector.
A is a factorize(A) (or lu/cholesky/...) reused across several solves, and F a plain vector or another VectorElement of matching length. Restricted to Factorization rather than any A: LinearAlgebra itself already overloads ldiv! for a matrix A on an unrestricted AbstractVector destination, and matching that breadth here would make every such call ambiguous between the two – Julia unable to tell whether the VectorElement destination or the Factorization source should win.
Examples
using LinearAlgebra: ldiv!
A, F = assemble(a, l; dirichlet = bcs)
uₕ = element(Wₕ)
ldiv!(uₕ, factorize(A), F)