Reference
Contents
Index
RejectionSamplers.AbstractProposalDistributionRejectionSamplers.AbstractTransformProposalRejectionSamplers.CoordinateVariateRejectionSamplers.TestUtils.get_test_setupRejectionSamplers._computeRejectionSamplers._findmaxRejectionSamplers._gpu_proposeRejectionSamplers._nsamplesRejectionSamplers._propose!RejectionSamplers._propose_on_deviceRejectionSamplers._propose_singleRejectionSamplers._transformRejectionSamplers.default_rngRejectionSamplers.degrees_of_freedomRejectionSamplers.filter_scanRejectionSamplers.maximum_valueRejectionSamplers.propose!RejectionSamplers.propose!RejectionSamplers.propose_single
RejectionSamplers.AbstractProposalDistribution — TypeAbstractProposalDistribution{Ts, Tw, F <: ProposalVariateForm}Abstract supertype for all proposal distributions.
Type parameters:
Ts: sample typeTw: weight typeF: variate form (UnivariateorCoordinateVariate)
RejectionSamplers.AbstractTransformProposal — TypeAbstractTransformProposal{Ts, Tw} <: AbstractCoordinateProposal{Ts, Tw}Proposal distributions that generate samples through a local transformation of unit random coordinates.
RejectionSamplers.CoordinateVariate — TypeCoordinateVariate <: Distributions.VariateFormVariate form where arguments are SVectors of scalars representing coordinates.
RejectionSamplers._compute — Function_compute(dist::AbstractUnivariatTargetDistribution,x::Real)::Real
_compute(dist::AbstractMultivariateTarget,x::SVector{2,Real})::RealReturn value of dist computed at x.
RejectionSamplers._findmax — Function_findmax(method::AbstractSampleBasedMaxFinder, weights::AbstractVector{T})::T where {T<:Real}Interface function for sample based max-finder. Return the maximum weight of a given vector weights according to method.
RejectionSamplers._gpu_propose — Method_gpu_propose(proposal::AbstractTransformProposal{TT}, threadid, randstate)
-> (sample, weight)Thread-local GPU version of proposal sampling.
RejectionSamplers._nsamples — Function_nsamples(method::AbstractSampleBasedMaxFinder)Interface function for sample-based max-finder. Returns the number of samples to be generated for max-finding.
RejectionSamplers._propose! — Method_propose!(
rng::AbstractRNG,
proposal::AbstractProposalDistribution,
samples::AbstractVector,
weights::AbstractVector;
backend = KernelAbstractions.CPU(),
)Propose samples and weights for the given backend.
For CPU backends, falls back to _propose_single. For GPU backends, must be specialized explicitly.
RejectionSamplers._propose_on_device — Functionproposeon_device!( rng::GPUArrays.RNG, proposal::AbstractProposalDistribution, samples::AbstractVector, weights::AbstractVector, backend::KernelAbstractions.Backend, )
The on-device version of _propose!. This should be extended, if device specific implementations for _propose! are needed.
RejectionSamplers._propose_single — Function_propose_single(rng::AbstractRNG, proposal::AbstractProposalDistribution)Return a single (sample, weight) tuple drawn from proposal.
RejectionSamplers._transform — Function_transform(proposal::AbstractTransformProposal{T}, unit_coord::T)
-> (sample, weight)Transform unit random coordinates into the target sample space. Return the transformed sample and its associated proposal weight.
RejectionSamplers.default_rng — Functiondefault_rng(v::AbstractVector)Return default rng to randomize given vector. Uses fallbacks on Random.default_rng and GPUArrays.default_rng.
RejectionSamplers.degrees_of_freedom — Functiondegrees_of_freedom(proposal::AbstractProposalDistribution) -> IntReturn the number of coordinates generated by the proposal.
RejectionSamplers.filter_scan — Methodfilter_scan(payload, weights, randoms, out_payload, out_weights, out_size)KernelAbstractions kernel. Filters the payload array by comparing the respective elements of weights < randoms. Fills the indices out_size - out_size + N of the given buffers out_payload and out_weights with all accepted values, where N is the number of accepted values. Also assigns out_size += N.
Parameters
- input
payload: array of the payload - input
weights: array of weights (normalized to [0,1]; outliers allowed, seeout_weights; "probabilities") - input
randoms: array of uniform random independent scalar values [0,1] - output
out_payload: buffer for accepted payload to be written - output
out_weights: buffer for accepted weights to be written; every accepted weight will be 1.0, or the original weight if it was larger than 1.0 - input/output
out_size: a global memory variable (array of length 1) containing the current number of elements inout_payloadandout_weights
RejectionSamplers.maximum_value — Functionmaximum_value(dist::AbstractTargetDistribution)Interface function: return the (approximate) maximum_value of a given target distribution.
RejectionSamplers.propose! — Methodpropose!(
proposal::AbstractProposalDistribution,
samples::AbstractVector,
weights::AbstractVector;
rng = default_rng(typeof(samples)),
backend = get_backend(samples)
) -> NothingConvenience wrapper that infers both the RNG and backend from the destination arrays.
RejectionSamplers.propose! — Methodpropose!(
rng::AbstractRNG,
proposal::AbstractProposalDistribution,
samples::AbstractVector,
weights::AbstractVector;
backend = get_backend(samples)
) -> NothingFill samples and weights with proposals generated by proposal.
The backend is inferred from the array type of samples by default, but can be overridden via the backend keyword.
Throws an ArgumentError if samples and weights have mismatched lengths.
RejectionSamplers.propose_single — Methodpropose_single(proposal::AbstractProposalDistribution) -> (sample, weight)Draw a single (sample, weight) pair from proposal using the global default RNG.
RejectionSamplers.TestUtils.get_test_setup — Functionget_test_setup(backend::KernelAbstractions.Backend)Interface function: return test setup for given backend.