diplib/library/numeric.h file

Numeric algorithms and constants unrelated to images. This file is always included through diplib.h. See Numeric algorithms and constants.

• Reference

Classes

class dip::ThinPlateSpline
Fits a thin plate spline function to a set of points. Useful for interpolation of scattered points.
struct dip::GaussianParameters
Parameters defining a 1D Gaussian. Returned by `dip::GaussianMixtureModel`.

Enums

enum class dip::Option::Periodicity: uint8{
Select if the operation is periodic or not. Used in `dip::GaussianMixtureModel`.

Functions

template<typename T>
) -> dip::dfloat constexpr
Maximum meaningful truncation value for a Gaussian. Larger truncation values will lead to differences of more than one machine epsilon between the middle and the ends of the Gaussian. `T` must be a floating-point type.
auto dip::gcd(dip::uint a, dip::uint b) -> dip::uint constexpr
Compute the greatest common denominator of two positive integers.
template<typename T, <SFINAE> = 0>
auto dip::div_ceil(T lhs, T rhs) -> T constexpr
Integer division, unsigned, return ceil.
template<typename T, <SFINAE> = 0>
auto dip::div_floor(T lhs, T rhs) -> T constexpr
Integer division, unsigned, return floor.
template<typename T, typename <SFINAE> = T>
auto dip::div_round(T lhs, T rhs) -> T constexpr
Integer division, return rounded.
auto dip::modulo(dip::uint value, dip::uint period) -> dip::uint constexpr
Integer modulo, result is always positive, as opposed to % operator.
auto dip::modulo(dip::sint value, dip::sint period) -> dip::sint constexpr
Integer modulo, result is always positive, as opposed to % operator.
template<typename T, typename <SFINAE>>
auto dip::floor_cast(T v) -> dip::sint constexpr
Fast floor operation, without checks, returning a `dip::sint`.
template<typename T, typename <SFINAE>>
auto dip::ceil_cast(T v) -> dip::sint constexpr
Fast ceil operation, without checks, returning a `dip::sint`.
template<typename T, typename <SFINAE>>
auto dip::round_cast(T v) -> dip::sint
Fast round operation, without checks, returning a `dip::sint`.
template<typename T, bool inverse = false, typename <SFINAE>>
T v) -> dip::sint constexpr
Consistent rounding, without checks, returning a `dip::sint`.
template<typename T>
auto dip::abs(T value) -> T constexpr
`constexpr` version of `std::abs`. Prefer `std::abs` outside of `constexpr` functions.
template<typename T>
auto dip::clamp(T const& v, T const& lo, T const& hi) -> T const& constexpr
Clamps a value between a min and max value (a.k.a. clip, saturate, etc.).
auto dip::pow10(dip::sint power) -> dip::dfloat constexpr
Computes integer powers of 10, assuming the power is relatively small.
dip::dfloat lhs, dip::dfloat rhs, dip::dfloat tolerance = 1e-6) -> bool constexpr
Approximate floating-point equality: `abs(lhs-rhs)/lhs <= tolerance`.
auto dip::LengthUnicode(dip::String const& string) -> dip::uint
Counts the length of a (UTF-8 encoded) Unicode string.
auto dip::BesselJ0(
Computes the Bessel function J of the order 0 (with around 7 digits of precision).
auto dip::BesselJ1(
Computes the Bessel function J of the order 1 (with around 7 digits of precision).
auto dip::BesselJN(
Computes the Bessel function J of the order `n` (with around 7 digits of precision).
auto dip::BesselY0(
Computes the Bessel function Y of the order 0 (with around 7 digits of precision).
auto dip::BesselY1(
Computes the Bessel function Y of the order 1 (with around 7 digits of precision).
auto dip::BesselYN(
Computes the Bessel function Y of the order `n` (with around 7 digits of precision).
auto dip::Sinc(
Computes the sinc function.
auto dip::Phi(
Computes phi, the integral of the PDF of a Normal distribution with unit variance and zero mean from minus infinity to `x`.
auto dip::Phi(
Computes phi, the integral of the PDF of a Normal distribution with standard deviation `s` and mean `m` from minus infinity to `x`.
dip::uint n, dip::dfloat r) -> dip::dfloat constexpr
Computes the surface area of an `n`-dimensional hypersphere with radius `r`.
dip::uint n, dip::dfloat r) -> dip::dfloat constexpr
Computes the volume of an `n`-dimensional hypersphere with radius `r`.
dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr)
Finds the eigenvalues and eigenvectors of a symmetric, real-valued matrix.
dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr)
Finds the eigenvalues and eigenvectors of a 2x2 symmetric, real-valued matrix.
dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr)
Finds the eigenvalues and eigenvectors of a 3x3 symmetric, real-valued matrix.
dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator vector)
Finds the largest eigenvector of a symmetric, real-valued matrix.
dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator vector)
Finds the smallest eigenvector of a symmetric, real-valued matrix.
dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr)
Finds the eigenvalues and eigenvectors of a symmetric, real-valued matrix, where only the unique values are given.
dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr)
Finds the eigenvalues and eigenvectors of a square, real-valued matrix.
dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr)
Finds the eigenvalues and eigenvectors of a square, complex-valued matrix.
template<typename T>
auto dip::Sum(dip::uint n, dip::ConstSampleIterator input) -> T
Computes the sum of the values of a vector.
template<typename T>
auto dip::SumAbsSquare(
Computes the sum of the square of the values of a vector.
template<typename T>
auto dip::Product(dip::uint n, dip::ConstSampleIterator input) -> T
Computes the product of the values of a vector.
template<typename T>
auto dip::Norm(
Computes the norm of a vector.
template<typename T>
auto dip::SquareNorm(
Computes the square norm of a vector.
auto dip::Determinant(dip::uint n, dip::ConstSampleIterator input) -> dip::dfloat
Computes the determinant of a square, real-valued matrix.
auto dip::Determinant(
Computes the determinant of a square, complex-valued matrix.
template<typename T>
dip::uint n, dip::ConstSampleIterator input) -> T
Computes the determinant of a diagonal matrix.
template<typename T>
auto dip::Trace(dip::uint n, dip::ConstSampleIterator input) -> T
Computes the trace of a square matrix.
template<typename T>
auto dip::TraceDiagonal(dip::uint n, dip::ConstSampleIterator input) -> T
Computes the trace of a diagonal matrix.
dip::uint m, dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output, dip::SampleIterator U = nullptr, dip::SampleIterator V = nullptr)
Computes the “thin” singular value decomposition of a real-valued matrix
dip::uint m, dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output, dip::SampleIterator U = nullptr, dip::SampleIterator V = nullptr)
Computes the “thin” singular value decomposition of a complex-valued matrix
void dip::Inverse(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output)
Computes the inverse of a square, real-valued matrix.
void dip::Inverse(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output)
Computes the inverse of a square, complex-valued matrix.
void dip::PseudoInverse(dip::uint m, dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output, dip::dfloat tolerance = 1e-7)
Computes the Moore-Penrose pseudo-inverse of a real-valued matrix, using the Jacobi SVD decomposition.
void dip::PseudoInverse(dip::uint m, dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output, dip::dfloat tolerance = 1e-7)
Computes the Moore-Penrose pseudo-inverse of a complex-valued matrix, using the Jacobi SVD decomposition.
auto dip::Rank(dip::uint m, dip::uint n, dip::ConstSampleIterator input) -> dip::uint
Computes the rank of a real-valued matrix.
auto dip::Rank(dip::uint m, dip::uint n, dip::ConstSampleIterator input) -> dip::uint
Computes the rank of a complex-valued matrix.
void dip::Solve(
Solves a system of real-valued equations, using the Jacobi SVD decomposition.
dip::ConstSampleIterator data, dip::SampleIterator responsibilities, dip::uint size, dip::uint numberOfGaussians, dip::uint maxIter = 20, dip::Option::Periodicity periodicity = Option::Periodicity::NOT_PERIODIC) -> std::vector<GaussianParameters>
Determines the parameters for a Gaussian Mixture Model.

Variables

dip::dfloat const dip::pi constexpr
The constant π.
dip::dfloat const dip::nan constexpr
A NaN value.
dip::dfloat const dip::infinity constexpr
Infinity.