Skip to content

Add option to store the previous Jacobian in ShiftedComposite#150

Merged
MaxenceGollier merged 7 commits intoJuliaSmoothOptimizers:masterfrom
MaxenceGollier:update_shiftedcomposite
Jan 12, 2026
Merged

Add option to store the previous Jacobian in ShiftedComposite#150
MaxenceGollier merged 7 commits intoJuliaSmoothOptimizers:masterfrom
MaxenceGollier:update_shiftedcomposite

Conversation

@MaxenceGollier
Copy link
Copy Markdown
Collaborator

@MaxenceGollier MaxenceGollier commented Nov 30, 2025

@dpo,

This is useful when i make quasi-Newton updates for the Hessian of the Lagrangian (eq 18.13 in Nocedal & Wright).
Additionnally, I add full row rankness of the Jacobian as a struct field.

I used this code a few months ago for the different benchmarks in the SIOPT paper.

I will need a bump to a new version afterwards.

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.39%. Comparing base (753a97f) to head (362053c).
⚠️ Report is 25 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #150      +/-   ##
==========================================
+ Coverage   73.71%   77.39%   +3.67%     
==========================================
  Files          22       24       +2     
  Lines         898      969      +71     
==========================================
+ Hits          662      750      +88     
+ Misses        236      219      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaxenceGollier MaxenceGollier force-pushed the update_shiftedcomposite branch from 6684609 to 8cd8013 Compare November 30, 2025 22:34
Copy link
Copy Markdown
Member

@dpo dpo left a comment

Choose a reason for hiding this comment

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

Just a quick comment for now. I didn't look at the details, but the unit tests are failing.

)
end

A_prev = store_previous_jacobian ? copy(A) : nothing
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't there going to be a new allocation on each copy here? What kind of type is M? Maybe this is where copyto!() is useful?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

M is a SparseMatrixCOO, i added a commit to make copies on shift!, I am not sure whether copyto!() is really necessary.

copy is fine in the constructor.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

copy makes a copy, i.e., allocates a new object.

Copy link
Copy Markdown
Collaborator Author

@MaxenceGollier MaxenceGollier Dec 2, 2025

Choose a reason for hiding this comment

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

When we construct the object we expect to allocate a copy of A i don't see where else we should allocate it than in the constructor ?!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand now. Thanks.

@MaxenceGollier
Copy link
Copy Markdown
Collaborator Author

MaxenceGollier commented Dec 1, 2025

They are indeed failing but I am not sure why, it looks like they are failing on unrelated code.

Moreover, it is weird to check for 16 allocations in test-allocs.jl.

@dpo
Copy link
Copy Markdown
Member

dpo commented Dec 2, 2025

Something allocated before no longer does (probably because of updates to julia itself). Something that didn't allocate before now allocates. So the tests will have to be adjusted.

@MaxenceGollier MaxenceGollier requested a review from dpo December 9, 2025 14:02
@MaxenceGollier
Copy link
Copy Markdown
Collaborator Author

MaxenceGollier commented Dec 9, 2025

Something allocated before no longer does (probably because of updates to julia itself). Something that didn't allocate before now allocates. So the tests will have to be adjusted.

Done in #151

@MaxenceGollier
Copy link
Copy Markdown
Collaborator Author

@dpo, can you review when you have some time ? I think this is ready.

@MaxenceGollier
Copy link
Copy Markdown
Collaborator Author

@dpo,
It's been a while now, could you review this when you have some time ? I have a PR waiting for this to be merged.

Thank you and happy new year.

Copy link
Copy Markdown
Member

@dpo dpo left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you!

@MaxenceGollier MaxenceGollier merged commit 268af6f into JuliaSmoothOptimizers:master Jan 12, 2026
12 of 13 checks passed
@MaxenceGollier MaxenceGollier deleted the update_shiftedcomposite branch January 12, 2026 19:37
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.

2 participants