docs icon indicating copy to clipboard operation
docs copied to clipboard

discuss propto with double vs. autodiff variables in User's Guide

Open bob-carpenter opened this issue 1 year ago • 2 comments

Summary:

In the User's Guide chapter on efficiency, we should discuss the tradeoff between evaluating propto=true with double and autodiff variables.

Description:

The issue is that

  • propto=true requires us to compute autodiff in order to drop normalizing constant calculations (we drop ones that aren't autodiff vars)
  • propto=false requires computation of normalizing constants over double, but no autodiff

For double input, either of these can be faster depending on how expensive the normalizing constants are to compute

Current Version:

v2.32

bob-carpenter avatar Dec 07 '23 19:12 bob-carpenter

Also tie this in to how generated quantities work, in particular for _lupdf.

To do this, we'd have to explain how the C++ class worked and how propto=true vs. propto=false works. If we exposed propto in our user-defined functions, then we'd have to define this (and I think it would be nice if we could so that we could define proper _lupdf and _lpdf versions. It might make most sense to put this description in the reference manual.

bob-carpenter avatar Dec 07 '23 19:12 bob-carpenter

stanc will prevent a program from calling a lupdf in the generated quantities block, I assume for exactly this reason

WardBrian avatar Dec 07 '23 19:12 WardBrian