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.
Auto Trait Implementations§
impl<'cost> Freeze for ResidualBlockBuilder<'cost>
impl<'cost> !RefUnwindSafe for ResidualBlockBuilder<'cost>
impl<'cost> !Send for ResidualBlockBuilder<'cost>
impl<'cost> !Sync for ResidualBlockBuilder<'cost>
impl<'cost> Unpin for ResidualBlockBuilder<'cost>
impl<'cost> !UnwindSafe for ResidualBlockBuilder<'cost>
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