| 64 pub pruned: usize, |
64 pub pruned: usize, |
| 65 /// Number of inner iterations since last IterInfo statistic |
65 /// Number of inner iterations since last IterInfo statistic |
| 66 pub inner_iters: usize, |
66 pub inner_iters: usize, |
| 67 /// Transport statistis |
67 /// Transport statistis |
| 68 pub transport: Option<TransportInfo<F>>, |
68 pub transport: Option<TransportInfo<F>>, |
| |
69 /// Measure component discrepancy |
| |
70 pub discrepancy: Option<F>, |
| |
71 /// Auxiliary parameter discrepancy |
| |
72 pub aux_discrepancy: Option<F>, |
| |
73 /// Discrepancy of both components |
| |
74 pub joint_discrepancy: Option<F>, |
| 69 /// Current tolerance |
75 /// Current tolerance |
| 70 pub ε: F, |
76 pub ε: F, |
| 71 // /// Solve fin.dim problem for this measure to get the optimal `value`. |
77 // /// Solve fin.dim problem for this measure to get the optimal `value`. |
| 72 // pub postprocessing : Option<RNDM<N, F>>, |
78 // pub postprocessing : Option<RNDM<N, F>>, |
| |
79 /// Norm of the measure |
| |
80 pub μ_norm: F, |
| 73 } |
81 } |
| 74 |
82 |
| 75 impl<F: Float> IterInfo<F> { |
83 impl<F: Float> IterInfo<F> { |
| 76 /// Initialise statistics with zeros. `ε` and `value` are unspecified. |
84 /// Initialise statistics with zeros. `ε` and `value` are unspecified. |
| 77 pub fn new() -> Self { |
85 pub fn new() -> Self { |
| 84 pruned: 0, |
92 pruned: 0, |
| 85 inner_iters: 0, |
93 inner_iters: 0, |
| 86 ε: F::NAN, |
94 ε: F::NAN, |
| 87 // postprocessing : None, |
95 // postprocessing : None, |
| 88 transport: None, |
96 transport: None, |
| |
97 discrepancy: None, |
| |
98 aux_discrepancy: None, |
| |
99 joint_discrepancy: None, |
| |
100 μ_norm: F::ZERO, |
| 89 } |
101 } |
| 90 } |
102 } |
| 91 |
103 |
| 92 /// Get mutable reference to transport statistics, creating it if it is `None`. |
104 /// Get mutable reference to transport statistics, creating it if it is `None`. |
| 93 pub fn get_transport_mut(&mut self) -> &mut TransportInfo<F> { |
105 pub fn get_transport_mut(&mut self) -> &mut TransportInfo<F> { |
| 103 where |
115 where |
| 104 F: LogRepr + Float, |
116 F: LogRepr + Float, |
| 105 { |
117 { |
| 106 fn logrepr(&self) -> ColoredString { |
118 fn logrepr(&self) -> ColoredString { |
| 107 format!( |
119 format!( |
| 108 "{}\t| N = {}, ε = {:.2e}, 𝔼inner_it = {}, 𝔼ins/mer/pru = {}/{}/{}{}", |
120 "\t{:.10}{}| N = {}, ε = {:.2e}, 𝔼inner_it = {}, 𝔼ins/mer/pru = {}/{}/{}{}", |
| 109 self.value.logrepr(), |
121 self.value.logrepr(), |
| |
122 match &self.joint_discrepancy { |
| |
123 Some(d) => format!(" ∂_joint={:.10}", d), |
| |
124 None => match &self.discrepancy { |
| |
125 None => format!(""), |
| |
126 Some(d) => format!(" ∂={:.10}", d), |
| |
127 }, |
| |
128 }, |
| 110 self.n_spikes, |
129 self.n_spikes, |
| 111 self.ε, |
130 self.ε, |
| 112 self.inner_iters as float / self.this_iters.max(1) as float, |
131 self.inner_iters as float / self.this_iters.max(1) as float, |
| 113 self.inserted as float / self.this_iters.max(1) as float, |
132 self.inserted as float / self.this_iters.max(1) as float, |
| 114 self.merged as float / self.this_iters.max(1) as float, |
133 self.merged as float / self.this_iters.max(1) as float, |