math icon indicating copy to clipboard operation
math copied to clipboard

log_mix(container, container) should check first argument is simplex

Open bob-carpenter opened this issue 1 year ago • 1 comments

Description

The function log_mix taking two collections does not check that the first container is a simplex.

Expected Output

Rejection when the first argument is not a simplex, e.g.,

target += log_mix({0.5, 0.9}, {-1.2, -4.2});

Current Version:

v4.9.0

bob-carpenter avatar Nov 14 '24 22:11 bob-carpenter

If I had to theorize as to why it does not, it seems like check_simplex might not have overloads for non-Eigen containers: https://github.com/stan-dev/math/blob/develop/stan/math/prim/err/check_simplex.hpp

So that's a good place to start

WardBrian avatar Nov 15 '24 14:11 WardBrian