OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
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
 Compute dst[i] = a[i] + b[i] over n doubles.
 
void multiply (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept
 Compute dst[i] = a[i] * b[i] over n doubles.
 
double min (const double *a, std::size_t n) noexcept
 Reduce an array to its minimum value.
 
double max (const double *a, std::size_t n) noexcept
 Reduce an array to its maximum value.
 
void clamp (double *a, double lo, double hi, std::size_t n) noexcept
 Clamp each array element in place to an inclusive interval.
 
double dot (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, std::size_t n) noexcept
 Sum corresponding products from two arrays.
 
constexpr std::size_t lane_width () noexcept
 Report the compile-time number of doubles per SIMD register.
 
void sqrt_array (const double *OPENSWMM_RESTRICT a, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept
 Compute dst[i] = sqrt(a[i]) over n doubles.
 
void fabs_array (const double *OPENSWMM_RESTRICT a, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept
 Compute dst[i] = fabs(a[i]) over n doubles.
 
void fma_array (const double *OPENSWMM_RESTRICT a, const double *OPENSWMM_RESTRICT b, const double *OPENSWMM_RESTRICT c, double *OPENSWMM_RESTRICT dst, std::size_t n) noexcept
 Compute dst[i] = a[i] * b[i] + c[i] over n doubles.
 

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

Compute dst[i] = a[i] + b[i] over n doubles.

Parameters
[in]aBorrowed readable array of at least n elements.
[in]bBorrowed readable array of at least n elements.
[out]dstBorrowed writable array of at least n elements.
[in]nElement count; any size, including zero, is supported.
Precondition
Source and destination arrays do not overlap. For n > 0 all pointers are non-null. No SIMD alignment is required.
Note
No storage is retained. A scalar tail handles partial SIMD lanes.

◆ clamp()

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

Clamp each array element in place to an inclusive interval.

Parameters
[in,out]aBorrowed writable array of at least n doubles; non-null when n > 0. No alignment requirement applies.
[in]loLower bound, in the same units as the array elements.
[in]hiUpper bound; must be >= lo.
[in]nElement count; zero leaves the array untouched.
Note
No storage is retained. NaN behavior follows backend comparisons.

◆ dot()

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

Sum corresponding products from two arrays.

Parameters
[in]aBorrowed readable array of at least n doubles.
[in]bBorrowed readable array of at least n doubles.
[in]nElement count; zero returns zero without accessing the arrays.
Returns
Sum of a[i] * b[i], in the product of the inputs' units.
Precondition
Arrays are non-null for n > 0 and satisfy the restrict alias contract.
Note
No alignment is required. SIMD lanes may use fused multiply-add and a different summation order; scalar tails use ordinary accumulation. No Kahan compensation is performed and no storage is retained.

◆ fabs_array()

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

Compute dst[i] = fabs(a[i]) over n doubles.

Parameters
[in]aBorrowed readable array of at least n doubles.
[out]dstBorrowed writable array of at least n doubles.
[in]nElement count; zero performs no reads or writes.
Precondition
Arrays do not overlap and are non-null for n > 0.
Note
Output values are nonnegative magnitudes. No storage is retained; alignment is unrestricted and the compiler may vectorize the loop.

◆ fma_array()

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

Compute dst[i] = a[i] * b[i] + c[i] over n doubles.

Parameters
[in]aBorrowed first-factor array with at least n elements.
[in]bBorrowed second-factor array with at least n elements.
[in]cBorrowed addend array with at least n elements, in product units.
[out]dstBorrowed writable result array with at least n elements.
[in]nElement count; zero performs no reads or writes.
Precondition
Arrays do not overlap and are non-null for n > 0.
Note
No storage is retained and no alignment is required. The expression uses ordinary multiply and add; fusion depends on compiler settings.

◆ lane_width()

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

Report the compile-time number of doubles per SIMD register.

Returns
Four for AVX2, two for NEON, or one for the scalar backend.

◆ max()

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

Reduce an array to its maximum value.

Parameters
[in]aNon-null borrowed array of at least n readable doubles.
[in]nElement count, at least one; checked by assert in debug builds.
Returns
Maximum element for finite inputs. NaN behavior follows the selected SIMD intrinsics or scalar comparisons and may differ between backends.
Note
No SIMD alignment is required and no storage is retained.

◆ min()

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

Reduce an array to its minimum value.

Parameters
[in]aNon-null borrowed array of at least n readable doubles.
[in]nElement count, at least one; checked by assert in debug builds.
Returns
Minimum element for finite inputs. NaN behavior follows the selected SIMD intrinsics or scalar comparisons and may differ between backends.
Note
No SIMD alignment is required and no storage is retained.

◆ multiply()

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

Compute dst[i] = a[i] * b[i] over n doubles.

Parameters
[in]aBorrowed readable array of at least n elements.
[in]bBorrowed readable array of at least n elements.
[out]dstBorrowed writable array of at least n elements.
[in]nElement count; any size, including zero, is supported.
Precondition
Source and destination arrays do not overlap. For n > 0 all pointers are non-null. No SIMD alignment is required.
Note
No storage is retained. A scalar tail handles partial SIMD lanes.
Here is the caller graph for this function:

◆ sqrt_array()

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

Compute dst[i] = sqrt(a[i]) over n doubles.

Parameters
[in]aBorrowed readable array of at least n doubles.
[out]dstBorrowed writable array of at least n doubles.
[in]nElement count; zero performs no reads or writes.
Precondition
Arrays do not overlap and are non-null for n > 0.
Note
Negative inputs follow std::sqrt domain behavior. No storage is retained; alignment is unrestricted and the compiler may vectorize the loop.