![]() |
The ROme OpTimistic Simulator
2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
|
Numerical Library. More...
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | _numerical_state |
struct | _sum_helper_t |
this represents a partial Neumaier sum More... | |
Macros | |
#define | ValueSumHelper(a) (a.crt + a.sum) |
#define | CmpSumHelpers(a, b) |
Typedefs | |
typedef uint64_t | seed_type |
Numerical seed type. | |
typedef struct _numerical_state | numerical_state_t |
Functions | |
void | numerical_init (void) |
double | NeumaierSum (unsigned cnt, double addendums[cnt]) |
struct _sum_helper_t | PartialNeumaierSum (struct _sum_helper_t sh, double addendum) |
Numerical Library.
Piece-Wise Deterministic Random Number Generators.
This file is part of ROOT-Sim (ROme OpTimistic Simulator).
ROOT-Sim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 3 of the License applies.
ROOT-Sim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ROOT-Sim; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Definition in file numerical.h.
#define CmpSumHelpers | ( | a, | |
b | |||
) |
Definition at line 65 of file numerical.h.
typedef struct _numerical_state numerical_state_t |
This structure keeps track of the per-LP members required to rollback the internal state of the simulation library.
double NeumaierSum | ( | unsigned | cnt, |
double | addendums[cnt] | ||
) |
Calculates a sum within double variables with bounded approximation error
This implements a variant of the Kahan summation algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm This is used in the topology module to calculate minimum costs and weighted probabilities since the classic iterated floating point sum may result in unbounded errors originated from the limited precision of the underlying floating point representation.
cnt | the number of addendums to sum |
addendums | a pointer to a sequence of cnt doubles |
Definition at line 432 of file numerical.c.
struct _sum_helper_t PartialNeumaierSum | ( | struct _sum_helper_t | sh, |
double | addendum | ||
) |
Calculates a partial sum within double variables with bounded approximation error
This has similar utilization to <NeumaierSum>() with the difference that this can be used to calculate partial sums, adding doubles one by one.
sh | a struct _sum_helper_t holding the partial result typically from a previous sum |
addendum | the double floating point value to add |
Definition at line 463 of file numerical.c.