numeric.h file
Numeric algorithms and constants unrelated to images. This file is always included through diplib.h. See Numeric algorithms and constants.
Classes
-
struct dip::
GaussianParameters - Parameters defining a 1D Gaussian. Returned by
dip::GaussianMixtureModel. more... -
class dip::
ThinPlateSpline - Fits a thin plate spline function to a set of points. Useful for interpolation of scattered points. more...
Enums
-
enum class dip::
Option:: DecompositionMethod: uint8 - Select the algorithm to use with
dip::SymmetricEigenDecomposition2anddip::SymmetricEigenDecomposition3. more... -
enum class dip::
Option:: Periodicity: uint8 - Select if the operation is periodic or not. Used in
dip::GaussianMixtureModel. more...
Functions
-
template<typename T>auto dip::
abs(T value) -> T constexpr constexprversion ofstd::abs. Preferstd::absoutside ofconstexprfunctions.-
auto dip::
ApproximatelyEquals(dip::dfloat lhs, dip::dfloat rhs, dip::dfloat tolerance = 1e-6) -> bool constexpr - Approximate floating-point equality:
abs(lhs-rhs)/lhs <= tolerance. -
auto dip::
BesselJ0(dip::dfloat x) -> dip::dfloat - Computes the Bessel function J of the order 0 (with around 7 digits of precision).
-
auto dip::
BesselJ1(dip::dfloat x) -> dip::dfloat - Computes the Bessel function J of the order 1 (with around 7 digits of precision).
-
auto dip::
BesselJN(dip::dfloat x, dip::uint n) -> dip::dfloat - Computes the Bessel function J of the order
n(with around 7 digits of precision). -
auto dip::
BesselY0(dip::dfloat x) -> dip::dfloat - Computes the Bessel function Y of the order 0 (with around 7 digits of precision).
-
auto dip::
BesselY1(dip::dfloat x) -> dip::dfloat - Computes the Bessel function Y of the order 1 (with around 7 digits of precision).
-
auto dip::
BesselYN(dip::dfloat x, dip::uint n) -> dip::dfloat - Computes the Bessel function Y of the order
n(with around 7 digits of precision). -
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>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.).
-
template<typename T, bool inverse = false, typename <SFINAE>>auto dip::
consistent_round(T v) -> dip::sint constexpr - Consistent rounding, without checks, returning a
dip::sint. more... -
auto dip::
Determinant(dip::uint n, dip::ConstSampleIterator input) -> dip::dfloat - Computes the determinant of a square, real-valued matrix. more...
-
auto dip::
Determinant(dip::uint n, dip::ConstSampleIterator input) -> dip::dcomplex - Computes the determinant of a square, complex-valued matrix. more...
-
template<typename T>auto dip::
DeterminantDiagonal(dip::uint n, dip::ConstSampleIterator input) -> T - Computes the determinant of a diagonal matrix. more...
-
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.
-
void dip::
EigenDecomposition(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr) - Finds the eigenvalues and eigenvectors of a square, real-valued matrix. more...
-
void dip::
EigenDecomposition(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr) - Finds the eigenvalues and eigenvectors of a square, complex-valued matrix. more...
-
template<typename T, typename <SFINAE>>auto dip::
floor_cast(T v) -> dip::sint constexpr - Fast floor operation, without checks, returning a
dip::sint. -
auto dip::
GaussianMixtureModel(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. more...
-
auto dip::
gcd(dip::uint a, dip::uint b) -> dip::uint constexpr - Compute the greatest common denominator of two positive integers.
-
auto dip::
HypersphereSurface(dip::uint n, dip::dfloat r) -> dip::dfloat constexpr - Computes the surface area of an
n-dimensional hypersphere with radiusr. -
auto dip::
HypersphereVolume(dip::uint n, dip::dfloat r) -> dip::dfloat constexpr - Computes the volume of an
n-dimensional hypersphere with radiusr. -
void dip::
Inverse(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output) - Computes the inverse of a square, real-valued matrix. more...
-
void dip::
Inverse(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator output) - Computes the inverse of a square, complex-valued matrix. more...
-
void dip::
LargestEigenvector(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator vector) - Finds the largest eigenvector of a symmetric, real-valued matrix. more...
-
auto dip::
LengthUnicode(dip::String const& string) -> dip::uint - Counts the length of a (UTF-8 encoded) Unicode string.
-
template<typename T>auto dip::
maximum_gauss_truncation() -> 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.
Tmust be a floating-point type. -
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>auto dip::
Norm(dip::uint n, dip::ConstSampleIterator input) -> dip::FloatType - Computes the norm of a vector. more...
-
auto dip::
Phi(dip::dfloat x) -> dip::dfloat - 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(dip::dfloat x, dip::dfloat m, dip::dfloat s) -> dip::dfloat - Computes phi, the integral of the PDF of a Normal distribution with
standard deviation
sand meanmfrom minus infinity tox. -
auto dip::
pow10(dip::sint power) -> dip::dfloat constexpr - Computes integer powers of 10, assuming the power is relatively small.
-
template<typename T>auto dip::
Product(dip::uint n, dip::ConstSampleIterator input) -> T - Computes the product of the values of a vector. more...
-
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. more...
-
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. more...
-
auto dip::
Rank(dip::uint m, dip::uint n, dip::ConstSampleIterator input) -> dip::uint - Computes the rank of a real-valued matrix. more...
-
auto dip::
Rank(dip::uint m, dip::uint n, dip::ConstSampleIterator input) -> dip::uint - Computes the rank of a complex-valued matrix. more...
-
auto dip::
RankFromPercentile(dip::dfloat percentile, dip::uint n) -> dip::uint constexpr - Computes the rank (index into array) for a given percentile and an array of length
n. more... -
template<typename T, typename <SFINAE>>auto dip::
round_cast(T v) -> dip::sint - Fast round operation, without checks, returning a
dip::sint. -
auto dip::
Sinc(dip::dfloat x) -> dip::dfloat - Computes the sinc function.
-
void dip::
SingularValueDecomposition(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 more...
-
void dip::
SingularValueDecomposition(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 more...
-
void dip::
SmallestEigenvector(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator vector) - Finds the smallest eigenvector of a symmetric, real-valued matrix. more...
-
void dip::
Solve(dip::uint m, dip::uint n, dip::ConstSampleIterator A, dip::ConstSampleIterator b, dip::SampleIterator output) - Solves a system of real-valued equations, using the Jacobi SVD decomposition. more...
-
template<typename T>auto dip::
SquareNorm(dip::uint n, dip::ConstSampleIterator input) -> dip::FloatType - Computes the square norm of a vector. more...
-
template<typename T>auto dip::
Sum(dip::uint n, dip::ConstSampleIterator input) -> T - Computes the sum of the values of a vector. more...
-
template<typename T>auto dip::
SumAbsSquare(dip::uint n, dip::ConstSampleIterator input) -> dip::FloatType - Computes the sum of the square of the values of a vector. more...
-
void dip::
SymmetricEigenDecomposition(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr) - Finds the eigenvalues and eigenvectors of a symmetric, real-valued matrix. more...
-
void dip::
SymmetricEigenDecomposition2(dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr, dip::Option::DecompositionMethod method = Option::DecompositionMethod::PRECISE) - Finds the eigenvalues and eigenvectors of a 2x2 symmetric, real-valued matrix.
-
void dip::
SymmetricEigenDecomposition3(dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr, dip::Option::DecompositionMethod method = Option::DecompositionMethod::PRECISE) - Finds the eigenvalues and eigenvectors of a 3x3 symmetric, real-valued matrix.
-
void dip::
SymmetricEigenDecompositionPacked(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. more...
-
template<typename T>auto dip::
Trace(dip::uint n, dip::ConstSampleIterator input) -> T - Computes the trace of a square matrix. more...
-
template<typename T>auto dip::
TraceDiagonal(dip::uint n, dip::ConstSampleIterator input) -> T - Computes the trace of a diagonal matrix. more...
Variables
-
dip::dfloat const dip::
infinity = std::numeric_limits ::infinity() constexpr - Infinity.
-
dip::dfloat const dip::
nan = std::numeric_limits ::quiet_NaN() constexpr - A NaN value.
-
dip::dfloat const dip::
pi = 3.14159265358979323846264338327950288 constexpr - The constant π.