I was excited to see that "Feature/issue 676 generalize
operandsandpartials." was recently merged.
I re-generated the C++ code for a simple model (attached) and reduced it
to a minimum test case (also attached). I still get compiler errors
expanding the templates. The first one is,
In file included from /opt/cmdstan/stan/src/stan/io/reader.hpp:5:0,
from /opt/cmdstan/stan/src/stan/model/model_header.hpp:22,
from mvn.cpp:1:
/opt/cmdstan/stan/src/stan/prob/transform.hpp: In instantiation of ‘Eigen::Matrix<LhsScalar, -1, -1, 0> stan::prob::cov_matrix_constrain(const Eigen::Matrix<Scalar, -1, 1>&, typename stan::math::index_type<Eigen::Matrix<Scalar, -1, 1> >::type) [with T = stan::agrad::fvar<stan::agrad::var>; typename stan::math::index_type<Eigen::Matrix<Scalar, -1, 1> >::type = long int]’:
/opt/cmdstan/stan/src/stan/io/reader.hpp:1064:50: required from ‘stan::io::reader<T>::matrix_t stan::io::reader<T>::cov_matrix_constrain(std::size_t) [with T = stan::agrad::fvar<stan::agrad::var>; stan::io::reader<T>::matrix_t = Eigen::Matrix<stan::agrad::fvar<stan::agrad::var>, -1, -1, 0, -1, -1>; std::size_t = long unsigned int]’
mvn.cpp:75:19: required from ‘T__ mvn_model_namespace::mvn_model::log_prob(std::__debug::vector<T2>&, std::__debug::vector<int>&, std::ostream*) const [with bool propto__ = true; bool jacobian__ = true; T__ = stan::agrad::fvar<stan::agrad::var>; std::ostream = std::basic_ostream<char>]’
mvn.cpp:105:78: required from ‘T_ mvn_model_namespace::mvn_model::log_prob(Eigen::Matrix<T, -1, 1>&, std::ostream*) const [with bool propto = true; bool jacobian = true; T_ = stan::agrad::fvar<stan::agrad::var>; std::ostream = std::basic_ostream<char>]’
mvn.cpp:122:53: required from ‘T model_functional<M>::operator()(Eigen::Matrix<T, -1, 1>&) const [with T = stan::agrad::fvar<stan::agrad::var>; M = mvn_model_namespace::mvn_model]’
/opt/cmdstan/stan/src/stan/agrad/autodiff.hpp:207:39: required from ‘void stan::agrad::hessian(const F&, const Eigen::Matrix<double, -1, 1>&, double&, Eigen::Matrix<double, -1, 1>&, Eigen::Matrix<double, -1, -1>&) [with F = model_functional<mvn_model_namespace::mvn_model>]’
mvn.cpp:150:58: required from here
/opt/cmdstan/stan/src/stan/prob/transform.hpp:1784:49: error: call of overloaded ‘multiply_lower_tri_self_transpose(Eigen::Matrix<stan::agrad::fvar<stan::agrad::var>, -1, -1, 0, -1, -1>&)’ is ambiguous
return multiply_lower_tri_self_transpose(L);
^
/opt/cmdstan/stan/src/stan/prob/transform.hpp:1784:49: note: candidates are:
In file included from /opt/cmdstan/stan/src/stan/math/matrix.hpp:64:0,
from /opt/cmdstan/stan/src/stan/io/dump.hpp:17,
from /opt/cmdstan/stan/src/stan/model/model_header.hpp:21,
from mvn.cpp:1:
/opt/cmdstan/stan/src/stan/math/matrix/multiply_lower_tri_self_transpose.hpp:18:5: note: stan::math::matrix_d stan::math::multiply_lower_tri_self_transpose(const matrix_d&)
multiply_lower_tri_self_transpose(const matrix_d& L) {
^
In file included from /opt/cmdstan/stan/src/stan/agrad/rev/matrix.hpp:24:0,
from /opt/cmdstan/stan/src/stan/model/model_header.hpp:18,
from mvn.cpp:1:
/opt/cmdstan/stan/src/stan/agrad/rev/matrix/multiply_lower_tri_self_transpose.hpp:19:5: note: stan::agrad::matrix_v stan::agrad::multiply_lower_tri_self_transpose(const matrix_v&)
multiply_lower_tri_self_transpose(const matrix_v& L) {
^
etc...
Shall I file this as an issue? What's the next step?
--
Joshua N. Pritikin
Department of Psychology
University of Virginia
485 McCormick Rd, Gilmer Hall Room 102
Charlottesville, VA 22904
http://people.virginia.edu/~jnp3bc