Ambiguity between `fwd` and `mix` signatures for `hessian()`
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Description
With the current signatures for hessian in fwd and mix, it is not possible to call the fwd implementation with double types.
mix/functor/hessian.hpp:
template <typename F>
void hessian(const F& f, const Eigen::Matrix<double, Eigen::Dynamic, 1>& x,
double& fx, Eigen::Matrix<double, Eigen::Dynamic, 1>& grad,
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>& H)
fwd/functor/hessian.hpp:
template <typename T, typename F>
void hessian(const F& f, const Eigen::Matrix<T, Eigen::Dynamic, 1>& x, T& fx,
Eigen::Matrix<T, Eigen::Dynamic, 1>& grad,
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>& H)
Because the scalar type is explicit in the mix signature and templated in the fwd signature, calls to hessian with double types will always resolve to the mix implementation. This makes testing/validation (or even just use as an alternative) a bit of a hurdle.
I think any kind of fix for this would imply a breaking change (changing function names/arguments), so could be bundled in the 5.0 release (@SteveBronder)?
Current Version:
v4.8.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the overloads in mix/functor/hessian.hpp and fwd/functor/hessian.hpp, then reproduce the reported call-resolution behavior with double types. Determine an API change that lets the fwd implementation be called for validation without creating unresolved ambiguity, and confirm the result against the stated v4.8.1 behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100