src/forward_model.rs

branch
dev
changeset 34
efa60bc4f743
parent 32
56c8adc32b09
child 35
b087e3eab191
equal deleted inserted replaced
33:aec67cdd6b14 34:efa60bc4f743
21 use alg_tools::lingrid::*; 21 use alg_tools::lingrid::*;
22 use alg_tools::iter::{MapX, Mappable}; 22 use alg_tools::iter::{MapX, Mappable};
23 use alg_tools::nalgebra_support::ToNalgebraRealField; 23 use alg_tools::nalgebra_support::ToNalgebraRealField;
24 use alg_tools::tabledump::write_csv; 24 use alg_tools::tabledump::write_csv;
25 use alg_tools::error::DynError; 25 use alg_tools::error::DynError;
26 use alg_tools::maputil::map2;
26 27
27 use crate::types::*; 28 use crate::types::*;
28 use crate::measures::*; 29 use crate::measures::*;
29 use crate::seminorms::{ 30 use crate::seminorms::{
30 ConvolutionOp, 31 ConvolutionOp,
592 } 593 }
593 594
594 #[replace_float_literals(F::cast_from(literal))] 595 #[replace_float_literals(F::cast_from(literal))]
595 impl<F, BT, S, P, const N : usize> TransportLipschitz<L2Squared> 596 impl<F, BT, S, P, const N : usize> TransportLipschitz<L2Squared>
596 for SensorGrid<F, S, P, BT, N> 597 for SensorGrid<F, S, P, BT, N>
597 where F : Float + nalgebra::RealField + ToNalgebraRealField, 598 where F : Float + ToNalgebraRealField,
598 BT : SensorGridBT<F, S, P, N>, 599 BT : SensorGridBT<F, S, P, N>,
599 S : Sensor<F, N>, 600 S : Sensor<F, N>,
600 P : Spread<F, N>, 601 P : Spread<F, N>,
601 Convolution<S, P> : Spread<F, N> + Lipschitz<L2> { 602 Convolution<S, P> : Spread<F, N> + Lipschitz<L2, FloatType = F> {
602 type FloatType = F; 603 type FloatType = F;
603 604
604 fn transport_lipschitz_factor(&self, L2Squared : L2Squared) -> Self::FloatType { 605 fn transport_lipschitz_factor(&self, L2Squared : L2Squared) -> Self::FloatType {
605 todo!("Unimplemented") 606 // We estimate the factor by N_ψL^2, where L is the 2-norm Lipschitz factor of
607 // the base sensor (sensor * base_spread), and N_ψ the maximum overlap.
608 let l = self.base_sensor.lipschitz_factor(L2).unwrap();
609 let w = self.base_sensor.support_hint().width();
610 let d = map2(self.domain.width(), &self.sensor_count, |wi, &i| wi/F::cast_from(i));
611 let n = w.iter()
612 .zip(d.iter())
613 .map(|(&wi, &di)| (wi/di).ceil())
614 .reduce(F::mul)
615 .unwrap();
616 2.0 * n * l.powi(2)
606 } 617 }
607 } 618 }
608 619
609 620
610 macro_rules! make_sensorgridsupportgenerator_scalarop_rhs { 621 macro_rules! make_sensorgridsupportgenerator_scalarop_rhs {

mercurial