Skip to content

Commit

Permalink
Fix broadcasting of inputs (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
FriesischScott authored Dec 5, 2024
1 parent c9d89c2 commit fa6c842
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/inputs/inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ function sns_zero_point(inputs::AbstractVector{<:UQInput})

return sns
end

Base.broadcastable(i::T) where {T<:UQInput} = Ref(i)
6 changes: 6 additions & 0 deletions test/inputs/inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ inputs = [pi, jd, z]
@testset "count_rvs" begin
@test count_rvs(inputs) == 3
end

@testset "broadcasting" begin
x = RandomVariable(Normal(), :x)
u = rand(10)
@test pdf.(x.dist, u) == pdf.(x, u)
end
end

0 comments on commit fa6c842

Please sign in to comment.