Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::net_detail::Flow_Sum< Flow_Type > Struct Template Reference

A sum of floating flows that keeps the error of its rounding, as hi + lo, by the error-free addition of Knuth: a small flow beside a large one, as 0.53 beside 7e13, which the sum rounds away, comes back when the large one goes. More...

#include <tpl_net.H>

Public Member Functions

void add (const Flow_Type &x) noexcept
 Adds x.
 
void replace (const Flow_Type &from, const Flow_Type &to) noexcept
 Replaces the term from, which the sum has, by to.
 
Flow_Type value () const noexcept
 The sum, rounded once.
 
Flow_Type minus (const Flow_Sum &other) const noexcept
 This sum less other, rounded once but for the errors of lo.
 

Public Attributes

Flow_Type hi {0}
 The sum, rounded.
 
Flow_Type lo {0}
 What its rounding lost.
 

Detailed Description

template<typename Flow_Type>
struct Aleph::net_detail::Flow_Sum< Flow_Type >

A sum of floating flows that keeps the error of its rounding, as hi + lo, by the error-free addition of Knuth: a small flow beside a large one, as 0.53 beside 7e13, which the sum rounds away, comes back when the large one goes.

The preflows and HLPP sum so the flows of their nodes. It needs strict floating arithmetic, which -ffast-math and /fp:fast are not: with them a floating flow does not compile.

Definition at line 1304 of file tpl_net.H.

Member Function Documentation

◆ add()

◆ minus()

template<typename Flow_Type >
Flow_Type Aleph::net_detail::Flow_Sum< Flow_Type >::minus ( const Flow_Sum< Flow_Type > &  other) const
inlinenoexcept

◆ replace()

template<typename Flow_Type >
void Aleph::net_detail::Flow_Sum< Flow_Type >::replace ( const Flow_Type &  from,
const Flow_Type &  to 
)
inlinenoexcept

Replaces the term from, which the sum has, by to.

Definition at line 1325 of file tpl_net.H.

References Aleph::net_detail::Flow_Sum< Flow_Type >::add().

◆ value()

template<typename Flow_Type >
Flow_Type Aleph::net_detail::Flow_Sum< Flow_Type >::value ( ) const
inlinenoexcept

Member Data Documentation

◆ hi

◆ lo


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