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

Incorrect sparsity pattern on simple example #42

Closed
thowell opened this issue Jul 16, 2020 · 1 comment
Closed

Incorrect sparsity pattern on simple example #42

thowell opened this issue Jul 16, 2020 · 1 comment

Comments

@thowell
Copy link

thowell commented Jul 16, 2020

Hello! Awesome package.

I'm trying to extend the examples and have found a simple case that fails:

function f!(dx,x)
dx[1:5] = x[1:5] + x[1:5]
nothing
end
output = zeros(5)
input = ones(5)
sparsity!(f!,output,input)

The above function 'f' should return the same sparsity pattern as the function 'g' below:

function g!(dx,x)
dx[1:5] = x[1:5]
nothing
end

but when called on 'f' the sparsity pattern returned is empty.

Is my usage incorrect?

@ChrisRackauckas
Copy link
Member

Hey, this package will soon be supersceded by ModelingToolkit's sparsity detection algorithms, which are documented here: https://mtk.sciml.ai/dev/highlevel/#Sparsity-Detection-1 . You might want to try those since it's more robust. See https://mtk.sciml.ai/dev/tutorials/auto_parallel/ as an example with automated sparse Jacobians, or you can replace the actual symbolic Jacobians with just jacobian_sparsity to get the sparsity pattern and it's effectively the same algorithm as what's done here, except using MTK for the abstract interpretation.

@thowell thowell closed this as completed Jul 17, 2020
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