-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Fix: Eigen double to matrix var assignment #3049
Conversation
…4.1 (tags/RELEASE_600/final)
…dev/stan into fix/matrix-var-eigen-double-assign
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few more
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
Shoot it won't let me click the merge button, can someone click it? |
Submission Checklist
./runTests.py src/test/unit
make cpplint
Summary
This fixes the
assign()
errors from stan-dev/stanc3#898 for doingvar<Matrix> = Eigen::Matrix<double>
. Combining this with stan-dev/math#2535 removed the errors on the sample of test models I tried out in the stanc test suite that were previously failing.Explicit paths had to be added in the callbacks for assignment using
index_uni
andindex_multi
. For all the other functions I wrote aassign_impl()
function that is justA = B
for all cases besidesvar<Matrix> = Eigen::Matrix<double>
. For that case we do a procedure to update the var values and then in a reverse pass callback put back the old values and reset the adjoints to zero.Intended Effect
Allow assignment from
Eigen::Matrix<double>
tovar<Matrix>
in the stanc generated C++.How to Verify
All the old tests for
var<Matrix>
assignment were pulled out and made into functions that test assignment from both avar<Eigen::Matrix<double>>
andEigen::Matrix<double>
. These can be run withSide Effects
None
Documentation
Docs added for new
assign_impl()
function.Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Steve Bronder
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: