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 alternative form of weighted Gauss-Newton nonlinear solve #723

Merged
merged 7 commits into from
Feb 14, 2025

Conversation

cwentland0
Copy link
Contributor

Adds a new nonlinear solver tag and accompanying functions (including an overload of create_gauss_newton_solver) that just redefines the action of the weighting function in the weighted Gauss-Newton solve, such that

H = (J^T_r * W^T) * (W * J_r)
g = (J^T_r * W^T) * (W * r)

That is, the implied W^T * W should be exactly the same as in the W in the original weighted Gauss-Newton solve, but the order of operation allows for fewer FLOPs and lower memory usage if the first dimension of W is smaller than its second dimension. This is particularly important for gappy POD simulations where the first dimension of W would be the number of modes, and the second dimension is the number of residual samples.

Adds test using the new CompactWeightedGaussNewtonNormalEqTag.

@fnrizzi
Copy link
Member

fnrizzi commented Feb 4, 2025

looks good, overall!
One request please: any chance you can add a test where the weighting is actually used and non-trivial?

@cwentland0
Copy link
Contributor Author

I've added the non-trivial test, which actually exposed a bug that I had previously hacked around. To resolve that issue I had to add a new nonlinear solver registry since the standard weighted Gauss-Newton registry assumes that Wr and WJ have the same leading dimension as r and J, which is not the case with the compact weighting scheme. It requires that the weigher have a member leading_dim to resize the registry variables d5_ and d6_, not sure how you feel about that.

d11_(&system){
// resize leading dimension according to weighing operator
pressio::ops::resize(d5_, weigher.leading_dim);
pressio::ops::resize(d6_, weigher.leading_dim, pressio::ops::extent(d6_, 1));
Copy link
Member

Choose a reason for hiding this comment

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

please change this to avoid public members, so that the weigher class has a method weigher.leadingDim()

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@fnrizzi fnrizzi left a comment

Choose a reason for hiding this comment

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

see my comment, if you make that change and all tests pass we are good

@cwentland0 cwentland0 requested a review from fnrizzi February 13, 2025 23:51
@fnrizzi fnrizzi merged commit 4077a90 into Pressio:develop Feb 14, 2025
17 checks passed
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