Can you try by first importing Stan/math/mix/mat.hpp?
All bets are off if you include in the order you’ve included things in. There might be problems if you’ve included Eigen before this file too, but maybe including the right header would fix it.
I can definitely reproduce the problem under develop. I don’t know if this ever worked, but right now, it doesn’t look like you can subtract a Eigen Vector of fvar<double> from double. This currently doesn’t work (including either stan/math/fwd/mat.hpp or stan/math/mix/mat.hpp):
@Davor_Sluga: if you’re really getting comfortable with forward mode, this is something that should be looked into. I don’t have the slightest clue where to start, though.
We implement operator- for all the scalar types in fvar/core. The error message you’re getting is when Eigen tries to mix types, which it won’t allow (at least not without some more traits hints from us).
Oh, forgot the fix. You can use add(x, y) or subtract(x, y), but they do inefficient promotion. See the implementations in the math repo in stan/math/prim/mat/fun/.
OK, that works. But I’m still not sure why you can just use the subtraction sign when subtracting a double vector from a var vector but have to use the subtract function when subtracting a double vector from a fvar<var> vector.