stan-dev / stan-dev/math

Make functions with custom autodiff `var<mat>` friendly

Open
#2,101 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

This issue is part of https://github.com/stan-dev/math/issues/1805.

The goal is to convert every function with custom reverse mode autodiff to accept var_value<Eigen::Matrix<T, R, C>> types as arguments. The implementations should probably be based off https://github.com/stan-dev/math/issues/2018 (it's fine if they beat that in, I can just remove them from #2018).

Edit this list and check off functions as they're implemented in develop:

  • softmax
  • sum
  • multiply
  • elt_multiply #2121
  • dot_self #2106
  • columns_dot_self #2106
  • determinant #2106
  • inverse #2106
  • log_determinant #2106
  • multiply_lower_tri_self_transpose #2106
  • tcrossprod #2106
  • matrix_power #2106
  • ordered_constrain #2106
  • positive_ordered_constrain #2106
  • simplex_constrain #2106
  • unit_vector_constrain #2106
  • var_value.transpose #2163
  • dot_product #2106 and #2150
  • variance #2168
  • divide #2171
  • elt_divide #2171
  • operator+ #2115
  • quad_form #2164
  • trace_quad_form #2164
  • columns_dot_product #2199
  • rows_dot_prod #2199
  • log_sum_exp #2106 (partial), #2169 (the rest)
  • sd #2169
  • log_softmax #2169
  • operator- #2196
  • squared_distance #2212
  • ordered_constrain
  • positive_ordered_constrain
  • unit_vector_constrain
  • log_determinant_spd #2232
  • mdivide_left_spd #2213
  • mdivide_left_tri #2213
  • mdivide_left #2230
  • exp #2254
  • tanh #2254
  • log1m #2254
  • square #2254
  • cholesky_corr_constrain #2254
  • cholesky_factor_constrain #2254
  • corr_matrix_constrain #2254
  • cov_matrix_constrain_lkj #2254
  • cov_matrix_constrain #2254
  • read_cov_matrix #2254
  • read_corr_matrix #2254
  • read_corr_L #2254
  • read_cov_L #2254
  • log #2254
  • inv_logit #2254
  • multiply_log #2254
  • dot_product #2305

In Progress:

  • mdivide_left_ldlt #2266
  • log_determinant_ldlt #2266
  • trace_gen_inv_quad_form_ldlt #2266
  • trace_inv_quad_form_ldlt #2266
  • trace_gen_quad_form #2280
  • trace #2284
  • check_symmetric #2284
  • matrix_normal_prec_log #2284
  • matrix_normal_prec_lpdf #2284
  • multi_gp_lpdf #2284
  • multi_normal_lpdf #2284
  • multi_normal_prec_lpdf #2284
  • multi_student_t_lpdf #2284
  • inv_wishart_lpdf #2284
  • wishart_lpdf #2284
  • simplex_constrain #2285
  • lb_constrain #2285
  • ub_constrain #2285
  • lub_constrain #2285

Originally on the todo list but I'm taking them off for now:

  • fma
  • cov_exp_quad
  • gp_exp_quad_cov
  • gp_periodic_cov
Current Version:

v3.3.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the remaining function list, especially mdivide_left_ldlt, trace, check_symmetric, and the distribution functions, and review the related issues #2266, #2280, #2284, and #2285. Check how custom reverse-mode autodiff functions accept var_value<Eigen::Matrix<T, R, C>> arguments. Done means all intended functions support these arguments and the checklist is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.