Skip to content

Commit 7fcbec4

Browse files
cscherreroschulz
authored andcommitted
Add a note to SpikeMixture logdensity implementation
1 parent e242314 commit 7fcbec4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/combinators/spikemixture.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ end
2323

2424
for func in [:logdensityof, :logdensity_def]
2525
@eval @inline function $func::SpikeMixture, x)
26+
# NOTE: We could instead write this as
27+
# R1 = typeof(log(one(μ.s)))
28+
# R2 = typeof(log(one(μ.w)))
29+
30+
# which would rely on constant propagation insteadof type inference.
31+
# We'll try this for now and come back to the question if we see
32+
# problems.
33+
2634
R1 = Core.Compiler.return_type(log, Tuple{typeof.s)})
2735
R2 = Core.Compiler.return_type(log, Tuple{typeof.w)})
2836
R3 = Core.Compiler.return_type($func, Tuple{typeof.m),typeof(x)})

0 commit comments

Comments
 (0)