pub struct CostFunction<'a>(_);
Expand description

A cost function for ResidualBlock of the NllsProblem.

Implementations§

Create a new cost function for ResidualBlock from a Rust function.

Arguments
  • func - function to find residuals and Jacobian for the problem block. The function itself must return false if it cannot compute Jacobian, true otherwise, and accept following arguments:
    • parameters - slice of f64 slices representing the current values of the parameters. Each parameter is represented as a slice, the slice sizes are specified by parameter_sizes.
    • residuals - mutable slice of f64 for residuals outputs, the size is specified by num_residuals.
    • jacobians: JacobianType - represents a mutable structure to output the Jacobian. Sometimes the solver doesn’t need the Jacobian or some of its components, in this case the corresponding value is None. For the required components it has a 3-D shape: top index is for the parameter index, middle index is for the residual index, and the most inner dimension is for the given parameter component index. So the size of top-level Some is defined by parameter_sizes.len(), second-level Some’s slice length is num_residuals, and the bottom-level slice has length of parameter_sizes[i], where i is the top-level index.
  • parameter_sizes - sizes of the parameter vectors.
  • num_residuals - length of the residual vector, usually corresponds to the number of data points.

Lengths of the parameter vectors.

Length of the residual vector.

Parameter count.

Calls underlying cost function.

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 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.