numeric.h file
Numeric algorithms and constants unrelated to images. This file is always included through diplib.h. See Numeric algorithms and constants.
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{ NOT_PERIODIC, PERIODIC } - Select if the operation is periodic or not. Used in
dip::GaussianMixtureModel
.
Functions
-
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.
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>>auto dip::
consistent_round(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 ofstd::abs
. Preferstd::abs
outside ofconstexpr
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.
-
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::
LengthUnicode(dip::String const& string) -> dip::uint - Counts the length of a (UTF-8 encoded) Unicode string.
-
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). -
auto dip::
Sinc(dip::dfloat x) -> dip::dfloat - Computes the sinc function.
-
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
s
and meanm
from minus infinity tox
. -
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::
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.
-
void dip::
SymmetricEigenDecomposition2(dip::ConstSampleIterator input, dip::SampleIterator lambdas, dip::SampleIterator vectors = nullptr) - 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) - Finds the eigenvalues and eigenvectors of a 3x3 symmetric, real-valued matrix.
-
void dip::
LargestEigenvector(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator vector) - Finds the largest eigenvector of a symmetric, real-valued matrix.
-
void dip::
SmallestEigenvector(dip::uint n, dip::ConstSampleIterator input, dip::SampleIterator vector) - Finds the smallest eigenvector of a 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.
-
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.
-
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.
-
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(dip::uint n, dip::ConstSampleIterator input) -> dip::FloatType - 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(dip::uint n, dip::ConstSampleIterator input) -> dip::FloatType - Computes the norm of a vector.
-
template<typename T>auto dip::
SquareNorm(dip::uint n, dip::ConstSampleIterator input) -> dip::FloatType - 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(dip::uint n, dip::ConstSampleIterator input) -> dip::dcomplex - Computes the determinant of a square, complex-valued matrix.
-
template<typename T>auto dip::
DeterminantDiagonal(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.
-
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
-
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
-
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(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.
-
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.
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.