pub struct TestProblem {}Expand description
Pseudo problem useful for testing
Implements CostFunction, Operator, Gradient, Jacobian, Hessian, and
[Anneal].
Implementations§
Trait Implementations§
Source§impl Clone for TestProblem
impl Clone for TestProblem
impl Copy for TestProblem
Source§impl CostFunction for TestProblem
impl CostFunction for TestProblem
Source§fn cost(&self, _p: &Self::Param) -> Result<Self::Output, Error>
fn cost(&self, _p: &Self::Param) -> Result<Self::Output, Error>
Returns 1.0f64.
§Example
use argmin::core::test_utils::TestProblem;
use argmin::core::CostFunction;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.cost(¶m)?;Source§fn bulk_cost<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
fn bulk_cost<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
Compute
cost in bulk. If the rayon feature is enabled, multiple calls to cost will be run in parallel using rayon, otherwise they will execute sequentially. If the rayon feature is enabled, parallelization can still be turned off by overwriting parallelize to return false. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize is set to false, the parameter vectors and the problem are still required to be Send and Sync. Those bounds are linked to the rayon feature. This method can be overwritten.Source§fn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to
cost when using bulk_cost. By default returns true, but can be set manually to false if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon feature to be enabled, otherwise calls to cost will be executed sequentially independent of how parallelize is set.Source§impl Debug for TestProblem
impl Debug for TestProblem
Source§impl Default for TestProblem
impl Default for TestProblem
impl Eq for TestProblem
Source§impl Gradient for TestProblem
impl Gradient for TestProblem
Source§fn gradient(&self, p: &Self::Param) -> Result<Self::Param, Error>
fn gradient(&self, p: &Self::Param) -> Result<Self::Param, Error>
Returns a clone of parameter p.
§Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Gradient;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.gradient(¶m)?;Source§fn bulk_gradient<P>(&self, params: &[P]) -> Result<Vec<Self::Gradient>, Error>
fn bulk_gradient<P>(&self, params: &[P]) -> Result<Vec<Self::Gradient>, Error>
Compute
gradient in bulk. If the rayon feature is enabled, multiple calls to gradient will be run in parallel using rayon, otherwise they will execute sequentially. If the rayon feature is enabled, parallelization can still be turned off by overwriting parallelize to return false. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize is set to false, the parameter vectors and the problem are still required to be Send and Sync. Those bounds are linked to the rayon feature. This method can be overwritten.Source§fn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to
gradient when using bulk_gradient. By default returns true, but can be set manually to false if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon feature to be enabled, otherwise calls to gradient will be executed sequentially independent of how parallelize is set.Source§impl Hash for TestProblem
impl Hash for TestProblem
Source§impl Hessian for TestProblem
impl Hessian for TestProblem
Source§fn hessian(&self, p: &Self::Param) -> Result<Self::Hessian, Error>
fn hessian(&self, p: &Self::Param) -> Result<Self::Hessian, Error>
Returns vec![p, p].
§Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Hessian;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.hessian(¶m)?;Source§fn bulk_hessian<P>(&self, params: &[P]) -> Result<Vec<Self::Hessian>, Error>
fn bulk_hessian<P>(&self, params: &[P]) -> Result<Vec<Self::Hessian>, Error>
Compute
hessian in bulk. If the rayon feature is enabled, multiple calls to hessian will be run in parallel using rayon, otherwise they will execute sequentially. If the rayon feature is enabled, parallelization can still be turned off by overwriting parallelize to return false. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize is set to false, the parameter vectors and the problem are still required to be Send and Sync. Those bounds are linked to the rayon feature. This method can be overwritten.Source§fn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to
hessian when using bulk_hessian. By default returns true, but can be set manually to false if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon feature to be enabled, otherwise calls to hessian will be executed sequentially independent of how parallelize is set.Source§impl Jacobian for TestProblem
impl Jacobian for TestProblem
Source§fn jacobian(&self, p: &Self::Param) -> Result<Self::Jacobian, Error>
fn jacobian(&self, p: &Self::Param) -> Result<Self::Jacobian, Error>
Returns vec![p, p].
§Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Jacobian;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.jacobian(¶m)?;Source§fn bulk_jacobian<P>(&self, params: &[P]) -> Result<Vec<Self::Jacobian>, Error>
fn bulk_jacobian<P>(&self, params: &[P]) -> Result<Vec<Self::Jacobian>, Error>
Compute
jacobian in bulk. If the rayon feature is enabled, multiple calls to jacobian will be run in parallel using rayon, otherwise they will execute sequentially. If the rayon feature is enabled, parallelization can still be turned off by overwriting parallelize to return false. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize is set to false, the parameter vectors and the problem are still required to be Send and Sync. Those bounds are linked to the rayon feature. This method can be overwritten.Source§fn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to
jacobian when using bulk_jacobian. By default returns true, but can be set manually to false if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon feature to be enabled, otherwise calls to jacobian will be executed sequentially independent of how parallelize is set.Source§impl Operator for TestProblem
impl Operator for TestProblem
Source§fn apply(&self, p: &Self::Param) -> Result<Self::Output, Error>
fn apply(&self, p: &Self::Param) -> Result<Self::Output, Error>
Returns a clone of parameter p.
§Example
use argmin::core::test_utils::TestProblem;
use argmin::core::Operator;
let problem = TestProblem::new();
let param = vec![1.0, 2.0];
let res = problem.apply(¶m)?;Source§fn bulk_apply<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
fn bulk_apply<P>(&self, params: &[P]) -> Result<Vec<Self::Output>, Error>
Compute
apply in bulk. If the rayon feature is enabled, multiple calls to apply will be run in parallel using rayon, otherwise they will execute sequentially. If the rayon feature is enabled, parallelization can still be turned off by overwriting parallelize to return false. This can be useful in cases where it is preferable to parallelize only certain parts. Note that even if parallelize is set to false, the parameter vectors and the problem are still required to be Send and Sync. Those bounds are linked to the rayon feature. This method can be overwritten.Source§fn parallelize(&self) -> bool
fn parallelize(&self) -> bool
Indicates whether to parallelize calls to
apply when using bulk_apply. By default returns true, but can be set manually to false if needed. This allows users to turn off parallelization for certain traits implemented on their problem. Note that parallelization requires the rayon feature to be enabled, otherwise calls to apply will be executed sequentially independent of how parallelize is set.Source§impl PartialEq for TestProblem
impl PartialEq for TestProblem
impl StructuralPartialEq for TestProblem
Auto Trait Implementations§
impl Freeze for TestProblem
impl RefUnwindSafe for TestProblem
impl Send for TestProblem
impl Sync for TestProblem
impl Unpin for TestProblem
impl UnsafeUnpin for TestProblem
impl UnwindSafe for TestProblem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more