diff -r 1f1b946fc656 -r 794833f18a05 src/mapping/dataterm.rs --- a/src/mapping/dataterm.rs Fri Nov 28 13:28:17 2025 -0500 +++ b/src/mapping/dataterm.rs Fri Nov 28 14:01:14 2025 -0500 @@ -64,6 +64,16 @@ pub fn fidelity(&self) -> &'_ G { &self.g } + + /// Returns the residual $Ax-b$. + pub fn residual<'a, 'b>(&'b self, x: &'a Domain) -> >::Codomain + where + &'a Domain: Instance, + >::Codomain: + Sub<&'b >::Codomain, Output = >::Codomain>, + { + self.opA.apply(x) - &self.b + } } //+ AdjointProductBoundedBy, P, FloatType = F>,