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

Use finite-differences where forward-mode not implementable #2842

Open
andrjohns opened this issue Nov 2, 2022 · 1 comment
Open

Use finite-differences where forward-mode not implementable #2842

andrjohns opened this issue Nov 2, 2022 · 1 comment

Comments

@andrjohns
Copy link
Collaborator

andrjohns commented Nov 2, 2022

Description

As discussed over in #2839, the ODE methods are not fvar<T> compatible, and it would be a significant amount of work to do so. This means that any downstream methods depending on fvar<> or higher-order autodiff will fail to compile, a current example of this is the new $hessian() method in cmdstanr.

In these instances it would be great to have a method that "works", even if it's slow - better to have in a limited form than to not have at all (imo).

Boost Math has existing optimised routines for finite-differencing, including the use of the complex step approximation for any complex-compatible functions (allowing for estimating the derivative with a single function evaluation)

Current Version:

v4.4.0

@WardBrian
Copy link
Member

Here's a list of functions exposed in the Stan language which would be candidates to use with stan/math/fwd/functor/finite_diff.hpp:

  • integrate_1d (Framework for generic fvar<T> support through finite-differences #2929)
  • map_rect
  • reduce_sum and reduce_sum_static
  • ode_bdf_tol, ode_rk45_tol, ode_adams_tol, ode_bdf, ode_rk45, ode_adams, ode_ckrk, ode_ckrk_tol, ode_adjoint_tol_ctl (I think doing these would automatically add support for the historical integrate_ode_* variants?)
  • dae and dae_tol
  • solve_newton, solve_newton_tol, solve_powell, and solve_powell_tol (Again, I am hoping that algebra_solver_* would come for free if we did these)

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

No branches or pull requests

2 participants