pub struct TestProblem {}
Expand description

Pseudo problem useful for testing

Implements CostFunction, Operator, Gradient, Jacobian, Hessian, and Anneal.

Implementations

Create an instance of TestProblem.

Example
use argmin::core::test_utils::TestProblem;

let problem = TestProblem::new();

Trait Implementations

Returns a clone of parameter p.

Example
use argmin::core::test_utils::TestProblem;
use argmin::solver::simulatedannealing::Anneal;

let problem = TestProblem::new();

let param = vec![1.0, 2.0];

let res = problem.anneal(&param, 1.0)?;

Type of the parameter vector

Return type of the anneal function

Precision of floats

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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(&param)?;

Type of the parameter vector

Tyope of the return value of the cost function

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.

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.

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

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(&param)?;

Type of the parameter vector

Type of the gradient

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.

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.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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(&param)?;

Type of the parameter vector

Type of the Hessian

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.

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.

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(&param)?;

Type of the parameter vector

Type of the Jacobian

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.

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.

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(&param)?;

Type of the parameter vector

Type of the return value of the operator

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.

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.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.