OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm::simd Namespace Reference

Functions

void add (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept
 Element-wise addition: dst[i] = a[i] + b[i].
 
void multiply (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept
 Element-wise multiplication: dst[i] = a[i] * b[i].
 
double min (const double *a, std::size_t n) noexcept
 Find the minimum value in an array.
 
double max (const double *a, std::size_t n) noexcept
 Find the maximum value in an array.
 
void clamp (double *a, double lo, double hi, std::size_t n) noexcept
 Clamp all elements of an array to [lo, hi].
 
double dot (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, std::size_t n) noexcept
 Dot product of two arrays: sum(a[i] * b[i]).
 
constexpr std::size_t lane_width () noexcept
 Returns the SIMD lane width (doubles per register on this platform).
 

Function Documentation

◆ add()

void openswmm::simd::add ( const double *OPENSWMM_RESTRICT  a,
const double *OPENSWMM_RESTRICT  b,
double *OPENSWMM_RESTRICT  dst,
std::size_t  n 
)
inlinenoexcept

Element-wise addition: dst[i] = a[i] + b[i].

Parameters
aSource array A.
bSource array B.
dstDestination array.
nNumber of elements. Need not be a multiple of the SIMD width.
Note
Arrays may not alias each other (undefined behavior if they do).

◆ clamp()

void openswmm::simd::clamp ( double *  a,
double  lo,
double  hi,
std::size_t  n 
)
inlinenoexcept

Clamp all elements of an array to [lo, hi].

Parameters
aArray to clamp in-place.
loLower bound.
hiUpper bound.
nNumber of elements.

◆ dot()

double openswmm::simd::dot ( const double *OPENSWMM_RESTRICT  a,
const double *OPENSWMM_RESTRICT  b,
std::size_t  n 
)
inlinenoexcept

Dot product of two arrays: sum(a[i] * b[i]).

Note
Uses Kahan compensation on the scalar remainder to minimize floating-point accumulation error.
Parameters
aArray A.
bArray B.
nNumber of elements.
Returns
Sum of element-wise products.

◆ lane_width()

constexpr std::size_t openswmm::simd::lane_width ( )
constexprnoexcept

Returns the SIMD lane width (doubles per register on this platform).

◆ max()

double openswmm::simd::max ( const double *  a,
std::size_t  n 
)
inlinenoexcept

Find the maximum value in an array.

◆ min()

double openswmm::simd::min ( const double *  a,
std::size_t  n 
)
inlinenoexcept

Find the minimum value in an array.

Parameters
aArray of doubles.
nNumber of elements. Must be >= 1.
Returns
Minimum value.

◆ multiply()

void openswmm::simd::multiply ( const double *OPENSWMM_RESTRICT  a,
const double *OPENSWMM_RESTRICT  b,
double *OPENSWMM_RESTRICT  dst,
std::size_t  n 
)
inlinenoexcept

Element-wise multiplication: dst[i] = a[i] * b[i].

Here is the caller graph for this function: