1 |
1 |
2 /*! |
2 /*! |
3 Traits for representing the support of a [`Mapping`], and analysing the mapping on a [`Cube`]. |
3 Traits for representing the support of a [`Mapping`], and analysing the mapping on a [`Cube`]. |
4 */ |
4 */ |
5 use serde::Serialize; |
5 use serde::{Serialize, Deserialize}; |
6 use std::ops::{MulAssign,DivAssign,Neg}; |
6 use std::ops::{MulAssign,DivAssign,Neg}; |
7 use crate::types::{Float, Num}; |
7 use crate::types::{Float, Num}; |
8 use crate::maputil::map2; |
8 use crate::maputil::map2; |
9 use crate::mapping::{ |
9 use crate::mapping::{ |
10 Instance, Mapping, DifferentiableImpl, DifferentiableMapping, Space |
10 Instance, Mapping, DifferentiableImpl, DifferentiableMapping, Space |
101 } |
101 } |
102 |
102 |
103 impl<F : Float, T : GlobalAnalysis<F, Bounds<F>>> Bounded<F> for T { } |
103 impl<F : Float, T : GlobalAnalysis<F, Bounds<F>>> Bounded<F> for T { } |
104 |
104 |
105 /// Shift of [`Support`] and [`Mapping`]; output of [`Support::shift`]. |
105 /// Shift of [`Support`] and [`Mapping`]; output of [`Support::shift`]. |
106 #[derive(Copy,Clone,Debug,Serialize)] // Serialize! but not implemented by Loc. |
106 #[derive(Copy,Clone,Debug,Serialize,Deserialize)] |
|
107 #[serde(bound( |
|
108 serialize = "Loc<F, N> : Serialize, |
|
109 T : Serialize,", |
|
110 deserialize = "Loc<F, N> : for<'a> Deserialize<'a>, |
|
111 T : for<'a> Deserialize<'a>", |
|
112 ))] |
107 pub struct Shift<T, F, const N : usize> { |
113 pub struct Shift<T, F, const N : usize> { |
108 shift : Loc<F, N>, |
114 shift : Loc<F, N>, |
109 base_fn : T, |
115 base_fn : T, |
110 } |
116 } |
111 |
117 |