Closed WardBrian closed 1 year ago
I agree this is going to be super useful. And thanks for catching the alternative vectorization cases, @nhuurre.
@nhuurre great catches!
My latest two commits:
size(y)
if none of the later args are vectorsT[U, L]
vector case. lupdf
statement above this logic. I believe this is sound (they're both just accumulation statements), my reasoning is that item 2 here could generate a weird error if size(mu) != size(sigma)
, but the normal_lupdf
call will necessarily check this and produce a nice error if it is not true.Thanks @nhuurre. I just circled back to improve the error message which will show if a vectorized lcdf is not available and add a test for that.
I'll merge after the tests pass.
Closes #788. This allows statements like
In place of
We previously translated the loop into (MIR syntax):
We now turn the vectorized version into
NB the calls to
min
,max
, and the multiplication bysize(y)
. This formulation is based on #788 and the linked thread, but also to me seems more or less necessarily equivalent to the for loop.Submission Checklist
Release notes
Vectorized sampling statements can now be used with the truncation syntax
T[ , ]
Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)