Ocean
Ocean::Geometry::NonLinearOptimization Class Reference

This class implements the basic functions for least square or robust optimization algorithms for non linear functions. More...

Inheritance diagram for Ocean::Geometry::NonLinearOptimization:

Data Structures

class  AdvancedDenseOptimizationProvider
 This class implements the base for an advanced dense optimization provider. More...
 
class  AdvancedSparseOptimizationProvider
 This class implements the base class for an advanced sparse optimization provider. More...
 
class  CorrespondenceGroupsAccessor
 This class implements the base class for an accessor of groups of pairs. More...
 
class  ObjectPointGroupsAccessor
 This class implements an abstract specialization of the accessor for groups of pairs for object points. More...
 
class  ObjectPointToPoseIndexImagePointCorrespondenceAccessor
 This class implements a group accessor providing access to pairs of poses and image points. More...
 
class  OptimizationProvider
 This class implements the base optimization provider. More...
 
class  PoseGroupsAccessor
 This class implements an abstract specialization of the accessor for groups of pairs for poses. More...
 

Static Public Member Functions

template<typename T >
static bool denseOptimization (T &provider, const unsigned int iterations=5u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem. More...
 
template<typename T , Estimator::EstimatorType tEstimator>
static bool denseOptimization (T &provider, const unsigned int iterations=5u, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem. More...
 
template<typename T >
static bool sparseOptimization (T &provider, const unsigned int iterations=5u, const Estimator::EstimatorType estimator=Estimator::ET_SQUARE, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem. More...
 
template<typename T , Estimator::EstimatorType tEstimator>
static bool sparseOptimization (T &provider, const unsigned int iterations=5u, Scalar lambda=Scalar(0.001), const Scalar lambdaFactor=Scalar(5), Scalar *initialError=nullptr, Scalar *finalError=nullptr, const Matrix *invertedCovariances=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem. More...
 
template<typename T >
static bool advancedDenseOptimization (T &advancedDenseProvider, const unsigned int iterations, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a dense (matrix) optimization problem using an advanced optimization provider. More...
 
template<typename T >
static bool advancedSparseOptimization (T &advancedSparseProvider, const unsigned int iterations, Scalar lambda, const Scalar lambdaFactor, Scalar *initialError=nullptr, Scalar *finalError=nullptr, Scalars *intermediateErrors=nullptr)
 Invokes the optimization of a sparse (matrix) optimization problem using an advanced optimization provider. More...
 
template<Estimator::EstimatorType tEstimator>
static Scalar sqrErrors2robustErrors2 (const Scalars &sqrErrors, const size_t modelParameters, Vector2 *weightedErrors, Vector2 *weightVectors, const SquareMatrix2 *transposedInvertedCovariances)
 Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<Estimator::EstimatorType tEstimator, size_t tDimension>
static Scalar sqrErrors2robustErrors (const Scalars &sqrErrors, const size_t modelParameters, StaticBuffer< Scalar, tDimension > *weightedErrors, StaticBuffer< Scalar, tDimension > *weightVectors, const Matrix *transposedInvertedCovariances)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<Estimator::EstimatorType tEstimator>
static Scalar sqrErrors2robustErrors_i (const Scalars &sqrErrors, const size_t modelParameters, const size_t dimension, Scalar *weightedErrors_i, Scalar *weightVectors_i, const Matrix *transposedInvertedCovariances_i)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
static Scalar sqrErrors2robustErrors2 (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, Vector2 *weightedErrors, Vector2 *weightVectors, const SquareMatrix2 *transposedInvertedCovariances)
 Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors. More...
 
template<size_t tDimension>
static Scalar sqrErrors2robustErrors (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, StaticBuffer< Scalar, tDimension > *weightedErrors, StaticBuffer< Scalar, tDimension > *weightVectors, const Matrix *transposedInvertedCovariances)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 
static Scalar sqrErrors2robustErrors_i (const Estimator::EstimatorType estimator, const Scalars &sqrErrors, const size_t modelParameters, const size_t dimension, Scalar *weightedErrors_i, Scalar *weightVectors_i, const Matrix *transposedInvertedCovariances_i)
 Translates the n/i squared errors that correspond to n elements in the error vector to robust errors. More...
 

Friends

template<unsigned int , unsigned int , unsigned int >
class NonLinearUniversalOptimizationDense
 

Detailed Description

This class implements the basic functions for least square or robust optimization algorithms for non linear functions.

The actual optimization algorithms are located in derived functions.

Member Function Documentation

◆ advancedDenseOptimization()

template<typename T >
bool Ocean::Geometry::NonLinearOptimization::advancedDenseOptimization ( T &  advancedDenseProvider,
const unsigned int  iterations,
Scalar  lambda,
const Scalar  lambdaFactor,
Scalar initialError = nullptr,
Scalar finalError = nullptr,
Scalars intermediateErrors = nullptr 
)
static

Invokes the optimization of a dense (matrix) optimization problem using an advanced optimization provider.

The optimization can use a Levenberg-Marquardt approach or a Gauss-Newton approach.

Parameters
advancedDenseProviderThe advanced dense optimization provider that is used during the optimization
iterationsNumber of optimization iterations
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity), 0 to apply a Gauss-Netwton optimization approach
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity), 1 to apply a Gauss-Newton optimization approach
initialErrorOptional resulting averaged robust (depending on estimator) pixel error for the given initial parameters
finalErrorOptional resulting averaged robust (depending on estimator) pixel error for the final optimized parameters
intermediateErrorsOptional resulting intermediate (improving) errors
Returns
True, if at least one successful optimization iteration has been executed
Template Parameters
TData type of the advanced dense optimization provider, must be derived from AdvancedDenseOptimizationProvider

Now the provider will determine the (n x n) Hessian matrix and the (n x 1) Jacobian-Error matrix, may be the approximated Hessian. The Hessian matrix is calculated by J^T * J. The Jacobian-Error matrix is calculated by J^T * E, with E the error vector. The model has dimension n.

◆ advancedSparseOptimization()

template<typename T >
bool Ocean::Geometry::NonLinearOptimization::advancedSparseOptimization ( T &  advancedSparseProvider,
const unsigned int  iterations,
Scalar  lambda,
const Scalar  lambdaFactor,
Scalar initialError = nullptr,
Scalar finalError = nullptr,
Scalars intermediateErrors = nullptr 
)
static

Invokes the optimization of a sparse (matrix) optimization problem using an advanced optimization provider.

The optimization can use a Levenberg-Marquardt approach or a Gauss-Newton approach.

Parameters
advancedSparseProviderThe advanced sparse optimization provider that is used during the optimization
iterationsNumber of optimization iterations
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity), 0 to apply a Gauss-Netwton optimization approach
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity), 1 to apply a Gauss-Newton optimization approach
initialErrorOptional resulting averaged robust (depending on estimator) pixel error for the given initial parameters
finalErrorOptional resulting averaged robust (depending on estimator) pixel error for the final optimized parameters
intermediateErrorsOptional resulting intermediate (improving) errors
Returns
True, if at least one successful optimization iteration has been executed
Template Parameters
TData type of the advanced sparse optimization provider, must be derived from AdvancedSparseOptimizationProvider

Now the provider will determine all parameters like the Jacobian, the transposed Jacobian, the Hessian and the Jacobian-Error matrix. However, the provider may also determine parts of the values or abstract information as long as the provider is able to solve the linear equation later.

◆ denseOptimization() [1/2]

template<typename T >
bool Ocean::Geometry::NonLinearOptimization::denseOptimization ( T &  provider,
const unsigned int  iterations = 5u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
Scalar initialError = nullptr,
Scalar finalError = nullptr,
const Matrix invertedCovariances = nullptr,
Scalars intermediateErrors = nullptr 
)
inlinestatic

Invokes the optimization of a dense (matrix) optimization problem.

Parameters
providerThe optimization provider that is used during the optimization
iterationsNumber of optimization iterations
estimatorRobust estimator to be applied
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged robust (depending on estimator) pixel error for the given initial parameters
finalErrorOptional resulting averaged robust (depending on estimator) pixel error for the final optimized parameters
invertedCovariancesOptional set of inverted covariances that define the individual uncertainties of the measurements
intermediateErrorsOptional resulting intermediate (improving) errors in relation to the defined estimator
Returns
True, if at least one successful optimization iteration has been executed
Template Parameters
TData type of the optimization provider

◆ denseOptimization() [2/2]

template<typename T , Estimator::EstimatorType tEstimator>
bool Ocean::Geometry::NonLinearOptimization::denseOptimization ( T &  provider,
const unsigned int  iterations = 5u,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
Scalar initialError = nullptr,
Scalar finalError = nullptr,
const Matrix invertedCovariances = nullptr,
Scalars intermediateErrors = nullptr 
)
static

Invokes the optimization of a dense (matrix) optimization problem.

Parameters
providerThe optimization provider that is used during the optimization
iterationsNumber of optimization iterations
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged robust (depending on estimator) pixel error for the given initial parameters
finalErrorOptional resulting averaged robust (depending on estimator) pixel error for the final optimized parameters
invertedCovariancesOptional set of inverted covariances that define the individual uncertainties of the measurements
intermediateErrorsOptional resulting intermediate (improving) errors
Returns
True, if at least one successful optimization iteration has been executed
Template Parameters
TData type of the optimization provider
tEstimatorType of the robust estimator to be applied

◆ sparseOptimization() [1/2]

template<typename T >
bool Ocean::Geometry::NonLinearOptimization::sparseOptimization ( T &  provider,
const unsigned int  iterations = 5u,
const Estimator::EstimatorType  estimator = Estimator::ET_SQUARE,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
Scalar initialError = nullptr,
Scalar finalError = nullptr,
const Matrix invertedCovariances = nullptr,
Scalars intermediateErrors = nullptr 
)
static

Invokes the optimization of a sparse (matrix) optimization problem.

Parameters
providerThe optimization provider that is used during the optimization
iterationsNumber of optimization iterations
estimatorRobust estimator to be applied
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged robust (depending on estimator) pixel error for the given initial parameters
finalErrorOptional resulting averaged robust (depending on estimator) pixel error for the final optimized parameters
invertedCovariancesOptional set of inverted covariances that define the individual uncertainties of the measurements
intermediateErrorsOptional resulting intermediate (improving) errors
Returns
True, if at least one successful optimization iteration has been executed
Template Parameters
TData type of the optimization provider

◆ sparseOptimization() [2/2]

template<typename T , Estimator::EstimatorType tEstimator>
bool Ocean::Geometry::NonLinearOptimization::sparseOptimization ( T &  provider,
const unsigned int  iterations = 5u,
Scalar  lambda = Scalar(0.001),
const Scalar  lambdaFactor = Scalar(5),
Scalar initialError = nullptr,
Scalar finalError = nullptr,
const Matrix invertedCovariances = nullptr,
Scalars intermediateErrors = nullptr 
)
static

Invokes the optimization of a sparse (matrix) optimization problem.

Parameters
providerThe optimization provider that is used during the optimization
iterationsNumber of optimization iterations
lambdaInitial Levenberg-Marquardt damping value which may be changed after each iteration using the damping factor, with range [0, infinity)
lambdaFactorLevenberg-Marquardt damping factor to be applied to the damping value, with range [1, infinity)
initialErrorOptional resulting averaged robust (depending on estimator) pixel error for the given initial parameters
finalErrorOptional resulting averaged robust (depending on estimator) pixel error for the final optimized parameters
invertedCovariancesOptional set of inverted covariances that define the individual uncertainties of the measurements
intermediateErrorsOptional resulting intermediate (improving) errors
Returns
True, if at least one successful optimization iteration has been executed
Template Parameters
TData type of the optimization provider
tEstimatorType of the robust estimator to be applied

◆ sqrErrors2robustErrors() [1/2]

template<size_t tDimension>
Scalar Ocean::Geometry::NonLinearOptimization::sqrErrors2robustErrors ( const Estimator::EstimatorType  estimator,
const Scalars sqrErrors,
const size_t  modelParameters,
StaticBuffer< Scalar, tDimension > *  weightedErrors,
StaticBuffer< Scalar, tDimension > *  weightVectors,
const Matrix transposedInvertedCovariances 
)
inlinestatic

Translates the n/i squared errors that correspond to n elements in the error vector to robust errors.

Parameters
estimatorRobust error estimator to be used
sqrErrorsThe n/i squared errors
modelParametersNumber of parameters that define the model that has to be optimized
weightedErrorsInitial n errors that will be translated to robust errors
weightVectorsThe n individual weights that have been applied to the errors
transposedInvertedCovariancesOptional transposed ixi inverted covariance matrices, one for each pair of errors
Returns
Resulting averaged robust error of the entire data set
Template Parameters
tDimensionDimension of one error element

◆ sqrErrors2robustErrors() [2/2]

template<Estimator::EstimatorType tEstimator, size_t tDimension>
Scalar Ocean::Geometry::NonLinearOptimization::sqrErrors2robustErrors ( const Scalars sqrErrors,
const size_t  modelParameters,
StaticBuffer< Scalar, tDimension > *  weightedErrors,
StaticBuffer< Scalar, tDimension > *  weightVectors,
const Matrix transposedInvertedCovariances 
)
static

Translates the n/i squared errors that correspond to n elements in the error vector to robust errors.

Parameters
sqrErrorsThe n/i squared errors
modelParametersNumber of parameters that define the model that has to be optimized
weightedErrorsInitial n errors that will be translated to robust errors
weightVectorsThe n individual weights that have been applied to the errors
transposedInvertedCovariancesOptional transposed ixi inverted covariance matrices, one for each pair of errors
Returns
Resulting averaged robust error of the entire data set
Template Parameters
tEstimatorRobust error estimator to be used
tDimensionDimension of one error element

◆ sqrErrors2robustErrors2() [1/2]

Scalar Ocean::Geometry::NonLinearOptimization::sqrErrors2robustErrors2 ( const Estimator::EstimatorType  estimator,
const Scalars sqrErrors,
const size_t  modelParameters,
Vector2 weightedErrors,
Vector2 weightVectors,
const SquareMatrix2 transposedInvertedCovariances 
)
inlinestatic

Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors.

Parameters
estimatorRobust error estimator to be used
sqrErrorsThe n/2 squared errors
modelParametersNumber of parameters that define the model that has to be optimized
weightedErrorsInitial n errors that will be translated to robust errors
weightVectorsThe n individual weights that have been applied to the errors
transposedInvertedCovariancesOptional transposed 2x2 inverted covariance matrices, one for each pair of errors
Returns
Resulting averaged robust error of the entire data set

◆ sqrErrors2robustErrors2() [2/2]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::NonLinearOptimization::sqrErrors2robustErrors2 ( const Scalars sqrErrors,
const size_t  modelParameters,
Vector2 weightedErrors,
Vector2 weightVectors,
const SquareMatrix2 transposedInvertedCovariances 
)
static

Translates the n/2 squared errors that correspond to n elements in the error vector to robust errors.

Parameters
sqrErrorsThe n/2 squared errors
modelParametersNumber of parameters that define the model that has to be optimized
weightedErrorsInitial n errors that will be translated to robust errors
weightVectorsThe n individual weights that have been applied to the errors
transposedInvertedCovariancesOptional transposed 2x2 inverted covariance matrices, one for each pair of errors
Returns
Resulting averaged robust error of the entire data set
Template Parameters
tEstimatorRobust error estimator to be used

◆ sqrErrors2robustErrors_i() [1/2]

Scalar Ocean::Geometry::NonLinearOptimization::sqrErrors2robustErrors_i ( const Estimator::EstimatorType  estimator,
const Scalars sqrErrors,
const size_t  modelParameters,
const size_t  dimension,
Scalar weightedErrors_i,
Scalar weightVectors_i,
const Matrix transposedInvertedCovariances_i 
)
inlinestatic

Translates the n/i squared errors that correspond to n elements in the error vector to robust errors.

Parameters
estimatorRobust error estimator to be used
sqrErrorsThe n/i squared errors
modelParametersNumber of parameters that define the model that has to be optimized
dimensionThe dimension of one error element, with range [1, infinity)
weightedErrors_iInitial n errors that will be translated to robust errors
weightVectors_iThe n individual weights that have been applied to the errors
transposedInvertedCovariances_iOptional transposed ixi inverted covariance matrices, one for each pair of errors
Returns
Resulting averaged robust error of the entire data set

◆ sqrErrors2robustErrors_i() [2/2]

template<Estimator::EstimatorType tEstimator>
Scalar Ocean::Geometry::NonLinearOptimization::sqrErrors2robustErrors_i ( const Scalars sqrErrors,
const size_t  modelParameters,
const size_t  dimension,
Scalar weightedErrors_i,
Scalar weightVectors_i,
const Matrix transposedInvertedCovariances_i 
)
static

Translates the n/i squared errors that correspond to n elements in the error vector to robust errors.

Parameters
sqrErrorsThe n/i squared errors
modelParametersNumber of parameters that define the model that has to be optimized
dimensionThe dimension of one error element, with range [1, infinity)
weightedErrors_iInitial n errors that will be translated to robust errors
weightVectors_iThe n individual weights that have been applied to the errors
transposedInvertedCovariances_iOptional transposed ixi inverted covariance matrices, one for each pair of errors
Returns
Resulting averaged robust error of the entire data set
Template Parameters
tEstimatorRobust error estimator to be used

Friends And Related Function Documentation

◆ NonLinearUniversalOptimizationDense

template<unsigned int , unsigned int , unsigned int >
friend class NonLinearUniversalOptimizationDense
friend

The documentation for this class was generated from the following file: