diff -r c5d8bd1a7728 -r 0f59c0d02e13 src/run.rs --- a/src/run.rs Thu Jan 23 23:35:28 2025 +0100 +++ b/src/run.rs Mon Jan 06 21:37:03 2025 -0500 @@ -327,7 +327,7 @@ // } /// Plotting level configuration -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Serialize, ValueEnum, Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize, ValueEnum, Debug)] pub enum PlotLevel { /// Plot nothing #[clap(name = "none")] @@ -357,7 +357,7 @@ >; /// This is a dirty workaround to rust-csv not supporting struct flattening etc. -#[derive(Serialize)] +#[derive(Serialize, Deserialize)] struct CSVLog { iter : usize, cpu_time : f64, @@ -372,7 +372,7 @@ } /// Collected experiment statistics -#[derive(Clone, Debug, Serialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] struct ExperimentStats { /// Signal-to-noise ratio in decibels ssnr : F, @@ -398,7 +398,7 @@ } } /// Collected algorithm statistics -#[derive(Clone, Debug, Serialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] struct AlgorithmStats { /// Overall CPU time spent cpu_time : F, @@ -416,10 +416,29 @@ /// Struct for experiment configurations -#[derive(Debug, Clone, Serialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(bound( + serialize = "Cube : Serialize, + NoiseDistr : Serialize, + [usize; N] : Serialize, + RNDM : Serialize, + Regularisation : Serialize, + F : Serialize, + S : Serialize, + P : Serialize, + K : Serialize", + deserialize = "Cube : for<'a> Deserialize<'a>, + NoiseDistr : for<'a> Deserialize<'a>, + [usize; N] : for<'a> Deserialize<'a>, + RNDM : for<'a> Deserialize<'a>, + Regularisation : for<'a> Deserialize<'a>, + F : for<'a> Deserialize<'a>, + S : for<'a> Deserialize<'a>, + P : for<'a> Deserialize<'a>, + K : for<'a> Deserialize<'a>,", +))] pub struct ExperimentV2 where F : Float, - [usize; N] : Serialize, NoiseDistr : Distribution, S : Sensor, P : Spread, @@ -452,7 +471,15 @@ pub algorithm_defaults : HashMap>, } -#[derive(Debug, Clone, Serialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(bound( + serialize = "ExperimentV2 : Serialize, + B : Serialize, + F : Serialize", + deserialize = "ExperimentV2: for<'a> Deserialize<'a>, + B : for<'a> Deserialize<'a>, + F : for<'a> Deserialize<'a>", +))] pub struct ExperimentBiased where F : Float, [usize; N] : Serialize, @@ -541,6 +568,7 @@ ) -> DynError where PlotLookup : Plotting, + DeltaMeasure, F> : Serialize, { let mut logs = Vec::new(); @@ -647,6 +675,8 @@ BTNodeLookup: BTNode, N>, RNDM : SpikeMerging, NoiseDistr : Distribution + Serialize + std::fmt::Debug, + [F; N] : Serialize, + [[F; 2]; N] : Serialize, // DefaultSG : ForwardModel, F, PreadjointCodomain = PreadjointCodomain, Observable=DVector>, // PreadjointCodomain : Space + Bounded + DifferentiableRealMapping, // DefaultSeminormOp : ProxPenalty, N>, @@ -912,6 +942,8 @@ RNDM : SpikeMerging, NoiseDistr : Distribution + Serialize + std::fmt::Debug, B : Mapping, Codomain = F> + Serialize + std::fmt::Debug, + [F; N] : Serialize, + [[F; 2]; N] : Serialize, // DefaultSG : ForwardModel, F, PreadjointCodomain = PreadjointCodomain, Observable=DVector>, // PreadjointCodomain : Bounded + DifferentiableRealMapping, // DefaultSeminormOp : ProxPenalty, N>, @@ -1169,18 +1201,21 @@ b : &A::Observable, kernel_plot_width : F, ) -> DynError -where F : Float + ToNalgebraRealField, - Sensor : RealMapping + Support + Clone, - Spread : RealMapping + Support + Clone, - Kernel : RealMapping + Support, - Convolution : DifferentiableRealMapping + Support, - 𝒟 : DiscreteMeasureOp, F>, - 𝒟::Codomain : RealMapping, - A : ForwardModel, F>, - for<'a> &'a A::Observable : Instance, - A::PreadjointCodomain : DifferentiableRealMapping + Bounded, - PlotLookup : Plotting, - Cube : SetOrd { +where + F : Float + ToNalgebraRealField, + Sensor : RealMapping + Support + Clone, + Spread : RealMapping + Support + Clone, + Kernel : RealMapping + Support, + Convolution : DifferentiableRealMapping + Support, + 𝒟 : DiscreteMeasureOp, F>, + 𝒟::Codomain : RealMapping, + A : ForwardModel, F>, + for<'a> &'a A::Observable : Instance, + A::PreadjointCodomain : DifferentiableRealMapping + Bounded, + PlotLookup : Plotting, + Cube : SetOrd, + DeltaMeasure, F> : Serialize, +{ if cli.plot < PlotLevel::Data { return Ok(())