-
Notifications
You must be signed in to change notification settings - Fork 4
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
Missed simplification opportunity for productmeasure
#133
Comments
Oh, nice! |
But you would lose type stability no? Can you infer the type just from the input arguments? Unless you want to make PowerMeasure a special case of ProductMeasure? |
I think it will still be type-stable. When we call productmeasure(::AbstractArray{T,N}) the rule can fire or not depending on |
Currently (in #120) we have _generic_productmeasure_impl(mar::AbstractArray) = ProductMeasure(asmeasure.(mar)) We could change this to function _generic_productmeasure_impl(mar::AbstractArray{T}) where {T}
if Base.issingletontype(T)
first(mar) ^ size(mar)
else
ProductMeasure(asmeasure.(mar))
end
end |
I guess we could even make it if Base.issingletontype(T) || allequal(mar) This requires walking through |
Keeping it simple for now. Added this as a test: julia> productmeasure(fill(Lebesgue(), 5)) isa PowerMeasure
true |
Maybe add |
Good idea! Done. |
In this measure
we have
But this guarantees we could instead have written it as a power measure. Let's update the
powermeasure
to account for this.The text was updated successfully, but these errors were encountered: