Developer docs

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.

source
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}
end

Upper hull of the enveloping function.

source
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.

source
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.

source
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.

source
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.

source
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.

source
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...

  • slope
  • intercept
  • w (weight)
  • intersect, intersect2, its intersections with previous/next segments
source