Skip to content

Commit

Permalink
add missing eltype method (#21)
Browse files Browse the repository at this point in the history
* add missing eltype method

w/ test

* version bump
  • Loading branch information
tpapp authored Dec 26, 2022
1 parent 0647210 commit 523263a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AltDistributions"
uuid = "875e7ca2-ab9d-5828-93ae-a098eac53262"
authors = ["Tamas K. Papp <tkpapp@gmail.com>"]
version = "0.3.0"
version = "0.3.1"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
4 changes: 4 additions & 0 deletions src/AltDistributions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ function rand(rng::AbstractRNG, sampler::SamplerTrivial{<:AltMvNormal})
L * randn(rng, length(μ)) .+ μ
end

function Base.eltype(::Type{<:AltMvNormal{M,T}}) where {M,T}
Vector{promote_type(eltype(M), eltype(T))}
end

####
#### LKJL
####
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ end
zs = reduce(hcat, rand(d, N))
@test vec(mean(zs, dims = 2)) μ atol = 0.02
@test cov(zs, dims = 2) Σ atol = 0.03
z = rand(d)
@test z isa Vector{Float64} && all(isfinite, z)
end
end

Expand Down

2 comments on commit 523263a

@tpapp
Copy link
Owner Author

@tpapp tpapp commented on 523263a Dec 26, 2022

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/74659

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" 523263a081e973c57ad75988d8d8dc09b14282ad
git push origin v0.3.1

Please sign in to comment.