Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::math Namespace Reference

Defines universal mathematical and physical constants. More...

Namespaces

namespace  detail

Classes

class  Vector3
 A lightweight, constexpr, stack-based 3D vector. More...
class  Vector3< double >
 SIMD-optimized specialization of Vector3 for double. More...
class  Vector3< float >
 SIMD-optimized specialization of Vector3 for float. More...
class  Matrix3
 A lightweight, constexpr, stack-based 3x3 matrix. More...
struct  PositionBlockT
 Represents a Structure of Arrays (SoA) block of atom positions for SIMD processing. More...
struct  Point3T
 Lightweight POD for passing 3D coordinates to scalar SIMD helpers. More...
struct  SincIntegralParams
 Parameter container for sincIntegral kernel invocations. More...
struct  RDFNormalizationParams
 Parameter container for normalizeRdfBins kernel invocations. More...
struct  ScaleBinsParams
 Parameter container for scaleBins kernel invocations. More...
struct  MillerPhaseSumParams
 Parameter container for millerPhaseSum kernel invocations. More...
struct  MillerExpSumParams
 Parameter container for millerExpSum / complexExpSum kernel invocations. More...
struct  ComplexExpSumResult
 Output result container holding cosine and sine phase sums. More...
struct  FillPositionBlockParams
 Parameter container for fillPositionBlock kernel invocations. More...
struct  KernelGenerationParams
 Parameters for kernel generation. More...
struct  KernelSmoothingParams
 Options bundling for data series kernel smoothing. More...
struct  LegendreParams
 Parameters for Legendre polynomial evaluation (degree and order). More...

Typedefs

using Vector3R = Vector3<real_t>
 Precision-configurable aliases for 3D vectors and 3x3 matrices.
using Matrix3R = Matrix3<real_t>
using PositionBlock = PositionBlockT<real_t>
 Backward-compatible type alias for default real_t precision PositionBlock.
using Point3 = Point3T<real_t>
 Backward-compatible type alias for default real_t precision Point3.
template<typename T = real_t>
using ComplexExpSumParams = MillerExpSumParams<T>
 Alias for MillerExpSumParams used with complexExpSum kernel invocations.
template<typename T = real_t>
using PhaseSumResult = ComplexExpSumResult<T>
 Alias for PhaseSumResult used with phase sum kernel invocations.
template<typename T = real_t>
using MillerPhaseSumResult = ComplexExpSumResult<T>
 Alias for MillerPhaseSumResult used with millerPhaseSum kernel invocations.

Enumerations

enum class  KernelType : std::uint8_t {
  Gaussian , Bump , Triweight , Epanechnikov ,
  Cosine , Biweight
}
 Selection of kernel types for smoothing. More...

Functions

bool isGoodFFTSize (size_t n)
 Helper to check if a size is a product of small prime factors (2, 3, 5). Highly optimized for FFTW3 and MKL.
size_t findNextGoodFFTSize (size_t target)
 Finds the next "good" FFT size >= target.
template<typename T = double>
void computeFFT (std::vector< std::complex< T > > &data, bool invert)
 Simple Radix-2 Cooley-Tukey FFT implementation with bit-reversal optimization.
template<typename T = real_t>
std::vector< T > autocorrelate (const std::vector< T > &signal, std::vector< std::complex< T > > &workspace)
 Computes the autocorrelation of a 1D real sequence using FFT.
template<typename T = real_t>
std::vector< T > autocorrelate (const std::vector< T > &signal)
 Convenience overload — allocates its own workspace.
template<typename T>
constexpr T dot (const Vector3< T > &vec_a, const Vector3< T > &vec_b) noexcept
 Computes the dot product of two vectors.
template<typename T>
constexpr Vector3< T > cross (const Vector3< T > &vec_a, const Vector3< T > &vec_b) noexcept
 Computes the cross product of two 3D vectors.
Vector3< double > cross (const Vector3< double > &vec_a, const Vector3< double > &vec_b) noexcept
 Computes the cross product of two 3D vectors.
template<typename T>
constexpr T normSq (const Vector3< T > &vec_a) noexcept
 Computes the squared vector norm (length).
template<typename T>
constexpr T norm (const Vector3< T > &vec_a) noexcept
 Computes the vector norm (length).
template<typename T>
constexpr T distance (const Vector3< T > &vec_a, const Vector3< T > &vec_b) noexcept
 Computes the distance between two vectors.
template<typename T>
constexpr Vector3< T > normalize (const Vector3< T > &vec_a)
 Normalizes the given vector.
template<typename T>
constexpr T determinant (const Matrix3< T > &matrix) noexcept
 Computes the determinant of a 3x3 matrix.
template<typename T>
constexpr Matrix3< T > invert (const Matrix3< T > &matrix)
 Computes the inverse of a 3x3 matrix.
template<typename T>
constexpr Matrix3< T > transpose (const Matrix3< T > &matrix) noexcept
 Computes the transpose of a 3x3 matrix.
template<typename T, typename U>
constexpr auto operator* (const Matrix3< T > &matrix, const Vector3< U > &vector) noexcept
 Matrix-vector multiplication.
template<typename T>
constexpr Matrix3< T > operator* (const Matrix3< T > &mat_a, const Matrix3< T > &mat_b) noexcept
 Matrix-matrix multiplication.
template<typename Scalar, typename T>
requires std::is_arithmetic_v<Scalar>
constexpr Vector3< T > operator* (Scalar scalar, const Vector3< T > &vec) noexcept
 Scalar-vector multiplication.
template<typename T>
void computeDsqBlock (T ref_x, T ref_y, T ref_z, const PositionBlockT< T > &block, T *out_dsq) noexcept
 Computes squared distances from a reference point to a SoA block of positions.
template<typename AtomRange, typename T = real_t>
std::size_t fillPositionBlock (const FillPositionBlockParams< AtomRange, T > &params) noexcept
 Populates vectors with standard atom block positions for SIMD.
template<typename T>
T sincIntegral (const SincIntegralParams< T > &params) noexcept
 Computes a sinc-weighted integral over a range.
double sincIntegral (double q_magnitude, const double *integrand, const double *radial_bins, double *sinqr_scratch, std::size_t count) noexcept
 Computes a sinc-weighted integral for double precision (backward compatibility).
float sincIntegral (float q_magnitude, const float *integrand, const float *radial_bins, float *sinqr_scratch, std::size_t count) noexcept
 Computes a sinc-weighted integral for single precision (backward compatibility).
template<typename T>
void normalizeRdfBins (const RDFNormalizationParams< T > &params) noexcept
 Normalizes Radial Distribution Function (RDF) bins.
template<typename T>
void scaleBins (const ScaleBinsParams< T > &params) noexcept
 Scales an array by a constant factor in-place using ScaleBinsParams container.
template<typename T>
void scaleBins (T *arr, T scale_factor, std::size_t count) noexcept
 Scales an array by a constant factor in-place.
template<typename T>
T simdDot (const T *input_a, const T *input_b, std::size_t count) noexcept
 Computes the dot product of two array buffers.
template<typename T>
void dotBlock (T v1x, T v1y, T v1z, const T *v2x, const T *v2y, const T *v2z, T *out_dot, std::size_t count) noexcept
 Computes dot products between a reference vector and a block of target vectors.
template<typename T>
T debyeSum (T q_magnitude, const T *distances, T *scratch, std::size_t count) noexcept
 Computes the Debye scattering equation sum across distances.
template<typename T>
void complexExpSum (T q_x, T q_y, T q_z, const T *x_s, const T *y_s, const T *z_s, std::size_t count, ComplexExpSumResult< T > &result) noexcept
 Computes the sum of complex exponentials for a query q-vector.
template<typename T>
void complexExpSum (const ComplexExpSumParams< T > &params, ComplexExpSumResult< T > &result) noexcept
template<typename T = real_t>
ComplexExpSumResult< T > complexExpSum (T q_x, T q_y, T q_z, const T *x_s, const T *y_s, const T *z_s, std::size_t count) noexcept
template<typename T = real_t>
ComplexExpSumResult< T > complexExpSum (const MillerExpSumParams< T > &params) noexcept
template<typename T>
void millerPhaseSum (const MillerPhaseSumParams< T > &params, MillerPhaseSumResult< T > &result) noexcept
 Computes the Miller phase sum across angle blocks.
template<typename T = real_t>
MillerPhaseSumResult< T > millerPhaseSum (const MillerPhaseSumParams< T > &params) noexcept
template<typename T>
void millerPhaseSum (const T *cos1, const T *sin1, const T *cos2, const T *sin2, const T *cos3, const T *sin3, std::size_t count, MillerPhaseSumResult< T > &result) noexcept
template<typename T = real_t>
MillerPhaseSumResult< T > millerPhaseSum (const T *cos1, const T *sin1, const T *cos2, const T *sin2, const T *cos3, const T *sin3, std::size_t count) noexcept
template<typename T>
T distSqScalar (Point3T< T > point_a, Point3T< T > point_b) noexcept
 Computes the squared distance between two 3D points.
real_t distSqScalar (Point3 point_a, Point3 point_b) noexcept
 Non-templated overload of distSqScalar for backward compatibility.
const char * simdLevelString () noexcept
 Returns a string describing the compiled SIMD instruction set level.
std::vector< real_t > generateKernel (const KernelGenerationParams &params)
 Generates a smoothing kernel.
std::vector< real_t > kernelSmoothing (const std::vector< real_t > &y_values, KernelSmoothingParams params)
 Applies kernel smoothing to a data series.
std::vector< real_t > kernelSmoothing (const std::vector< real_t > &r_values, const std::vector< real_t > &y_values, KernelSmoothingParams params)
 Grid overload: derives bin_width from the independent variable grid.
real_t factorial (int n)
 Inline helper for factorials up to 20. Beyond 20, the values exceed the capacity of a 64-bit integer, so we return real_t for consistency.
real_t sphLegendre (LegendreParams params, real_t theta)
 Computes the spherical associated Legendre polynomial corresponding to std::sph_legendre from C++17.
void sphLegendreBatch (LegendreParams params, const real_t *theta, real_t *results, size_t count)
 Vectorized version of sphLegendre. Computes the polynomial for a range of angles.

Variables

constexpr real_t PI
 High-precision mathematical pi constant.
constexpr real_t RAD_TO_DEG
 Conversion factor: Radians to Degrees.
constexpr real_t DEG_TO_RAD
 Conversion factor: Degrees to Radians.
constexpr real_t THZ_TO_CMINV = static_cast<real_t>(33.35641)
 Conversion factor: THz to cm^-1.
constexpr real_t THZ_TO_MEV = static_cast<real_t>(4.135667)
 Conversion factor: THz to meV.
constexpr real_t BOHR_TO_ANGSTROM
 Conversion factor: Bohr to Angstroms.
constexpr real_t ANGSTROM_TO_BOHR
 Conversion factor: Angstroms to Bohr.
constexpr real_t TWO_PI = static_cast<real_t>(2.0) * PI
 2 * PI
constexpr real_t FOUR_PI = static_cast<real_t>(4.0) * PI
 4 * PI
constexpr real_t KB_EV_PER_K = static_cast<real_t>(8.617333262e-5)
 Boltzmann constant in eV/K.
constexpr real_t HBAR_EV_PS
 Reduced Planck constant in eV*ps.
constexpr real_t MAX_CUTOFF_RADIUS
 Maximum allowable cutoff radius in Angstroms.

Detailed Description

Defines universal mathematical and physical constants.

Typedef Documentation

◆ ComplexExpSumParams

template<typename T = real_t>
using correlation::math::ComplexExpSumParams = MillerExpSumParams<T>

Alias for MillerExpSumParams used with complexExpSum kernel invocations.

◆ Matrix3R

◆ MillerPhaseSumResult

template<typename T = real_t>
using correlation::math::MillerPhaseSumResult = ComplexExpSumResult<T>

Alias for MillerPhaseSumResult used with millerPhaseSum kernel invocations.

◆ PhaseSumResult

template<typename T = real_t>
using correlation::math::PhaseSumResult = ComplexExpSumResult<T>

Alias for PhaseSumResult used with phase sum kernel invocations.

◆ Point3

Backward-compatible type alias for default real_t precision Point3.

◆ PositionBlock

Backward-compatible type alias for default real_t precision PositionBlock.

◆ Vector3R

Precision-configurable aliases for 3D vectors and 3x3 matrices.

Enumeration Type Documentation

◆ KernelType

enum class correlation::math::KernelType : std::uint8_t
strong

Selection of kernel types for smoothing.

Enumerator
Gaussian 
Bump 
Triweight 
Epanechnikov 
Cosine 
Biweight 

Function Documentation

◆ autocorrelate() [1/2]

template<typename T = real_t>
std::vector< T > correlation::math::autocorrelate ( const std::vector< T > & signal)
inlinenodiscard

Convenience overload — allocates its own workspace.

Prefer the two-argument overload in tight loops to recycle the allocation.

Parameters
signalInput signal vector.
Returns
The autocorrelation vector.
Here is the call graph for this function:

◆ autocorrelate() [2/2]

template<typename T = real_t>
std::vector< T > correlation::math::autocorrelate ( const std::vector< T > & signal,
std::vector< std::complex< T > > & workspace )
inlinenodiscard

Computes the autocorrelation of a 1D real sequence using FFT.

Parameters
signalInput signal.
workspaceReusable scratch buffer. Resized automatically when needed. Pass the same buffer across repeated calls (e.g. per-atom loops) to avoid repeated heap allocation.
Returns
Autocorrelation sequence of length N equal to signal.size().
Here is the call graph for this function:
Here is the caller graph for this function:

◆ complexExpSum() [1/4]

template<typename T>
void correlation::math::complexExpSum ( const ComplexExpSumParams< T > & params,
ComplexExpSumResult< T > & result )
inlinenoexcept
Here is the call graph for this function:

◆ complexExpSum() [2/4]

template<typename T = real_t>
ComplexExpSumResult< T > correlation::math::complexExpSum ( const MillerExpSumParams< T > & params)
inlinenoexcept
Here is the call graph for this function:

◆ complexExpSum() [3/4]

template<typename T = real_t>
ComplexExpSumResult< T > correlation::math::complexExpSum ( T q_x,
T q_y,
T q_z,
const T * x_s,
const T * y_s,
const T * z_s,
std::size_t count )
inlinenoexcept
Here is the call graph for this function:

◆ complexExpSum() [4/4]

template<typename T>
void correlation::math::complexExpSum ( T q_x,
T q_y,
T q_z,
const T * x_s,
const T * y_s,
const T * z_s,
std::size_t count,
ComplexExpSumResult< T > & result )
inlinenoexcept

Computes the sum of complex exponentials for a query q-vector.

Template Parameters
TCoordinate scalar type (float or double).
Here is the caller graph for this function:

◆ computeDsqBlock()

template<typename T>
void correlation::math::computeDsqBlock ( T ref_x,
T ref_y,
T ref_z,
const PositionBlockT< T > & block,
T * out_dsq )
inlinenoexcept

Computes squared distances from a reference point to a SoA block of positions.

Template Parameters
TFloating-point coordinate type (float or double).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeFFT()

template<typename T = double>
void correlation::math::computeFFT ( std::vector< std::complex< T > > & data,
bool invert )
inline

Simple Radix-2 Cooley-Tukey FFT implementation with bit-reversal optimization.

Parameters
dataThe input/output vector of complex numbers. Modifies in-place.
invertIf true, performs an inverse FFT and scales the result by 1/N.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cross() [1/2]

Vector3< double > correlation::math::cross ( const Vector3< double > & vec_a,
const Vector3< double > & vec_b )
inlinenodiscardnoexcept

Computes the cross product of two 3D vectors.

Optimized specialization for double using manual calculations to help the compiler generate aligned SIMD code.

Parameters
vec_aThe first vector.
vec_bThe second vector.
Returns
A new Vector3 representing the cross product vec_a x vec_b.

◆ cross() [2/2]

template<typename T>
Vector3< T > correlation::math::cross ( const Vector3< T > & vec_a,
const Vector3< T > & vec_b )
nodiscardconstexprnoexcept

Computes the cross product of two 3D vectors.

Parameters
vec_aThe first vector.
vec_bThe second vector.
Returns
A new Vector3 representing the cross product vec_a x vec_b.
Here is the caller graph for this function:

◆ debyeSum()

template<typename T>
T correlation::math::debyeSum ( T q_magnitude,
const T * distances,
T * scratch,
std::size_t count )
inlinenoexcept

Computes the Debye scattering equation sum across distances.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:

◆ determinant()

template<typename T>
T correlation::math::determinant ( const Matrix3< T > & matrix)
nodiscardconstexprnoexcept

Computes the determinant of a 3x3 matrix.

Parameters
matrixThe matrix.
Returns
The determinant.
Here is the caller graph for this function:

◆ distance()

template<typename T>
T correlation::math::distance ( const Vector3< T > & vec_a,
const Vector3< T > & vec_b )
nodiscardconstexprnoexcept

Computes the distance between two vectors.

Parameters
vec_aThe first vector.
vec_bThe second vector.
Returns
The Euclidean distance between vec_a and vec_b.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ distSqScalar() [1/2]

real_t correlation::math::distSqScalar ( Point3 point_a,
Point3 point_b )
inlinenodiscardnoexcept

Non-templated overload of distSqScalar for backward compatibility.

Parameters
[in]point_aThe first point.
[in]point_bThe second point.
Returns
The scalar squared distance using real_t.
Here is the call graph for this function:

◆ distSqScalar() [2/2]

template<typename T>
T correlation::math::distSqScalar ( Point3T< T > point_a,
Point3T< T > point_b )
inlinenodiscardnoexcept

Computes the squared distance between two 3D points.

Template Parameters
TFloating point coordinate type.
Parameters
[in]point_aThe first point.
[in]point_bThe second point.
Returns
The scalar squared distance.
Here is the caller graph for this function:

◆ dot()

template<typename T>
T correlation::math::dot ( const Vector3< T > & vec_a,
const Vector3< T > & vec_b )
nodiscardconstexprnoexcept

Computes the dot product of two vectors.

Parameters
vec_aThe first vector.
vec_bThe second vector.
Returns
The scalar dot product.
Here is the caller graph for this function:

◆ dotBlock()

template<typename T>
void correlation::math::dotBlock ( T v1x,
T v1y,
T v1z,
const T * v2x,
const T * v2y,
const T * v2z,
T * out_dot,
std::size_t count )
inlinenoexcept

Computes dot products between a reference vector and a block of target vectors.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:

◆ factorial()

real_t correlation::math::factorial ( int n)
inline

Inline helper for factorials up to 20. Beyond 20, the values exceed the capacity of a 64-bit integer, so we return real_t for consistency.

Parameters
nthe number to compute factorial for.
Returns
The factorial of n.
Here is the caller graph for this function:

◆ fillPositionBlock()

template<typename AtomRange, typename T = real_t>
std::size_t correlation::math::fillPositionBlock ( const FillPositionBlockParams< AtomRange, T > & params)
inlinenoexcept

Populates vectors with standard atom block positions for SIMD.

Template Parameters
AtomRangeA range of atom objects (e.g., std::vector<Atom>).
TCoordinate scalar type (defaults to real_t).

◆ findNextGoodFFTSize()

size_t correlation::math::findNextGoodFFTSize ( size_t target)
inlinenodiscard

Finds the next "good" FFT size >= target.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateKernel()

std::vector< real_t > correlation::math::generateKernel ( const KernelGenerationParams & params)
inlinenodiscard

Generates a smoothing kernel.

Parameters
paramsThe parameters for kernel generation.
Returns
A vector containing the normalized kernel.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invert()

template<typename T>
Matrix3< T > correlation::math::invert ( const Matrix3< T > & matrix)
nodiscardconstexpr

Computes the inverse of a 3x3 matrix.

Parameters
matrixThe matrix to invert.
Returns
The inverted matrix.
Exceptions
std::runtime_errorif the matrix is singular (determinant near zero).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isGoodFFTSize()

bool correlation::math::isGoodFFTSize ( size_t n)
inlinenodiscard

Helper to check if a size is a product of small prime factors (2, 3, 5). Highly optimized for FFTW3 and MKL.

Here is the caller graph for this function:

◆ kernelSmoothing() [1/2]

std::vector< real_t > correlation::math::kernelSmoothing ( const std::vector< real_t > & r_values,
const std::vector< real_t > & y_values,
KernelSmoothingParams params )
inline

Grid overload: derives bin_width from the independent variable grid.

Parameters
r_valuesThe independent variable grid (e.g., radial distances).
y_valuesThe dependent variable values to be smoothed.
paramsKernel smoothing configuration parameters.
Returns
A vector containing the smoothed data.
Here is the call graph for this function:

◆ kernelSmoothing() [2/2]

std::vector< real_t > correlation::math::kernelSmoothing ( const std::vector< real_t > & y_values,
KernelSmoothingParams params )
inline

Applies kernel smoothing to a data series.

This function convolves the chosen kernel with y_values to produce a smoothed version. The bin width in params characterises the sampling grid.

Parameters
y_valuesThe dependent variable values to be smoothed.
paramsKernel smoothing configuration parameters.
Returns
A vector containing the smoothed data (same length as y_values).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ millerPhaseSum() [1/4]

template<typename T = real_t>
MillerPhaseSumResult< T > correlation::math::millerPhaseSum ( const MillerPhaseSumParams< T > & params)
inlinenoexcept
Here is the call graph for this function:

◆ millerPhaseSum() [2/4]

template<typename T>
void correlation::math::millerPhaseSum ( const MillerPhaseSumParams< T > & params,
MillerPhaseSumResult< T > & result )
inlinenoexcept

Computes the Miller phase sum across angle blocks.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ millerPhaseSum() [3/4]

template<typename T = real_t>
MillerPhaseSumResult< T > correlation::math::millerPhaseSum ( const T * cos1,
const T * sin1,
const T * cos2,
const T * sin2,
const T * cos3,
const T * sin3,
std::size_t count )
inlinenoexcept
Here is the call graph for this function:

◆ millerPhaseSum() [4/4]

template<typename T>
void correlation::math::millerPhaseSum ( const T * cos1,
const T * sin1,
const T * cos2,
const T * sin2,
const T * cos3,
const T * sin3,
std::size_t count,
MillerPhaseSumResult< T > & result )
inlinenoexcept
Here is the call graph for this function:

◆ norm()

template<typename T>
T correlation::math::norm ( const Vector3< T > & vec_a)
nodiscardconstexprnoexcept

Computes the vector norm (length).

Parameters
vec_aThe vector.
Returns
The length of the vector.
Here is the caller graph for this function:

◆ normalize()

template<typename T>
Vector3< T > correlation::math::normalize ( const Vector3< T > & vec_a)
nodiscardconstexpr

Normalizes the given vector.

Parameters
vec_aThe vector to normalize.
Returns
A normalized copy of the vector.
Exceptions
std::domain_errorif the vector length is too close to zero.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizeRdfBins()

template<typename T>
void correlation::math::normalizeRdfBins ( const RDFNormalizationParams< T > & params)
inlinenoexcept

Normalizes Radial Distribution Function (RDF) bins.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:

◆ normSq()

template<typename T>
T correlation::math::normSq ( const Vector3< T > & vec_a)
nodiscardconstexprnoexcept

Computes the squared vector norm (length).

Parameters
vec_aThe vector.
Returns
The squared length of the vector.
Here is the caller graph for this function:

◆ operator*() [1/3]

template<typename T>
Matrix3< T > correlation::math::operator* ( const Matrix3< T > & mat_a,
const Matrix3< T > & mat_b )
nodiscardconstexprnoexcept

Matrix-matrix multiplication.

Template Parameters
TScalar type.
Parameters
mat_aLeft matrix.
mat_bRight matrix.
Returns
Resulting matrix product mat_a * mat_b.

◆ operator*() [2/3]

template<typename T, typename U>
auto correlation::math::operator* ( const Matrix3< T > & matrix,
const Vector3< U > & vector )
nodiscardconstexprnoexcept

Matrix-vector multiplication.

Template Parameters
TCoordinate type.
Parameters
matrix3x3 matrix.
vector3D vector.
Returns
Transformed vector matrix * vector.

◆ operator*() [3/3]

template<typename Scalar, typename T>
requires std::is_arithmetic_v<Scalar>
Vector3< T > correlation::math::operator* ( Scalar scalar,
const Vector3< T > & vec )
nodiscardconstexprnoexcept

Scalar-vector multiplication.

Template Parameters
ScalarArithmetic type.
TVector coordinate type.
Parameters
scalarScaling factor.
vecInput vector.
Returns
Scaled vector scalar * vec.

◆ scaleBins() [1/2]

template<typename T>
void correlation::math::scaleBins ( const ScaleBinsParams< T > & params)
inlinenoexcept

Scales an array by a constant factor in-place using ScaleBinsParams container.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scaleBins() [2/2]

template<typename T>
void correlation::math::scaleBins ( T * arr,
T scale_factor,
std::size_t count )
inlinenoexcept

Scales an array by a constant factor in-place.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:

◆ simdDot()

template<typename T>
T correlation::math::simdDot ( const T * input_a,
const T * input_b,
std::size_t count )
inlinenoexcept

Computes the dot product of two array buffers.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simdLevelString()

const char * correlation::math::simdLevelString ( )
inlinenodiscardnoexcept

Returns a string describing the compiled SIMD instruction set level.

Returns
String representation of the SIMD level ("AVX-512", "AVX2", or "Scalar").

◆ sincIntegral() [1/3]

template<typename T>
T correlation::math::sincIntegral ( const SincIntegralParams< T > & params)
inlinenoexcept

Computes a sinc-weighted integral over a range.

Template Parameters
TFloating-point precision (float or double).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sincIntegral() [2/3]

double correlation::math::sincIntegral ( double q_magnitude,
const double * integrand,
const double * radial_bins,
double * sinqr_scratch,
std::size_t count )
inlinenoexcept

Computes a sinc-weighted integral for double precision (backward compatibility).

Here is the call graph for this function:

◆ sincIntegral() [3/3]

float correlation::math::sincIntegral ( float q_magnitude,
const float * integrand,
const float * radial_bins,
float * sinqr_scratch,
std::size_t count )
inlinenoexcept

Computes a sinc-weighted integral for single precision (backward compatibility).

Here is the call graph for this function:

◆ sphLegendre()

real_t correlation::math::sphLegendre ( LegendreParams params,
real_t theta )
inline

Computes the spherical associated Legendre polynomial corresponding to std::sph_legendre from C++17.

Specifically, computes Y_l^m(theta, 0) without the Condon-Shortley phase.

Parameters
paramsDegree and order parameters.
thetaThe colatitudinal angle in radians.
Returns
The evaluated spherical Legendre polynomial.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sphLegendreBatch()

void correlation::math::sphLegendreBatch ( LegendreParams params,
const real_t * theta,
real_t * results,
size_t count )
inline

Vectorized version of sphLegendre. Computes the polynomial for a range of angles.

Parameters
paramsDegree and order parameters.
thetaArray of colatitudinal angles.
resultsOutput array where computed polynomials will be stored.
countNumber of angles to process.
Here is the call graph for this function:

◆ transpose()

template<typename T>
Matrix3< T > correlation::math::transpose ( const Matrix3< T > & matrix)
nodiscardconstexprnoexcept

Computes the transpose of a 3x3 matrix.

Parameters
matrixThe matrix to transpose.
Returns
The transposed matrix.

Variable Documentation

◆ ANGSTROM_TO_BOHR

real_t correlation::math::ANGSTROM_TO_BOHR
constexpr
Initial value:
=
static_cast<real_t>(1.0) / BOHR_TO_ANGSTROM
constexpr real_t BOHR_TO_ANGSTROM
Conversion factor: Bohr to Angstroms.
Definition Constants.hpp:37
double real_t
Definition Precision.hpp:18

Conversion factor: Angstroms to Bohr.

◆ BOHR_TO_ANGSTROM

real_t correlation::math::BOHR_TO_ANGSTROM
constexpr
Initial value:
=
static_cast<real_t>(0.529177210903)

Conversion factor: Bohr to Angstroms.

◆ DEG_TO_RAD

real_t correlation::math::DEG_TO_RAD
constexpr
Initial value:
=
PI / static_cast<real_t>(180.0)
constexpr real_t PI
High-precision mathematical pi constant.
Definition Constants.hpp:27

Conversion factor: Degrees to Radians.

◆ FOUR_PI

real_t correlation::math::FOUR_PI = static_cast<real_t>(4.0) * PI
constexpr

4 * PI

◆ HBAR_EV_PS

real_t correlation::math::HBAR_EV_PS
constexpr
Initial value:
=
static_cast<real_t>(6.582119569e-4)

Reduced Planck constant in eV*ps.

◆ KB_EV_PER_K

real_t correlation::math::KB_EV_PER_K = static_cast<real_t>(8.617333262e-5)
constexpr

Boltzmann constant in eV/K.

◆ MAX_CUTOFF_RADIUS

real_t correlation::math::MAX_CUTOFF_RADIUS
constexpr
Initial value:
=
static_cast<real_t>(50.0)

Maximum allowable cutoff radius in Angstroms.

◆ PI

real_t correlation::math::PI
constexpr
Initial value:
= static_cast<real_t>(
3.1415926535897932384626433832795028841971693993751058209749445923078164062)

High-precision mathematical pi constant.

◆ RAD_TO_DEG

real_t correlation::math::RAD_TO_DEG
constexpr
Initial value:
=
static_cast<real_t>(180.0) / PI

Conversion factor: Radians to Degrees.

◆ THZ_TO_CMINV

real_t correlation::math::THZ_TO_CMINV = static_cast<real_t>(33.35641)
constexpr

Conversion factor: THz to cm^-1.

◆ THZ_TO_MEV

real_t correlation::math::THZ_TO_MEV = static_cast<real_t>(4.135667)
constexpr

Conversion factor: THz to meV.

◆ TWO_PI

real_t correlation::math::TWO_PI = static_cast<real_t>(2.0) * PI
constexpr

2 * PI