Skip to content

Commit ff7f8a2

Browse files
committed
Try not duplicating
1 parent 0445092 commit ff7f8a2

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/logdensityfunction.jl

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,7 @@ struct LogDensityAt{M<:Model,V<:AbstractVarInfo,C<:AbstractContext}
211211
context::C
212212
end
213213
function (ld::LogDensityAt)(x::AbstractVector)
214-
varinfo_new = unflatten(ld.varinfo, x)
215-
varinfo_eval = last(evaluate!!(ld.model, varinfo_new, ld.context))
216-
has_prior = hasacc(varinfo_eval, Val(:LogPrior))
217-
has_likelihood = hasacc(varinfo_eval, Val(:LogLikelihood))
218-
if has_prior && has_likelihood
219-
return getlogjoint(varinfo_eval)
220-
elseif has_prior
221-
return getlogprior(varinfo_eval)
222-
elseif has_likelihood
223-
return getloglikelihood(varinfo_eval)
224-
else
225-
error("LogDensityFunction: varinfo tracks neither log prior nor log likelihood")
226-
end
214+
return logdensity_at(x, ld.model, ld.varinfo, ld.context)
227215
end
228216

229217
### LogDensityProblems interface

0 commit comments

Comments
 (0)