Stability  Experimental 

Maintainer  Roel van Dijk <vandijk.roel@gmail.com> Bas van Dijk <v.dijk.bas@gmail.com> 
For additional documentation see the documentation of the levmar C library which this library is based on: http://www.ics.forth.gr/~lourakis/levmar/
 type Model r = Vector r > Vector r
 type Jacobian r = Vector r > Matrix r
 class LevMarable r where
 data Options r = Opts {
 optScaleInitMu :: !r
 optStopNormInfJacTe :: !r
 optStopNorm2Dp :: !r
 optStopNorm2E :: !r
 optDelta :: !r
 defaultOpts :: Fractional r => Options r
 data Constraints r = Constraints {
 lowerBounds :: !(Maybe (Vector r))
 upperBounds :: !(Maybe (Vector r))
 weights :: !(Maybe (Vector r))
 linearConstraints :: !(Maybe (LinearConstraints r))
 type LinearConstraints r = (Matrix r, Vector r)
 data Info r = Info {
 infNorm2initE :: !r
 infNorm2E :: !r
 infNormInfJacTe :: !r
 infNorm2Dp :: !r
 infMuDivMax :: !r
 infNumIter :: !Int
 infStopReason :: !StopReason
 infNumFuncEvals :: !Int
 infNumJacobEvals :: !Int
 infNumLinSysSolved :: !Int
 data StopReason
 data LevMarError
Model & Jacobian.
type Model r = Vector r > Vector rSource
A functional relation describing measurements represented as a function from a vector of parameters to a vector of expected measurements.
type Jacobian r = Vector r > Matrix rSource
The jacobian of the Model
function. Expressed as a function from a vector
of parameters to a matrix which for each expected measurement describes
the partial derivatives of the parameters.
See: http://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant
 Ensure that the length of the parameter vector equals the length of the initial
parameter vector in
levmar
.  Ensure that the output matrix has the dimension
n><m
wheren
is the number of samples andm
is the number of parameters.
LevenbergMarquardt algorithm.
class LevMarable r whereSource
:: Model r  Model 
> Maybe (Jacobian r)  Optional jacobian 
> Vector r  Initial parameters 
> Vector r  Samples 
> Int  Maximum iterations 
> Options r  Minimization options 
> Constraints r  Constraints 
> Either LevMarError (Vector r, Info r, Matrix r) 
The LevenbergMarquardt algorithm.
Returns a tuple of the found parameters, a structure containing information about the minimization and the covariance matrix corresponding to LS solution.
Minimization options.
Minimization options
Opts  

defaultOpts :: Fractional r => Options rSource
Default minimization options
Constraints
data Constraints r Source
Ensure that these vectors have the same length as the number of parameters.
Constraints  

Monoid (Constraints r) 

type LinearConstraints r = (Matrix r, Vector r)Source
Linear constraints consisting of a constraints matrix, k><m
and
a right hand constraints vector, of length k
where m
is the number of
parameters and k
is the number of constraints.
Output
Information regarding the minimization.
Info  

data StopReason Source
Reason for terminating.
SmallGradient  Stopped because of small gradient 
SmallDp  Stopped because of small Dp. 
MaxIterations  Stopped because maximum iterations was reached. 
SingularMatrix  Stopped because of singular matrix. Restart from current
estimated parameters with increased 
SmallestError  Stopped because no further error reduction is
possible. Restart with increased 
SmallNorm2E  Stopped because of small 
InvalidValues  Stopped because model function returned invalid values (i.e. NaN or Inf). This is a user error. 
data LevMarError Source
LevMarError  Generic error (not one of the others) 
LapackError  A call to a lapack subroutine failed in the underlying C levmar library. 
FailedBoxCheck  At least one lower bound exceeds the upper one. 
MemoryAllocationFailure  A call to 
ConstraintMatrixRowsGtCols  The matrix of constraints cannot have more rows than columns. 
ConstraintMatrixNotFullRowRank  Constraints matrix is not of full row rank. 
TooFewMeasurements  Cannot solve a problem with fewer measurements than unknowns. In case linear constraints are provided, this error is also returned when the number of measurements is smaller than the number of unknowns minus the number of equality constraints. 