codac 2.0.0
Loading...
Searching...
No Matches
codac2_fixpoint.h
Go to the documentation of this file.
1
9
10#pragma once
11
12namespace codac2
13{
14 template<typename F, typename... X>
15 void fixpoint(const F& contract, const X&... x)
16 {
17 double vol = -1., prev_vol;
18
19 do
20 {
21 prev_vol = vol;
22 contract();
23 vol = 0.;
24 ((vol += [&x]() {
25 // As infinity is absorbent, this would not
26 // allow us to identify a contraction, so we
27 // exclude these cases:
28 double w = x.volume(); return w == oo ? 0. : w;
29 }()), ...);
30
31 if((x.is_empty(), ...))
32 return;
33
34 } while(prev_vol != vol);
35 }
36}