diff --git a/argmin/src/core/executor.rs b/argmin/src/core/executor.rs index 184f9c970..f77ee66fe 100644 --- a/argmin/src/core/executor.rs +++ b/argmin/src/core/executor.rs @@ -152,14 +152,15 @@ where let interp = interrupt.clone(); // This is currently a hack to allow checkpoints to be run again within the // same program (usually not really a use case anyway). Unfortunately, this - // means that any subsequent run started afterwards will have not Ctrl-C + // means that any subsequent run started afterwards will not have Ctrl-C // handling available... This should also be a problem in case one tries to run // two consecutive optimizations. There is ongoing work in the ctrlc crate // (channels and such) which may solve this problem. So far, we have to live // with this. - match ctrlc::set_handler(move || { + let handler = move || { interp.store(true, Ordering::SeqCst); - }) { + }; + match ctrlc::set_handler(handler) { Err(ctrlc::Error::MultipleHandlers) => Ok(()), interp => interp, }?; diff --git a/argmin/src/core/problem.rs b/argmin/src/core/problem.rs index 763f44e39..9e1048440 100644 --- a/argmin/src/core/problem.rs +++ b/argmin/src/core/problem.rs @@ -605,7 +605,7 @@ impl Problem { /// # assert_eq!(res[0], vec![1.0f64, 1.0f64]); /// # assert_eq!(res[1], vec![1.0f64, 1.0f64]); /// ``` - pub fn bulk_apply

(&mut self, params: &Vec

) -> Result, Error> + pub fn bulk_apply

(&mut self, params: &[P]) -> Result, Error> where P: std::borrow::Borrow + SyncAlias, O::Output: SendAlias, @@ -686,7 +686,7 @@ impl Problem { /// # assert_eq!(res[0], 4.0f64); /// # assert_eq!(res[1], 4.0f64); /// ``` - pub fn bulk_cost

(&mut self, params: &Vec

) -> Result, Error> + pub fn bulk_cost

(&mut self, params: &[P]) -> Result, Error> where P: std::borrow::Borrow + SyncAlias, O::Output: SendAlias, @@ -767,7 +767,7 @@ impl Problem { /// # assert_eq!(res[0], vec![1.0f64, 1.0f64]); /// # assert_eq!(res[1], vec![1.0f64, 1.0f64]); /// ``` - pub fn bulk_gradient

(&mut self, params: &Vec

) -> Result, Error> + pub fn bulk_gradient

(&mut self, params: &[P]) -> Result, Error> where P: std::borrow::Borrow + SyncAlias, O::Gradient: SendAlias, @@ -847,7 +847,7 @@ impl Problem { /// # assert_eq!(res[0], vec![vec![1.0f64, 0.0f64], vec![0.0f64, 1.0f64]]); /// # assert_eq!(res[1], vec![vec![1.0f64, 0.0f64], vec![0.0f64, 1.0f64]]); /// ``` - pub fn bulk_hessian

(&mut self, params: &Vec

) -> Result, Error> + pub fn bulk_hessian

(&mut self, params: &[P]) -> Result, Error> where P: std::borrow::Borrow + SyncAlias, O::Hessian: SendAlias, @@ -926,7 +926,7 @@ impl Problem { /// # assert_eq!(res[0], vec![vec![1.0f64, 0.0f64], vec![0.0f64, 1.0f64]]); /// # assert_eq!(res[1], vec![vec![1.0f64, 0.0f64], vec![0.0f64, 1.0f64]]); /// ``` - pub fn bulk_jacobian

(&mut self, params: &Vec

) -> Result, Error> + pub fn bulk_jacobian

(&mut self, params: &[P]) -> Result, Error> where P: std::borrow::Borrow + SyncAlias, O::Jacobian: SendAlias,