Internal functions and functionality
PrecisionCarriers.EpsMaxPrecisionCarriers.BigTPrecisionCarriers.EpsTPrecisionCarriers.EpsilonBenchmarkResultPrecisionCarriers.TopKSortedListPrecisionCarriers._grid_samplesPrecisionCarriers._pseudo_random_samplesPrecisionCarriers._random_samplesPrecisionCarriers._special_epsilonPrecisionCarriers.ascii_histPrecisionCarriers.make_binsPrecisionCarriers.print_hist_info
Constants
PrecisionCarriers.EpsT — TypeEpsTThe integer type of epsilons, for example the return type of the epsilons function. Int64 by default.
PrecisionCarriers.EpsMax — ConstantEpsMaxThe maximum representable number of epsilons. typemax(EpsT) by default. If an epsilon would be larger than this value, it is shown as "infinite" epsilons.
PrecisionCarriers.BigT — TypeBigTThe backend high precision float type used by PrecisionCarriers.
Types
PrecisionCarriers.TopKSortedList — TypeTopKSortedListHelper type to store a certain number of key/value pairs, sorted in descending order by key.
PrecisionCarriers.EpsilonBenchmarkResult — TypeEpsilonBenchmarkResultResult object returned by the @bench_epsilons macro. When displayed, it prints a summary of the results, containing the minimum, median, mean, and maximum observed epsilons, and a terminal-styled histogram.
Fields:
epsilons: A vector of all non-infinite collected epsilon samples. Infinite epsilons are excluded so that statistical measures do not get skewed.total_samples: The total number of collected samples.worst_arguments: Descending list of the top worst epsilons together with the respective arguments. Helpful for closer inspection of precision problems.epsilon_limit: The minimum number of epsilons a result must have to be considered for the worst arguments list.call_string: The call string of the function being benchmarked, with format specifiers to string-interpolate the values.no_inf_epsilons: Number of collected samples that gave infinite epsilons.
Functions
PrecisionCarriers._grid_samples — Function_grid_samples(ranges::Tuple{Vararg{Tuple{<:Real, <:Real}}}, n::Integer)Return an iterator generating approximately n evenly spaced samples over the Cartesian grid defined by ranges. Each element of ranges must be a (lo, hi) tuple.
PrecisionCarriers._random_samples — Function_random_samples(ranges::Tuple{Vararg{Tuple{<:Real, <:Real}}}, n::Integer)Return an iterator generating n uniform randomly generated samples over the Cartesian grid defined by ranges. Each element of ranges must be a (lo, hi) tuple.
PrecisionCarriers._pseudo_random_samples — Function_pseudo_random_samples(ranges::Tuple{Vararg{Tuple{<:Real, <:Real}}}, n::Integer)Return an iterator generating n pseudo-randomly generated samples over the Cartesian grid defined by ranges. Each element of ranges must be a (lo, hi) tuple. This uses the package Sobol.jl to produce pseudorandom numbers within the given hypercube. The resulting numbers are more predictable and evenly spaced than real randomness, which can be better to sample a high dimensional space. Also, the generated samples are reproducible.
PrecisionCarriers.make_bins — Functionmake_bins(
vec::Vector{EpsT},
min_val::EpsT,
max_val::EpsT,
mean_val::AbstractFloat,
median_val::AbstractFloat,
histogram_width::Int
)Helper function for printing EpsilonBenchmarkResult. Returns a tuple (hist, mean_bin, median_bin), where hist is a vector of length histogram_width. The elements represent the number of results (from the given vec) in the bin. mean_bin and median_bin contain the bins that the given mean_val and median_val fall in. min_val and max_val are used to scale the histogram appropriately. The histogram bins are sized logarithmically, which also means that 0 values are ignored. This function errors when the difference between min_val and max_val is 1 or less, or when min_val is 0 or less.
PrecisionCarriers.ascii_hist — Functionascii_hist(io::IO, bins::Vector{Int}, mean_bin::Int, median_bin::Int)Prints the given histogram (bins) to the given io. The mean and median bins are colored in their respective colors.
PrecisionCarriers.print_hist_info — Functionprint_hist_info(io::IO, histogram_width::Int, minval::EpsT, maxval::EpsT)To be called after ascii_hist. Prints a line below the histogram marking the minimum and maximum value.
PrecisionCarriers._special_epsilon — Function_special_epsilon(p::P{T})Returns:
_NORM_EPSif neither p.x nor p.big need special treatment_INF_EPSif p.x or p.big have special values and the epsilon should be considered infinite_ZERO_EPSif p.x or p.big have special values and the epsilon should be considered zero