flex

The Transformed Density Rejection with Inflection Points (Flex) algorithm can sample from arbitrary distributions given its density function f, its first two derivatives and a partitioning into intervals with at most one inflection point. The partitioning needs to be mutually exclusive and sorted.

  1. auto flex(F0 f0, F1 f1, F2 f2, S c, S[] points, S rho, int maxApproxPoints)
  2. auto flex(Pdf pdf, F0 f0, F1 f1, F2 f2, S c, S[] points, S rho, int maxApproxPoints)
  3. auto flex(F0 f0, F1 f1, F2 f2, S[] cs, S[] points, S rho, int maxApproxPoints)
  4. auto flex(Pdf pdf, F0 f0, F1 f1, F2 f2, S[] cs, S[] points, S rho, int maxApproxPoints)
    static if(is(typeof( )))
    flex
    (
    S
    Pdf
    F0
    F1
    F2
    )
    (
    in Pdf pdf
    ,
    in F0 f0
    ,
    in F1 f1
    ,
    in F2 f2
    ,
    S[] cs
    ,
    S[] points
    ,
    S rho = 1.1
    ,
    int maxApproxPoints = 1_000
    )
    if (
    isFloatingPoint!S
    )
  5. auto flex(Pdf pdf, FlexInterval!S[] intervals)

Parameters

pdf Pdf

probability density function of the distribution

f0 F0

logarithmic pdf

f1 F1

first derivative of logarithmic pdf

f2 F2

second derivative of logarithmic pdf

cs S[]
points S[]

non-overlapping partitioning with at most one inflection point per interval

rho S

efficiency of the Flex algorithm

maxApproxPoints int

maximal number of points to use for the hat/squeeze approximation

Return Value

Type: auto

Flex Generator.

Meta