Public Member Functions | Private Attributes | List of all members
net.sf.geographiclib.Accumulator Class Reference

Public Member Functions

 Accumulator (double y)
 
 Accumulator (Accumulator a)
 
void Add (double y)
 
void Negate ()
 
void Set (double y)
 
double Sum ()
 
double Sum (double y)
 

Private Attributes

double _s
 

Detailed Description

An accumulator for sums.

This allow many double precision numbers to be added together with twice the normal precision. Thus the effective precision of the sum is 106 bits or about 32 decimal places.

The implementation follows J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) 305–363 (1997).

In the documentation of the member functions, sum stands for the value currently held in the accumulator.

Definition at line 25 of file Accumulator.java.

Constructor & Destructor Documentation

◆ Accumulator() [1/2]

net.sf.geographiclib.Accumulator.Accumulator ( double  y)
inline

Construct from a double.

Parameters
yset sum = y.

Definition at line 33 of file Accumulator.java.

◆ Accumulator() [2/2]

net.sf.geographiclib.Accumulator.Accumulator ( Accumulator  a)
inline

Construct from another Accumulator.

Parameters
aset sum = a.

Definition at line 39 of file Accumulator.java.

Member Function Documentation

◆ Add()

void net.sf.geographiclib.Accumulator.Add ( double  y)
inline

Add a number to the accumulator.

Parameters
yset sum += y.

Definition at line 69 of file Accumulator.java.

◆ Negate()

void net.sf.geographiclib.Accumulator.Negate ( )
inline

Negate an accumulator.

Set sum = −sum.

Definition at line 112 of file Accumulator.java.

◆ Set()

void net.sf.geographiclib.Accumulator.Set ( double  y)
inline

Set the value to a double.

Parameters
yset sum = y.

Definition at line 45 of file Accumulator.java.

◆ Sum() [1/2]

double net.sf.geographiclib.Accumulator.Sum ( )
inline

Return the value held in the accumulator.

Returns
sum.

Definition at line 51 of file Accumulator.java.

◆ Sum() [2/2]

double net.sf.geographiclib.Accumulator.Sum ( double  y)
inline

Return the result of adding a number to sum (but don't change sum).

Parameters
ythe number to be added to the sum.
Returns
sum + y.

Definition at line 59 of file Accumulator.java.

Member Data Documentation

◆ _s

double net.sf.geographiclib.Accumulator._s
private

Definition at line 27 of file Accumulator.java.


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:47:26