10 use itertools::izip; |
10 use itertools::izip; |
11 use colorbrewer::Palette as CbPalette; |
11 use colorbrewer::Palette as CbPalette; |
12 |
12 |
13 use alg_tools::types::*; |
13 use alg_tools::types::*; |
14 use alg_tools::lingrid::LinGrid; |
14 use alg_tools::lingrid::LinGrid; |
15 use alg_tools::mapping::RealMapping; |
15 use alg_tools::mapping::{ |
|
16 RealMapping, |
|
17 DifferentiableRealMapping, |
|
18 SliceCodomain |
|
19 }; |
16 use alg_tools::loc::Loc; |
20 use alg_tools::loc::Loc; |
17 use alg_tools::bisection_tree::Bounds; |
21 use alg_tools::bisection_tree::Bounds; |
18 use alg_tools::maputil::map4; |
22 use alg_tools::maputil::map4; |
19 use alg_tools::tabledump::write_csv; |
23 use alg_tools::tabledump::write_csv; |
20 use crate::measures::*; |
24 use crate::measures::*; |
50 g : &T1, |
54 g : &T1, |
51 grid : LinGrid<F, N>, |
55 grid : LinGrid<F, N>, |
52 filename : String, |
56 filename : String, |
53 explanation : String |
57 explanation : String |
54 ); |
58 ); |
|
59 |
|
60 /// Plot a differentiable mapping into several file, sampling values on a given grid. |
|
61 fn plot_into_file_diff< |
|
62 F : Float, |
|
63 T1 : DifferentiableRealMapping<F, N>, |
|
64 > ( |
|
65 g : &T1, |
|
66 grid : LinGrid<F, N>, |
|
67 base_filename : String, |
|
68 explanation : String |
|
69 ) { |
|
70 Self::plot_into_file(g, grid, base_filename.clone(), explanation.clone()); |
|
71 let d = g.diff_ref(); |
|
72 for i in 0..N { |
|
73 Self::plot_into_file(&d.slice_codomain_ref(i), |
|
74 grid, |
|
75 format!("{base_filename}_diff{i}"), |
|
76 format!("{explanation} differential, dimension {i}")); |
|
77 } |
|
78 } |
55 } |
79 } |
56 |
80 |
57 /// Helper type for looking up a [`Plotting`] based on dimension. |
81 /// Helper type for looking up a [`Plotting`] based on dimension. |
58 pub struct PlotLookup; |
82 pub struct PlotLookup; |
59 |
83 |