Struct ceres_solver::nlls_problem::NllsProblem
source · pub struct NllsProblem<'cost> { /* private fields */ }Expand description
Non-Linear Least Squares problem.
You use it in three steps:
- NllsProblem::new creates a new empty instance of the problem.
- NllsProblem::add_residual_block adds a ResidualBlock, each with its own parameters, cost and loss functions.
- NllsProblem::solve solves the problem and returns a vector consists of parameters for each residual block.
NllsProblem::solve call invalidates the NllsProblem instance, so calling this method twice would return Err. Err also is returned if no residual block have been added to the problem.
Implementations§
source§impl<'cost> NllsProblem<'cost>
impl<'cost> NllsProblem<'cost>
sourcepub fn new() -> Self
pub fn new() -> Self
A new NllsProblem having ProblemStatus::Uninitialized state.
sourcepub fn add_residual_block(
&mut self,
block: ResidualBlock<'cost>
) -> Result<(), Error>
pub fn add_residual_block(
&mut self,
block: ResidualBlock<'cost>
) -> Result<(), Error>
Adds a residual block to the problem.
Returns Err if NllsProblem has ProblemStatus::Solved state.
sourcepub fn solve(&mut self) -> Result<Vec<Vec<Vec<f64>>>, Error>
pub fn solve(&mut self) -> Result<Vec<Vec<Vec<f64>>>, Error>
Solves the problem and returns a vector of solutions, one per residual block. Returns Err if problem doesn’t have ProblemStatus::Ready state.
sourcepub fn status(&self) -> &ProblemStatus<'_>
pub fn status(&self) -> &ProblemStatus<'_>
Returns the status of the problem.
sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Returns the number of residual blocks for an unsolved problem, zero otherwise.