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

Wishart rand promotes to Float64 #1666

Closed
bvdmitri opened this issue Jan 27, 2023 · 1 comment
Closed

Wishart rand promotes to Float64 #1666

bvdmitri opened this issue Jan 27, 2023 · 1 comment

Comments

@bvdmitri
Copy link
Contributor

The following code should not promote to Float64

julia> Wishart(3f0, [ 1f0;; ]) |> rand
1×1 Matrix{Float64}:
 1.7289491201235807

Works fine for other distributions (I didn't check all of them though):

julia> Normal(0f0, 1f0) |> rand
0.4961709f0

julia> MvNormal([ 0f0 ], [ 1f0 ]) |> rand
1-element Vector{Float32}:
 -0.06129361

logpdf seems to be fine for Wishart:

julia> logpdf(Wishart(3f0, [ 1f0;; ]), [1f0;;])
-1.4189385f0
@devmotion
Copy link
Member

The weird ones are actually Normal/MvNormal - generally, samples are not supposed to be related to the type of the parameters, i.e., eltype and partype are different things.

There are a few related issues (e.g., #1071, #960) and even an open (but outdated) PR: #1433 so I'll close this issue as a duplicate.

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

No branches or pull requests

2 participants