Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Combine multiple operators fails #342

Open
bolasim opened this issue Mar 6, 2021 · 0 comments
Open

Combine multiple operators fails #342

bolasim opened this issue Mar 6, 2021 · 0 comments

Comments

@bolasim
Copy link

bolasim commented Mar 6, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants