Skip to content

Commit

Permalink
delete duplicate multiplication method
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavs authored Oct 17, 2023
1 parent d999b6a commit 9b99daf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mixturemodels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ end
weights(e::MixtureExpectation) = e.mixtureweights
expectations(e::MixtureExpectation) = e.expectations
expectation(f::Function, m::UnivariateMixture; kwargs...) = dot(probs(m), [expectation(f, dist; kwargs...) for dist in components(m)])
# Left-multiplying an expectation by a scalar.
"""
*(r::Real, e::MixtureExpectation) = IterableExpectation(nodes(e), r * weights(e))
Implements left-multiplication of an `IterableExpectation` by a real scalar.
"""
*(r::Real, e::MixtureExpectation) = MixtureExpectation(r * expectations(e), weights(e))
# *(e::MixtureExpectation, h::AbstractArray) = dot(weights(e), [E*h for E in expectations(e)])
import Base.+
Expand All @@ -26,9 +31,4 @@ Implements the right-application of an `MixtureExpectation` by a vector of value
"""
*(e::MixtureExpectation, h::AbstractArray) = dot(map(x -> x * h, expectations(e)), weights(e))

# Left-multiplying an expectation by a scalar.
"""
*(r::Real, e::MixtureExpectation) = IterableExpectation(nodes(e), r * weights(e))
Implements left-multiplication of an `IterableExpectation` by a real scalar.
"""
*(r::Real, e::MixtureExpectation) = MixtureExpectation(r * expectations(e), weights(e)) # Necessary because, for example, multiplying UnitRange * 2 = StepRange

2 comments on commit 9b99daf

@arnavs
Copy link
Member Author

@arnavs arnavs commented on 9b99daf Nov 3, 2023

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.

Error while trying to register: Version 1.9.0 already exists

Please # to comment.