| 169 Domain: Space, |
169 Domain: Space, |
| 170 { |
170 { |
| 171 fn curvature_bound_components( |
171 fn curvature_bound_components( |
| 172 &self, |
172 &self, |
| 173 _guess: BoundedCurvatureGuess, |
173 _guess: BoundedCurvatureGuess, |
| 174 ) -> (DynResult<f64>, DynResult<f64>) { |
174 ) -> (DynResult<f64>, DynResult<f64>, DynResult<f64>) { |
| 175 let m = intern!(self.obj.py(), "curvature_bound_components"); |
175 let m = intern!(self.obj.py(), "curvature_bound_components"); |
| 176 match process_error::<(Option<f64>, Option<f64>)>( |
176 let (ℓ_F, ℓ_gradv_est, transport_lip): (Option<f64>, Option<f64>, Option<f64>) = |
| 177 "curvature_bound_components", |
177 process_error( |
| 178 self.obj.py(), |
178 "curvature_bound_components", |
| 179 self.obj.call_method0(m).and_then(|r| r.extract()), |
179 self.obj.py(), |
| 180 ) { |
180 self.obj.call_method0(m).and_then(|r| r.extract()), |
| 181 Ok((l, θ2)) => ( |
181 ) |
| 182 l.ok_or_else(|| anyhow!("l is None")), |
182 .unwrap(); |
| 183 θ2.ok_or_else(|| anyhow!("θ2 is None")), |
183 ( |
| 184 ), |
184 ℓ_F.ok_or_else(|| anyhow!("ℓ_F is None")), |
| 185 Err(e) => ( |
185 ℓ_gradv_est.ok_or_else(|| anyhow!("ℓ_gradv_est is None")), |
| 186 Err(anyhow!("(same error as second component)")), |
186 transport_lip.ok_or_else(|| anyhow!("transport_lip is None")), |
| 187 Err(e.into()), |
187 ) |
| 188 ), |
|
| 189 } |
|
| 190 } |
188 } |
| 191 } |
189 } |
| 192 |
190 |
| 193 impl<'py, Domain, Marker> |
191 impl<'py, Domain, Marker> |
| 194 StepLengthBound<f64, PythonMapping<'py, Domain, f64, Differentiable<Marker>>> for RadonSquared |
192 StepLengthBound<f64, PythonMapping<'py, Domain, f64, Differentiable<Marker>>> for RadonSquared |