Developer docs
AdaptiveRejectionSampling.AllocFreeWeightsAdaptiveRejectionSampling.UpperHullAdaptiveRejectionSampling.UpperHullAdaptiveRejectionSampling.__sample!AdaptiveRejectionSampling.add_segment!AdaptiveRejectionSampling.calc_intersectsAdaptiveRejectionSampling.calc_intersects!AdaptiveRejectionSampling.calc_slopes_and_interceptsAdaptiveRejectionSampling.eval_hullAdaptiveRejectionSampling.exp_integral_lineAdaptiveRejectionSampling.find_initial_pointsAdaptiveRejectionSampling.intersectionAdaptiveRejectionSampling.inv_cdf_seg
AdaptiveRejectionSampling.AllocFreeWeights — Type
AllocFreeWeights{S <: Real, T <: Number, V <: AbstractVector{T}} <: AbstractWeights{S, T, V}Non-mutable weights used in the sample function in this package in order to avoid allocations.
AdaptiveRejectionSampling.UpperHull — Type
struct UpperHull{T} <: AbstractHull
intercepts::Vector{T}
slopes::Vector{T}
intersections::Vector{T}
abscissae::Vector{T}
segment_weights::Vector{T}
domain::Tuple{T, T}
endUpper hull of the enveloping function.
AdaptiveRejectionSampling.UpperHull — Method
UpperHull(obj::Objective, abscissae::Vector{T}, domain::Tuple{T, T}) where {T}Create an UpperHull based on the objective function, initial abscissae and its domain.
AdaptiveRejectionSampling.__sample! — Method
__sample!(rng::AbstractRNG, out::AbstractVector{T}, s::ARSampler{T}, add_segments::Bool, max_segments) where {T<:AbstractFloat}All other __sample! methods call this one.
AdaptiveRejectionSampling.add_segment! — Method
add_segment!(s::ARSampler{T}, x::T) where {T <: AbstractFloat}Modifies the hulls of s, adding a segment with abscissa at x.
AdaptiveRejectionSampling.calc_intersects! — Method
calc_intersects!(out::AbstractVector{T}, slopes::AbstractVector{T}, intercepts::AbstractVector{T}) where {T}Calculate intersections of a series of lines defined by their slopes and intercepts, storing the result in out.
AdaptiveRejectionSampling.calc_intersects — Method
calc_intersects(slopes::AbstractVector{T}, intercepts::AbstractVector{T}) where {T}Calculate intersections of a series of lines defined by their slopes and intercepts.
AdaptiveRejectionSampling.calc_slopes_and_intercepts — Method
calc_slopes_and_intercepts(obj::Objective, abscissae::AbstractVector{T}) where {T}Calculates slopes and intercepts of the lines tangential to the objective function at abscissae.
AdaptiveRejectionSampling.eval_hull — Method
eval_hull(h::UpperHull, x)Eval hull h at x.
AdaptiveRejectionSampling.exp_integral_line — Method
exp_integral_line(slope, intercept, x1, x2)Calculate the integral of exp(slope * x + intercept) between x1 and x2.
AdaptiveRejectionSampling.find_initial_points — Method
find_initial_points(obj, lbs, ubs, search_step)Attempts to find suitable initial points for abscissae based on the objective functions by looking for the first points with positive and negative slopes respectively. Simply searches between the bounds specified by lbs and ubs with step size search_step.
AdaptiveRejectionSampling.intersection — Method
intersection(slope1::T, intercept1::T, slope2::T, intercept2::T) where {T}Returns the intersection abscissa between 2 lines as defined by their slopes and intercepts. Returns NaN if the lines are paralell.
AdaptiveRejectionSampling.inv_cdf_seg — Method
inv_cdf_seg(slope, intercept, r, w, intersect, intersect2)Calculate the inverse cumulative density of a hull segment at r based on its...
slopeinterceptw(weight)intersect,intersect2, its intersections with previous/next segments