Vectorise ternary functions
Description
As with the unary and binary functions, it would useful to add a framework for vectorising ternary functions (like fma, inc_beta, and if_else).
Eigen has a framework CwiseTernaryOp which we can use in combination with the existing apply_scalar_binary framework to cover the various combinations
Current Version:
v4.2.1
Great! if_else() is deprecated and will not be supported as of Stan 2.32, so there is probably no need to bother with that one?
Ah cool. How does stanc3 handle the ternary operator? I was thinking that the vectorised if_else would allow us to have vectorised ternary expressions as well
With the ternary C++ operator:
real a = k > 0 ? 5 : 10;
is generated as:
a = (logical_gt(k, 0) ? 5 : 10);
Maybe we should think about using if_elsefor that case though. So the ternary operator in Stan is generated to if_else. Maybe open an issue in stanc3 so we discuss it?
Sounds good, will do!