stan icon indicating copy to clipboard operation
stan copied to clipboard

Add var<matrix> creation methods for reader

Open SteveBronder opened this issue 5 years ago • 1 comments

Summary:

For reader.hpp we need methods for static_matrix(i, j) and static_vector(i) to read in a static matrix. One small issue atm is that when we call log_prob_grad or log_prob_propto we pass in a vector of var types to the model's log prob that is then sent into the reader to be deserialized into the model's containers. This means that in the static_matrix etc functions we will have to do a to_var_matrix() and do a full copy. Though idt there's any non-trivial way to get rid of that copy.

Current Version:

v2.24.0

SteveBronder avatar Aug 31 '20 16:08 SteveBronder

The only thing I can think of is actually passing in a var<mat> to the model's log_prob and doing the unpacking for the dynamic case. On one hand that feels nice but unless we did something clever with the views in #2024 I think this would end up with more copies (since right now a "copy" of a var to a var is really just a copy of a pointer)

SteveBronder avatar Aug 31 '20 16:08 SteveBronder