ResidualBlockBuilder

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

Source

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

pub fn set_loss(self, loss: LossFunction) -> Self

Set loss function for the residual block.

Source

pub fn set_parameters<P>(self, parameters: impl IntoIterator<Item = P>) -> Self

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.

Source

pub fn add_parameter<P>(self, parameter_block: P) -> Self

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.