Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined densities allowed over nested and complex values. #1046

Merged
merged 2 commits into from
Nov 19, 2021

Conversation

WardBrian
Copy link
Member

@WardBrian WardBrian commented Nov 18, 2021

Closes #1045. The is_int_type and is_real_types now check the type recursively to handle nesting, and lpdf is defined not by 'takes a real as the first argument' but (properly) as 'does not take an int as the first argument'

Submission Checklist

  • Run unit tests
  • Documentation
    • OR, no user-facing changes were made
      This is consistent with the final paragraph given here already

Release notes

Allow user-defined densities over complex arguments and deeply nested arguments.

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 WardBrian requested a review from nhuurre November 18, 2021 21:34
@nhuurre
Copy link
Collaborator

nhuurre commented Nov 18, 2021

Oh cool, I forgot about the complex type.
I'm going to point out that technically we also have function types and I don't think they should be allowed in _lpdfs. It's not possible to name them at the moment so it doesn't really matter until Stan gets closures.

@WardBrian
Copy link
Member Author

WardBrian commented Nov 18, 2021

Yeah, we can cross that bridge once a user could actually try to write a function type as an argument declaration. Something like UnsizedType.is_numeric_type && not UnsizedType.is_int_type (we'd have to define the first function if we haven't already, but it's easy)

Copy link
Collaborator

@nhuurre nhuurre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@WardBrian WardBrian merged commit 65b9c6a into stan-dev:master Nov 19, 2021
@WardBrian WardBrian deleted the lpdf_typing branch November 24, 2021 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency in allowed arguments to lpdf, lpmf, and _log functions
2 participants