--- a/src/plot.rs Tue Aug 01 10:32:12 2023 +0300 +++ b/src/plot.rs Thu Aug 29 00:00:00 2024 -0500 @@ -12,7 +12,11 @@ use alg_tools::types::*; use alg_tools::lingrid::LinGrid; -use alg_tools::mapping::RealMapping; +use alg_tools::mapping::{ + RealMapping, + DifferentiableRealMapping, + SliceCodomain +}; use alg_tools::loc::Loc; use alg_tools::bisection_tree::Bounds; use alg_tools::maputil::map4; @@ -52,6 +56,26 @@ filename : String, explanation : String ); + + /// Plot a differentiable mapping into several file, sampling values on a given grid. + fn plot_into_file_diff< + F : Float, + T1 : DifferentiableRealMapping<F, N>, + > ( + g : &T1, + grid : LinGrid<F, N>, + base_filename : String, + explanation : String + ) { + Self::plot_into_file(g, grid, base_filename.clone(), explanation.clone()); + let d = g.diff_ref(); + for i in 0..N { + Self::plot_into_file(&d.slice_codomain_ref(i), + grid, + format!("{base_filename}_diff{i}"), + format!("{explanation} differential, dimension {i}")); + } + } } /// Helper type for looking up a [`Plotting`] based on dimension.