stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
140 stars 44 forks source link

wishart_cholesky signatures #1188

Closed spinkney closed 2 years ago

spinkney commented 2 years ago

Submission Checklist

Adds wishart_cholesky_lpdf and wishart_cholesky_rng.

Release notes

Added wishart_cholesky_lpdf and wishart_cholesky_rng distribution functions.

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)

WardBrian commented 2 years ago

I think this distribution should also be added to the Pedantic mode warnings for using it without a cholesky matrix.

See: https://github.com/stan-dev/stanc3/blob/762f03026bfbc83007cd18692d3362bc0d0c60d0/src/analysis_and_optimization/Pedantic_dist_warnings.ml#L246 Example: https://github.com/stan-dev/stanc3/blob/762f03026bfbc83007cd18692d3362bc0d0c60d0/src/analysis_and_optimization/Pedantic_dist_warnings.ml#L423-L424

WardBrian commented 2 years ago

@spinkney it looks like you need to run make format; dune promote to get CI to run. The code itself looks good

WardBrian commented 2 years ago

Failures look like it's due to the fact that we implictly add a _log function even though this has been deprecated, and I'm guessing the stan-math PR didn't add one?

spinkney commented 2 years ago

that's right, I didn't add one

WardBrian commented 2 years ago

Yeah, we honestly shouldn’t be adding new _log signatures at this point since we’re going to remove them all so soon. Tomorrow I’ll look at re-writing how we add these signatures to let us not add it for things that didn’t have it before.

spinkney commented 2 years ago

will this add an lupdf signature?

WardBrian commented 2 years ago

All lpdf signatures are implicitly lupdf signatures as well I believe

spinkney commented 2 years ago

ok, honestly I wasn't sure how that was going to get done b/c they aren't in stan-math

WardBrian commented 2 years ago

It’s not a bad idea to add some calls of it to the test file. The way we handle lupdfs is honestly pretty poorly, when typechecking we detect unnormalized suffixes and temporarily replace them with the normalized versions to see if the signatures work

WardBrian commented 2 years ago

@spinkney if you merge master into this it should now not try to add the log suffix by default

spinkney commented 2 years ago

@WardBrian it still added _log :(

WardBrian commented 2 years ago

It looks like it just needs to have the test output updated

WardBrian commented 2 years ago

I think you still removed the log suffix from the old Wishart in the merge, which is why the latest tests failed

WardBrian commented 2 years ago

This is now passing. Once the docs PR gets approved we can merge - not confident enough in the theory to review the docs myself