You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doxygen/contributor_help_pages/getting_started.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -660,9 +660,15 @@ The values of `x` have the same shape as `x`.
660
660
661
661
### Values and adjoint extensions to Eigen
662
662
663
-
The matrix and vector autodiff types come with an extra `.val()` and `.adj()`, member functions called `.val_op()` and `.adj_op()`.
664
-
These `*_op()` member functions are used as a workaround for a bug in Eigen where transpose expressions will be inaccessible because of an incorrect const reference.
665
-
See [here](https://github.com/stan-dev/math/issues/2653) for the details and other information for when this workaround is needed.
663
+
By default, `.val()` and `.adj()` return a `CwiseUnaryView` when the matrix/vector is non-`const`,
664
+
and returns a `CwiseUnaryOp` when the matrix/vector is `const`. The exception is that
665
+
calling `.val()` on a matrix/vector of `var` types will always return a `CwiseUnaryOp`, as the
666
+
underlying value is always `const`.
667
+
668
+
However, using a `CwiseUnaryView` in some Eigen operations (e.g., multiplication, transposition)
669
+
can result in a compilation error. To workaround this, the `.val_op()` and `.adj_op()` member
670
+
functions have been added to explicitly request a `CwiseUnaryOp` regardless of whether the
671
+
matrix/vector is `const` or not.
666
672
667
673
The member functions `.val()` and `.val_op()` return expressions that evaluate to the values
0 commit comments