Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
KahanSum Struct Reference

Public Member Functions

void add (double value)
 
double result () const
 

Public Attributes

double sum = 0.0
 
double correction = 0.0
 

Detailed Description

Definition at line 23 of file ApplyWeights.cpp.

Member Function Documentation

◆ add()

void KahanSum::add ( double  value)
inline

Definition at line 28 of file ApplyWeights.cpp.

29  {
30  double y = value - correction; // Correct the input
31  double t = sum + y; // Perform the sum
32  correction = ( t - sum ) - y; // Update correction
33  sum = t; // Store the new sum
34  }

References correction, and sum.

Referenced by deterministicSparseMatVecMulKahan(), and pairwiseKahanSum().

◆ result()

double KahanSum::result ( ) const
inline

Definition at line 36 of file ApplyWeights.cpp.

37  {
38  return sum;
39  }

References sum.

Referenced by deterministicSparseMatVecMulKahan(), and pairwiseKahanSum().

Member Data Documentation

◆ correction

double KahanSum::correction = 0.0

Definition at line 26 of file ApplyWeights.cpp.

Referenced by add().

◆ sum

double KahanSum::sum = 0.0

Definition at line 25 of file ApplyWeights.cpp.

Referenced by add(), and result().


The documentation for this struct was generated from the following file: