Skip to content

More helpful error when passing vector or tensor to compute_hessian#231

Merged
joewallwork merged 3 commits intomainfrom
224_compute-hessian-vector-error
Mar 6, 2026
Merged

More helpful error when passing vector or tensor to compute_hessian#231
joewallwork merged 3 commits intomainfrom
224_compute-hessian-vector-error

Conversation

@joewallwork
Copy link
Member

Closes #224.

As reported by @Patol75 in #224, the error message isn't particularly helpful if you pass a vector or tensor field to RiemannianMetric.compute_hessian. This PR hopefully fixes that.

@joewallwork joewallwork self-assigned this Mar 5, 2026
@joewallwork joewallwork added the bug Something isn't working label Mar 5, 2026
Copy link
Collaborator

@stephankramer stephankramer 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

Copy link
Collaborator

@stephankramer stephankramer left a comment

Choose a reason for hiding this comment

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

Oh actually, looking at the CI errors: I do think we should allow the input of compute_hessian to be a (UFL) scalar expression rather just a single function - which it indeed appears we are testing for

Co-authored-by: Stephan Kramer <s.kramer@imperial.ac.uk>
@joewallwork joewallwork merged commit ed14970 into main Mar 6, 2026
1 check failed
@joewallwork
Copy link
Member Author

Oops I accidentally pushed my fix to main rather than this branch. I'll disallow bypassing the branch protection rule to stop that happening again.

Interesting that it auto-closed this PR.

@joewallwork joewallwork deleted the 224_compute-hessian-vector-error branch March 6, 2026 08:25
@stephankramer
Copy link
Collaborator

Ah good to protect it, would have happened to me at some point otherwise!

joewallwork added a commit that referenced this pull request Mar 6, 2026
Follow up for the remaining fixes after accidentally merging #231.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compute_hessian fails when given a vector field

2 participants