src/sliding_pdps.rs

changeset 83
66b8ac0ebe00
parent 81
642141008293
child 84
edb5de5d5bd6
equal deleted inserted replaced
82:afb3ce40cff6 83:66b8ac0ebe00
65 type MeasureZ<F, Z, const N: usize> = Pair<RNDM<N, F>, Z>; 65 type MeasureZ<F, Z, const N: usize> = Pair<RNDM<N, F>, Z>;
66 66
67 /// Iteratively solve the pointsource localisation with an additional variable 67 /// Iteratively solve the pointsource localisation with an additional variable
68 /// using sliding primal-dual proximal splitting 68 /// using sliding primal-dual proximal splitting
69 /// 69 ///
70 /// The parametrisation is as for [`crate::forward_pdps::pointsource_forward_pdps_pair`]. 70 /// The parametrisation is as for [`crate::forward_pdps::pointsource_forward_pdps_pair`],
71 /// except an additional domain restriction may be given.
71 #[replace_float_literals(F::cast_from(literal))] 72 #[replace_float_literals(F::cast_from(literal))]
72 pub fn pointsource_sliding_pdps_pair< 73 pub fn pointsource_sliding_pdps_pair_dom<
73 F, 74 F,
74 I, 75 I,
75 S, 76 S,
76 Dat, 77 Dat,
77 Reg, 78 Reg,
93 (μ0, mut z, mut y): (Option<RNDM<N, F>>, Z, Y), 94 (μ0, mut z, mut y): (Option<RNDM<N, F>>, Z, Y),
94 //opKμ : KOpM, 95 //opKμ : KOpM,
95 opKz: &KOpZ, 96 opKz: &KOpZ,
96 fnR: &R, 97 fnR: &R,
97 fnH: &H, 98 fnH: &H,
99 domain: Option<&P::Dom>,
98 ) -> DynResult<MeasureZ<F, Z, N>> 100 ) -> DynResult<MeasureZ<F, Z, N>>
99 where 101 where
100 F: Float + ToNalgebraRealField, 102 F: Float + ToNalgebraRealField,
101 I: AlgIteratorFactory<IterInfo<F>>, 103 I: AlgIteratorFactory<IterInfo<F>>,
102 Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>> 104 Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>>
234 ε, 236 ε,
235 τ, 237 τ,
236 &mut τθ_or_adaptive, 238 &mut τθ_or_adaptive,
237 &v, 239 &v,
238 &config.transport, 240 &config.transport,
241 domain,
239 ); 242 );
240 243
241 let mut attempts = 0; 244 let mut attempts = 0;
242 245
243 // Solve finite-dimensional subproblem several times until the dual variable for the 246 // Solve finite-dimensional subproblem several times until the dual variable for the
379 /// Iteratively solve the pointsource localisation with an additional variable 382 /// Iteratively solve the pointsource localisation with an additional variable
380 /// using sliding forward-backward splitting. 383 /// using sliding forward-backward splitting.
381 /// 384 ///
382 /// The implementation uses [`pointsource_sliding_pdps_pair`] with appropriate dummy 385 /// The implementation uses [`pointsource_sliding_pdps_pair`] with appropriate dummy
383 /// variables, operators, and functions. 386 /// variables, operators, and functions.
387 #[replace_float_literals(F::cast_from(literal))]
388 pub fn pointsource_sliding_fb_pair_dom<F, I, S, Dat, Reg, P, Z, R, Plot, const N: usize>(
389 f: &Dat,
390 reg: &Reg,
391 prox_penalty: &P,
392 config: &SlidingFBConfig<F>,
393 iterator: I,
394 plotter: Plot,
395 (μ0, z): (Option<RNDM<N, F>>, Z),
396 //opKμ : KOpM,
397 fnR: &R,
398 domain: Option<&P::Dom>
399 ) -> DynResult<MeasureZ<F, Z, N>>
400 where
401 F: Float + ToNalgebraRealField,
402 I: AlgIteratorFactory<IterInfo<F>>,
403 Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>>
404 + BoundedCurvature<F>,
405 S: DifferentiableRealMapping<N, F> + ClosedMul<F> + MinMaxMapping<Loc<N, F>, F>,
406 RNDM<N, F>: SpikeMerging<F>,
407 Reg: SlidingRegTerm<Loc<N, F>, F>,
408 P: TransportProxPenalty<Loc<N, F>, S, Reg, F>,
409 for<'a> Pair<&'a P, &'a IdOp<Z>>: StepLengthBoundPair<F, Dat>,
410 Z: ClosedEuclidean<F> + AXPY + Clone,
411 for<'b> &'b Z: Instance<Z>,
412 R: Prox<Z, Codomain = F>,
413 Plot: Plotter<P::ReturnMapping, S, RNDM<N, F>>,
414 // We should not need to explicitly require this:
415 for<'b> &'b Loc<0, F>: Instance<Loc<0, F>>,
416 // Loc<0, F>: StaticEuclidean<Field = F, PrincipalE = Loc<0, F>>
417 // + Instance<Loc<0, F>>
418 // + VectorSpace<Field = F>,
419 {
420 let opKz: ZeroOp<Z, Loc<0, F>, _, _, F> =
421 ZeroOp::new_dualisable(StaticEuclideanOriginGenerator, z.dual_origin());
422 let fnH = Zero::new();
423 // Convert config. We don't implement From (that could be done with the o2o crate), as σd0
424 // needs to be chosen in a general case; for the problem of this fucntion, anything is valid.
425 let &SlidingFBConfig { τ0, σp0, insertion, transport, guess } = config;
426 let pdps_config = SlidingPDPSConfig { τ0, σp0, insertion, transport, guess, σd0: 0.0 };
427
428 pointsource_sliding_pdps_pair_dom(
429 f,
430 reg,
431 prox_penalty,
432 &pdps_config,
433 iterator,
434 plotter,
435 (μ0, z, Loc([])),
436 &opKz,
437 fnR,
438 &fnH,
439 domain
440 )
441 }
442
443
444 #[deprecated]
445 /// Version of [`pointsource_sliding_pdps_pair`] without domain specification.
446 #[replace_float_literals(F::cast_from(literal))]
447 pub fn pointsource_sliding_pdps_pair<
448 F,
449 I,
450 S,
451 Dat,
452 Reg,
453 P,
454 Z,
455 R,
456 Y,
457 Plot,
458 /*KOpM, */ KOpZ,
459 H,
460 const N: usize,
461 >(
462 f: &Dat,
463 reg: &Reg,
464 prox_penalty: &P,
465 config: &SlidingPDPSConfig<F>,
466 iterator: I,
467 plotter: Plot,
468 init: (Option<RNDM<N, F>>, Z, Y),
469 //opKμ : KOpM,
470 opKz: &KOpZ,
471 fnR: &R,
472 fnH: &H,
473 ) -> DynResult<MeasureZ<F, Z, N>>
474 where
475 F: Float + ToNalgebraRealField,
476 I: AlgIteratorFactory<IterInfo<F>>,
477 Dat: DifferentiableMapping<MeasureZ<F, Z, N>, Codomain = F, DerivativeDomain = Pair<S, Z>>
478 + BoundedCurvature<F>,
479 S: DifferentiableRealMapping<N, F> + ClosedMul<F> + MinMaxMapping<Loc<N, F>, F>,
480 for<'a> Pair<&'a P, &'a IdOp<Z>>: StepLengthBoundPair<F, Dat>,
481 //Pair<S, Z>: ClosedMul<F>,
482 RNDM<N, F>: SpikeMerging<F>,
483 Reg: SlidingRegTerm<Loc<N, F>, F>,
484 P: TransportProxPenalty<Loc<N, F>, S, Reg, F>,
485 // KOpM : Linear<RNDM<N, F>, Codomain=Y>
486 // + GEMV<F, RNDM<N, F>>
487 // + Preadjointable<
488 // RNDM<N, F>, Y,
489 // PreadjointCodomain = S,
490 // >
491 // + TransportLipschitz<L2Squared, FloatType=F>
492 // + AdjointProductBoundedBy<RNDM<N, F>, 𝒟, FloatType=F>,
493 // for<'b> KOpM::Preadjoint<'b> : GEMV<F, Y>,
494 // Since Z is Hilbert, we may just as well use adjoints for K_z.
495 KOpZ: BoundedLinear<Z, L2, L2, F, Codomain = Y>
496 + GEMV<F, Z>
497 + SimplyAdjointable<Z, Y, AdjointCodomain = Z>,
498 KOpZ::SimpleAdjoint: GEMV<F, Y>,
499 Y: ClosedEuclidean<F>,
500 for<'b> &'b Y: Instance<Y>,
501 Z: ClosedEuclidean<F> + AXPY,
502 for<'b> &'b Z: Instance<Z>,
503 R: Prox<Z, Codomain = F>,
504 H: Conjugable<Y, F, Codomain = F>,
505 for<'b> H::Conjugate<'b>: Prox<Y>,
506 Plot: Plotter<P::ReturnMapping, S, RNDM<N, F>>,
507 {
508 pointsource_sliding_pdps_pair_dom(
509 f,
510 reg,
511 prox_penalty,
512 config,
513 iterator,
514 plotter,
515 init,
516 opKz,
517 fnR,
518 fnH,
519 None,
520 )
521 }
522
523 #[deprecated]
524 /// Version of [`pointsource_sliding_fb_pair_dom`] without domain specification
384 #[replace_float_literals(F::cast_from(literal))] 525 #[replace_float_literals(F::cast_from(literal))]
385 pub fn pointsource_sliding_fb_pair<F, I, S, Dat, Reg, P, Z, R, Plot, const N: usize>( 526 pub fn pointsource_sliding_fb_pair<F, I, S, Dat, Reg, P, Z, R, Plot, const N: usize>(
386 f: &Dat, 527 f: &Dat,
387 reg: &Reg, 528 reg: &Reg,
388 prox_penalty: &P, 529 prox_penalty: &P,
419 // Convert config. We don't implement From (that could be done with the o2o crate), as σd0 560 // Convert config. We don't implement From (that could be done with the o2o crate), as σd0
420 // needs to be chosen in a general case; for the problem of this fucntion, anything is valid. 561 // needs to be chosen in a general case; for the problem of this fucntion, anything is valid.
421 let &SlidingFBConfig { τ0, σp0, insertion, transport, guess } = config; 562 let &SlidingFBConfig { τ0, σp0, insertion, transport, guess } = config;
422 let pdps_config = SlidingPDPSConfig { τ0, σp0, insertion, transport, guess, σd0: 0.0 }; 563 let pdps_config = SlidingPDPSConfig { τ0, σp0, insertion, transport, guess, σd0: 0.0 };
423 564
424 pointsource_sliding_pdps_pair( 565 pointsource_sliding_pdps_pair_dom(
425 f, 566 f,
426 reg, 567 reg,
427 prox_penalty, 568 prox_penalty,
428 &pdps_config, 569 &pdps_config,
429 iterator, 570 iterator,
430 plotter, 571 plotter,
431 (μ0, z, Loc([])), 572 (μ0, z, Loc([])),
432 &opKz, 573 &opKz,
433 fnR, 574 fnR,
434 &fnH, 575 &fnH,
576 None
435 ) 577 )
436 } 578 }

mercurial