Stan functions work on Eigen::Matrix but not on Eigen::Map. The error occurs for examplew ith
elt_multiply, with the following message:
/stan/math/prim/mat/fun/elt_multiply.hpp:25:1: note: candidate template ignored: could not match 'Matrix' against 'Map' elt_multiply(const Eigen::Matrix<T1, R, C>& m1,
But in some cases, it could be handy to use Stan functions directly on
Map. Is there a good workaround this, that doesn’t involve creating a new Matrix – and essentially duplicating the object?
Edit: how expensive is it actually to duplicate a matrix?