Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function get_sparsity_pattern #307

Merged
merged 7 commits into from
Nov 27, 2024
Merged

Add a function get_sparsity_pattern #307

merged 7 commits into from
Nov 27, 2024

Conversation

amontoison
Copy link
Member

@amontoison amontoison commented Nov 25, 2024

close #300
@frapac @sshin23 @jbcaillau @tmigot

I added a function, get_sparsity_pattern, to easily extract the sparsity pattern of the Jacobian or the Hessian of the Lagrangian from any ADNLPModel or ADNLSModel:
https://jso.dev/ADNLPModels.jl/previews/PR307/sparse/#Extracting-sparsity-patterns

This could help detect specific patterns that can be exploited in the linear algebra computations.
Additionally, if a problem needs to be solved multiple times, we can skip the sparsity pattern detection step by directly injecting the previously extracted pattern.

Example: https://jso.dev/ADNLPModels.jl/dev/sparsity_pattern/

Copy link
Member

@tmigot tmigot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @amontoison !
Here is a first batch of comments.

docs/src/sparse.md Outdated Show resolved Hide resolved
docs/src/sparse.md Show resolved Hide resolved
docs/src/sparse.md Outdated Show resolved Hide resolved
docs/src/sparse.md Outdated Show resolved Hide resolved
docs/src/sparse.md Show resolved Hide resolved
src/sparsity_pattern.jl Outdated Show resolved Hide resolved
src/sparsity_pattern.jl Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Nov 25, 2024

Package name latest stable
ExpressionTreeForge
JSOSuite
PartiallySeparableNLPModels
PartiallySeparableSolvers
SolverTest

Copy link
Member

@tmigot tmigot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just made a cosmetic comment, otherwise it's good to me. Thanks!

src/sparsity_pattern.jl Outdated Show resolved Hide resolved
@amontoison
Copy link
Member Author

Thanks for the review @tmigot 👍

@amontoison amontoison merged commit 1638856 into main Nov 27, 2024
29 of 31 checks passed
@amontoison amontoison deleted the auto_sparse branch November 27, 2024 00:19
amontoison added a commit that referenced this pull request Nov 27, 2024
* Add a function get_sparsity_pattern

* Fix an error in sparsity_pattern.jl

* Apply suggestions from code review

Co-authored-by: Tangi Migot <[email protected]>

* Fix a typo

* Use multiple dispatch for get_sparsity_pattern

* Fix sparse.md

* Update src/sparsity_pattern.jl

Co-authored-by: Tangi Migot <[email protected]>

---------

Co-authored-by: Tangi Migot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a function to get the sparsity patterns from an ADNLPModel
2 participants