DiffEqOperators.jl
DiffEqOperators.jl copied to clipboard
Combine multiple operators fails
I am trying to build a 2D Laplacian. All my 1D derivatives work fine as follows
Dx = CenteredDifference{1}(1, order, Δx, N)
Dy = CenteredDifference{2}(1, order, Δy, N)
DDx = CenteredDifference{1}(2, order, Δx, N)
DDy = CenteredDifference{2}(2, order, Δy, N)
dd = sum([DDx, DDy])
where dd is my Laplacian of type DiffEqOperatorCombination.
When I try to concertize or do any operations with this new combined operators, I get the following errors:
julia> SparseMatrixCSC(dd)
ERROR: MethodError: no method matching SparseMatrixCSC(::DiffEqOperators.DiffEqOperatorCombination{Float64,Tuple{DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},DerivativeOperator{Float64,2,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing}},Array{Float64,1}})
Closest candidates are:
SparseMatrixCSC(::LinearAlgebra.SymTridiagonal{Tv,V} where V<:AbstractArray{Tv,1}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/SparseArrays/src/sparsematrix.jl:485
SparseMatrixCSC(::LinearAlgebra.Tridiagonal{Tv,V} where V<:AbstractArray{Tv,1}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/SparseArrays/src/sparsematrix.jl:456
SparseMatrixCSC(::LinearAlgebra.Symmetric) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/SparseArrays/src/sparseconvert.jl:21
...
Stacktrace:
[1] top-level scope at REPL[139]:1
and
julia> BandedMatrix(dd)
ERROR: MethodError: no method matching BandedMatrix(::DiffEqOperators.DiffEqOperatorCombination{Float64,Tuple{DerivativeOperator{Float64,1,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing},DerivativeOperator{Float64,2,false,Float64,StaticArrays.SArray{Tuple{3},Float64,1,3},StaticArrays.SArray{Tuple{0},StaticArrays.SArray{Tuple{4},Float64,1,4},1,0},Nothing,Nothing}},Array{Float64,1}})
Closest candidates are:
BandedMatrix(::Union{FillArrays.RectDiagonal{T,Ones{T,1,Tuple{Axes}},Axes1}, LinearAlgebra.Diagonal{T,Ones{T,1,Tuple{Axes}}}} where Axes1 where Axes, ::Tuple{Integer,Integer}) where T at /home/bsm/.julia/packages/BandedMatrices/xeTTI/src/banded/BandedMatrix.jl:193
BandedMatrix(::BandedMatrix{V,CONTAINER,RAXIS} where RAXIS where CONTAINER) where V at /home/bsm/.julia/packages/BandedMatrices/xeTTI/src/banded/BandedMatrix.jl:73
BandedMatrix(::AbstractArray{T,2} where T) at /home/bsm/.julia/packages/BandedMatrices/xeTTI/src/banded/BandedMatrix.jl:209
...
Stacktrace:
[1] top-level scope at REPL[136]:1
Finally, concretizing DDx and DDy then adding them produces the wrong stencil for the operation.