clone dev

Wed, 30 Apr 2025 23:57:17 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Wed, 30 Apr 2025 23:57:17 -0500
branch
dev
changeset 111
e1455e48bd2b
parent 110
a1278320be26
child 112
ed8124f1af1d

clone

src/mapping/dataterm.rs file | annotate | diff | comparison | revisions
--- a/src/mapping/dataterm.rs	Wed Apr 30 16:39:01 2025 -0500
+++ b/src/mapping/dataterm.rs	Wed Apr 30 23:57:17 2025 -0500
@@ -16,19 +16,39 @@
 
 //use serde::{Deserialize, Serialize};
 
-/// Functions of the form $\frac{1}{2}\|Ax-b\|_2^2$ for an operator $A$
-/// to a [`Euclidean`] space.
+/// Functions of the form $g(Ax-b)$ for an operator $A$, data $b$, and fidelity $g$.
 pub struct DataTerm<
     F: Float,
     Domain: Space,
     A: Mapping<Domain>,
     G: Mapping<A::Codomain, Codomain = F>,
 > {
+    // The operator A
     opA: A,
+    // The data b
     b: <A as Mapping<Domain>>::Codomain,
+    // The outer fidelity
     g: G,
 }
 
+// Derive has troubles with `b`.
+impl<F, Domain, A, G> Clone for DataTerm<F, Domain, A, G>
+where
+    F: Float,
+    Domain: Space,
+    A: Mapping<Domain> + Clone,
+    <A as Mapping<Domain>>::Codomain: Clone,
+    G: Mapping<A::Codomain, Codomain = F> + Clone,
+{
+    fn clone(&self) -> Self {
+        DataTerm {
+            opA: self.opA.clone(),
+            b: self.b.clone(),
+            g: self.g.clone(),
+        }
+    }
+}
+
 #[allow(non_snake_case)]
 impl<F: Float, Domain: Space, A: Mapping<Domain>, G: Mapping<A::Codomain, Codomain = F>>
     DataTerm<F, Domain, A, G>

mercurial