Skip to content

Add method for computing the hessian of a scalar-valued function#126

Merged
marcelluethi merged 2 commits into
dimwit-dev:mainfrom
marcelluethi:hessian
Jul 10, 2026
Merged

Add method for computing the hessian of a scalar-valued function#126
marcelluethi merged 2 commits into
dimwit-dev:mainfrom
marcelluethi:hessian

Conversation

@marcelluethi

Copy link
Copy Markdown
Contributor

This PR proposes two changes:

  1. To add a hessian method, which computes the hessian matrix for a (tuple) of tensors.
  2. To add a ravel method to TensorTree, which can be used to flatten/unflatten a TensorTree to a Tensor1. This is useful in its own right, but the motivation here is as a support function for Hessian and Jacobian methods, which can only work with (tuple) of tensors, but not case classes.

It is sometimes useful to be able to
flatten a Tensortree into a single Vector and unflatten it again. This is, for example useful for working with Jacobian or hessian, which are only defined for tensors and tuple of tensors, but not arbitrary case classes.
@marcelluethi
marcelluethi requested a review from benikm91 July 7, 2026 19:05
@marcelluethi
marcelluethi merged commit b2a96bb into dimwit-dev:main Jul 10, 2026
1 check 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