Struct ceres_solver::nlls_problem::ResidualBlockBuilder
source · pub struct ResidualBlockBuilder<'cost> { /* private fields */ }Expand description
Builder for a new residual block. It captures NllsProblem and returns it back with ResidualBlockBuilder::build_into_problem call.
Implementations§
source§impl<'cost> ResidualBlockBuilder<'cost>
impl<'cost> ResidualBlockBuilder<'cost>
sourcepub fn set_cost(
self,
func: impl Into<CostFunctionType<'cost>>,
num_residuals: usize
) -> Self
pub fn set_cost( self, func: impl Into<CostFunctionType<'cost>>, num_residuals: usize ) -> Self
Set cost function for the residual block.
Arguments:
func- cost function, see [CostFunction] for details on how to implement it,num_residuals- number of residuals, typically the same as the number of experiments.
sourcepub fn set_loss(self, loss: LossFunction) -> Self
pub fn set_loss(self, loss: LossFunction) -> Self
Set loss function for the residual block.
sourcepub fn set_parameters<P>(self, parameters: impl IntoIterator<Item = P>) -> Selfwhere
P: Into<ParameterBlockOrIndex>,
pub fn set_parameters<P>(self, parameters: impl IntoIterator<Item = P>) -> Selfwhere P: Into<ParameterBlockOrIndex>,
Set parameters for the residual block.
The argument is an iterator over ParameterBlockOrIndex which can be either a new parameter block or an index of an existing parameter block.
sourcepub fn add_parameter<P>(self, parameter_block: P) -> Selfwhere
P: Into<ParameterBlockOrIndex>,
pub fn add_parameter<P>(self, parameter_block: P) -> Selfwhere P: Into<ParameterBlockOrIndex>,
Add a new parameter block to the residual block.
The argument is either a new parameter block or an index of an existing parameter block.
sourcepub fn build_into_problem(
self
) -> Result<(NllsProblem<'cost>, ResidualBlockId), ResidualBlockBuildingError>
pub fn build_into_problem( self ) -> Result<(NllsProblem<'cost>, ResidualBlockId), ResidualBlockBuildingError>
Build the residual block, add to the problem and return the problem back.
Returns ResidualBlockBuildingError if:
- cost function is not set,
- no parameters are set,
- any of the parameters is not a new parameter block or an index of an existing parameter.
Otherwise returns the problem and the residual block id.