src/mapping/dataterm.rs

branch
dev
changeset 111
e1455e48bd2b
parent 110
a1278320be26
child 124
6aa955ad8122
equal deleted inserted replaced
110:a1278320be26 111:e1455e48bd2b
14 use crate::types::Float; 14 use crate::types::Float;
15 use std::ops::Sub; 15 use std::ops::Sub;
16 16
17 //use serde::{Deserialize, Serialize}; 17 //use serde::{Deserialize, Serialize};
18 18
19 /// Functions of the form $\frac{1}{2}\|Ax-b\|_2^2$ for an operator $A$ 19 /// Functions of the form $g(Ax-b)$ for an operator $A$, data $b$, and fidelity $g$.
20 /// to a [`Euclidean`] space.
21 pub struct DataTerm< 20 pub struct DataTerm<
22 F: Float, 21 F: Float,
23 Domain: Space, 22 Domain: Space,
24 A: Mapping<Domain>, 23 A: Mapping<Domain>,
25 G: Mapping<A::Codomain, Codomain = F>, 24 G: Mapping<A::Codomain, Codomain = F>,
26 > { 25 > {
26 // The operator A
27 opA: A, 27 opA: A,
28 // The data b
28 b: <A as Mapping<Domain>>::Codomain, 29 b: <A as Mapping<Domain>>::Codomain,
30 // The outer fidelity
29 g: G, 31 g: G,
32 }
33
34 // Derive has troubles with `b`.
35 impl<F, Domain, A, G> Clone for DataTerm<F, Domain, A, G>
36 where
37 F: Float,
38 Domain: Space,
39 A: Mapping<Domain> + Clone,
40 <A as Mapping<Domain>>::Codomain: Clone,
41 G: Mapping<A::Codomain, Codomain = F> + Clone,
42 {
43 fn clone(&self) -> Self {
44 DataTerm {
45 opA: self.opA.clone(),
46 b: self.b.clone(),
47 g: self.g.clone(),
48 }
49 }
30 } 50 }
31 51
32 #[allow(non_snake_case)] 52 #[allow(non_snake_case)]
33 impl<F: Float, Domain: Space, A: Mapping<Domain>, G: Mapping<A::Codomain, Codomain = F>> 53 impl<F: Float, Domain: Space, A: Mapping<Domain>, G: Mapping<A::Codomain, Codomain = F>>
34 DataTerm<F, Domain, A, G> 54 DataTerm<F, Domain, A, G>

mercurial