@@ -56,19 +56,54 @@ function Base.:*(μ::M, ν::N) where {M <: AbstractMeasure, N <: AbstractMeasure
56
56
ProductMeasure (data... )
57
57
end
58
58
59
- @propagate_inbounds function MeasureTheory. logdensity (d:: ProductMeasure , x)
59
+ using Tullio
60
+
61
+ function logdensity (d:: ProductMeasure{A} , x) where {T, A<: AbstractArray }
60
62
data = d. data
61
63
@boundscheck size (data) == size (x) || throw (BoundsError)
62
-
63
64
s = 0.0
64
- Δs (j) = @inbounds logdensity (data[j], x[j])
65
-
66
- @inbounds @simd for j in eachindex (x)
67
- s += Δs (j)
65
+ Δs (i) = logdensity (data[i], x[i])
66
+ for i in eachindex (x)
67
+ s += Δs (i)
68
68
end
69
- s
69
+ return s
70
70
end
71
71
72
+ # @propagate_inbounds function MeasureTheory.logdensity(d::ProductMeasure{A}, x) where{T, A<:AbstractArray{T,1}}
73
+ # data = d.data
74
+ # @boundscheck size(data) == size(x) || throw(BoundsError)
75
+ # @tullio s = logdensity(data[i], x[i])
76
+ # s
77
+ # end
78
+
79
+ # @propagate_inbounds function MeasureTheory.logdensity(d::ProductMeasure{A}, x) where{T, A<:AbstractArray{T,2}}
80
+ # data = d.data
81
+ # @boundscheck size(data) == size(x) || throw(BoundsError)
82
+ # @tullio s = @inbounds logdensity(data[i,j], x[i,j])
83
+ # s
84
+ # end
85
+
86
+ # @propagate_inbounds function MeasureTheory.logdensity(d::ProductMeasure{A}, x) where{T, A<:AbstractArray{T,3}}
87
+ # data = d.data
88
+ # @boundscheck size(data) == size(x) || throw(BoundsError)
89
+ # @tullio s = @inbounds logdensity(data[i,j,k], x[i,j,k])
90
+ # s
91
+ # end
92
+
93
+ # @propagate_inbounds function MeasureTheory.logdensity(d::ProductMeasure{A}, x) where{T, A<:AbstractArray{T,4}}
94
+ # data = d.data
95
+ # @boundscheck size(data) == size(x) || throw(BoundsError)
96
+ # @tullio s = @inbounds logdensity(data[i,j,k,l], x[i,j,k,l])
97
+ # s
98
+ # end
99
+
100
+ # @propagate_inbounds function MeasureTheory.logdensity(d::ProductMeasure{A}, x) where{T, A<:AbstractArray{T,5}}
101
+ # data = d.data
102
+ # @boundscheck size(data) == size(x) || throw(BoundsError)
103
+ # @tullio s = @inbounds logdensity(data[i,j,k,l,m], x[i,j,k,l,m])
104
+ # s
105
+ # end
106
+
72
107
export rand!
73
108
using Random: rand!, GLOBAL_RNG, AbstractRNG
74
109
0 commit comments