CYCLUS
Loading...
Searching...
No Matches
cyclus::compmath Namespace Reference

Functions

CompMap Add (const CompMap &v1, const CompMap &v2)
 
bool AllPositive (const CompMap &v)
 
bool AlmostEq (const CompMap &v1, const CompMap &v2, double threshold)
 
void ApplyThreshold (CompMap *v, double threshold)
 
void Normalize (CompMap *v, double val=1.0)
 
CompMap Sub (const CompMap &v1, const CompMap &v2)
 
double Sum (const CompMap &v1)
 
bool ValidNucs (const CompMap &v)
 

Detailed Description

Contains functions for performing fundamental operations on CompMap's.

Function Documentation

◆ Add()

CompMap cyclus::compmath::Add ( const CompMap & v1,
const CompMap & v2 )

Does component-wise subtraction of the nuclide quantities of v1 and v2 and returns the result.

No normalization is done. Example:

v1[922350000] = 2.3;
v1[922380000] = 1.3;
v2[922350000] = 1.1;
v2[922380000] = 1.2;
// v3[922350000] == 3.4, v3[922380000] == 2.5
CompMap Add(const CompMap &v1, const CompMap &v2)
Does component-wise subtraction of the nuclide quantities of v1 and v2 and returns the result.
Definition comp_math.cc:18
std::map< Nuc, double > CompMap
a raw definition of nuclides and corresponding (dimensionless quantities).
Definition composition.h:17
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters

Definition at line 18 of file comp_math.cc.

◆ AllPositive()

bool cyclus::compmath::AllPositive ( const CompMap & v)

Returns true if all nuclides in v have quantities greater than or equal to zero.

Definition at line 83 of file comp_math.cc.

◆ AlmostEq()

bool cyclus::compmath::AlmostEq ( const CompMap & v1,
const CompMap & v2,
double threshold )

Returns true if all nuclides of v1 and v2 are the same within threshold.

No normalization is performed.

Definition at line 93 of file comp_math.cc.

◆ ApplyThreshold()

void cyclus::compmath::ApplyThreshold ( CompMap * v,
double threshold )

All nuclides with quantities below threshold will have their quantity set to zero.

Definition at line 45 of file comp_math.cc.

◆ Normalize()

void cyclus::compmath::Normalize ( CompMap * v,
double val )

The sum of quantities of all nuclides of v is normalized to val.

Definition at line 63 of file comp_math.cc.

◆ Sub()

CompMap cyclus::compmath::Sub ( const CompMap & v1,
const CompMap & v2 )

Does component-wise subtraction of the nuclide quantities of v1 and v2 and returns the result.

No normalization is done.

Definition at line 27 of file comp_math.cc.

◆ Sum()

double cyclus::compmath::Sum ( const CompMap & v)

Sums the quantities of all nuclides without normalization.

Definition at line 36 of file comp_math.cc.

◆ ValidNucs()

bool cyclus::compmath::ValidNucs ( const CompMap & v)

Returns true if all nuclide keys in v are valid.

Definition at line 73 of file comp_math.cc.