Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

error on a function with DiffEqOperators #35

Open
Eben60 opened this issue Jun 7, 2020 · 2 comments
Open

error on a function with DiffEqOperators #35

Eben60 opened this issue Jun 7, 2020 · 2 comments

Comments

@Eben60
Copy link

Eben60 commented Jun 7, 2020

The following code (MWE) results in
LoadError: MethodError: objects of type TypeVar are not callable
Both Win10 and Mac, Julia 1.4.2, freshly updated all packages (SparsityDetection 0.3.2, DiffEqOperators 4.10.0)

using DiffEqOperators
using SparsityDetection, SparseArrays

nknots = 10
h = 1.0/(nknots+1)

const Δ = CenteredDifference(2, 2, h, nknots)
u0 = rand(nknots, nknots)

function st!(du,u,p,t)
   du .= 0.0
   du[1,:] .= Δ*Dirichlet0BC(Float64)*view(u,1,:)
   return nothing
end

outp = similar(u0)
# st!(outp,u0, nothing, 0.0)
sparsity_pattern = jacobian_sparsity(st!,outp,u0, nothing, 0.0)

@ChrisRackauckas
Copy link
Member

The quickest way to get the sparsity pattern here would be to just directly make SparseMatrixCSC(Δ*Dirichlet0BC(Float64)) and the sparsity is then clear from there. That should work on any DiffEqOperators problem.

@Eben60
Copy link
Author

Eben60 commented Jun 24, 2020

Chris, thank you for the advice. I have in the meanwhile just got the sparsity pattern numerically. It may take a few minutes to calculate, but then I save it onto the disk, so I have to do it only once for every mesh size.

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

No branches or pull requests

2 participants