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
The deep_copy function is applied to right-hand sides of assignments to avoid aliasing. However, all of our array slicing makes a copy itself, so this isn't necessary.
Also, if we don't use deep_copy anywhere else in the code base, we can remove the deep_copy function too (I'm not sure if this is defined in this repo or in stan-dev/math; if the latter, we'll need a new issue).
Summary:
The
deep_copy
function is applied to right-hand sides of assignments to avoid aliasing. However, all of our array slicing makes a copy itself, so this isn't necessary.Also, if we don't use
deep_copy
anywhere else in the code base, we can remove thedeep_copy
function too (I'm not sure if this is defined in this repo or instan-dev/math
; if the latter, we'll need a new issue).Reproducible Steps:
You can test this with:
and get the right answer in the current setup which forgot to include the
deep_copy
,Current Output:
Expected Output:
This is correct, so we don't need the
deep_copy
. Here's the generated C++ to validate there's no deep copy happening:Current Version:
v2.18.0
The text was updated successfully, but these errors were encountered: