| 301 z = z_new; |
301 z = z_new; |
| 302 |
302 |
| 303 // Merge spikes. |
303 // Merge spikes. |
| 304 // This crucially expects the merge routine to be stable with respect to spike locations, |
304 // This crucially expects the merge routine to be stable with respect to spike locations, |
| 305 // and not to performing any pruning. That is be to done below simultaneously for γ. |
305 // and not to performing any pruning. That is be to done below simultaneously for γ. |
| 306 if config.insertion.merge_now(&state) { |
306 config.insertion.if_merge_now(&state, |ins| { |
| 307 let m = prox_penalty.merge_spikes( |
307 let m = prox_penalty.merge_spikes( |
| 308 &mut μ, |
308 &mut μ, |
| 309 &mut τv̆, |
309 &mut τv̆, |
| 310 &μ̆, |
310 &μ̆, |
| 311 τ, |
311 τ, |
| 312 ε, |
312 ε, |
| 313 &config.insertion, |
313 ins, |
| 314 ®, |
314 ®, |
| 315 Some(|μ̃: &RNDM<N, F>| f.apply(Pair(μ̃, &z))), |
315 Some(|μ̃: &RNDM<N, F>| f.apply(Pair(μ̃, &z))), |
| 316 ); |
316 ); |
| 317 if m > 0 { |
317 if m > 0 { |
| 318 stats.merged += m; |
318 stats.merged += m; |
| 319 } |
319 } |
| 320 } |
320 }); |
| 321 |
321 |
| 322 γ.prune_compat(&mut μ, &mut stats); |
322 γ.prune_compat(&mut μ, &mut stats); |
| 323 |
323 |
| 324 for _ in 0..config.insertion.extra_weight_optimisation_steps { |
324 for _ in 0..config.insertion.extra_weight_optimisation_steps { |
| 325 // Do extra weight optimisation step heuristic |
325 // Do extra weight optimisation step heuristic |