Closed SKopecz closed 2 months ago
Is there an efficient way to add the diagonal to the sparsity pattern of a given matrix @ranocha? Or shall we just add a sparse diagonal matrix to p_protoype
?
Is there an efficient way to add the diagonal to the sparsity pattern of a given matrix @ranocha? Or shall we just add a sparse diagonal matrix to
p_protoype
?
This is only required once when setting up the prototype, isn't it? I would try to add I
from LinearAlgebra
or an appropriate spdiagm
The benchmark results in the "Linear Advection Tutorial" show that using a
SparseMatrix
is not much faster compared to a dense matrix. Moreover, the number of allocations is increased tremendously. See https://skopecz.github.io/PositiveIntegrators.jl/previews/PR96/linear_advection/ or the local results forN=100
below.To see the efficiency of sparse matrices we need to add specializations for general sparse matrices.
Another big problem related to the linear advection tutorial is that
p_prototype
in this case does not include the diagonal of the matrix in its sparsity pattern. Using this sparsity pattern to build the MPRK matrix requires adding values to the diagonal, which is inefficient. To avoid this problem we need to make sure, that the diagonal is included in the sparsity pattern ofp_prototype
.