This package contains an implementation of the Levenberg-Marquardt non-linear least squares fitting algorithm. This package manifest contains three pretty much unrelated sections:
  1. How to use the LevenbergMarquardt class.
  2. How to roll your own Matrix implementaion.
  3. A description of the Levenberg-Marquardt algorithm (i.e. why it works).

Using the LevenbergMarquardt Class

Length and Dimension

Every LevenbergMarquardt instance has an associated length and a dimension. Length specifies the number of points your input data has, while dimension specifies the dimension of each point. An important note here: The dimension of the input data does not include the values of each data point. For example, suppose you have a series of (x,y) points, and you wish to fit a function of the x-points to the y-values. (Notice I've been very sneaky in my semantics, here.) This would be considered one dimensional data, because the function you wish to fit (i.e. something of the form y=f(x)) takes a vector of one dimension (each data point has only a single component - x.

Here's a slightly more complex example: Suppose you have space-time points, i.e. three spatial coordinates and a time coordinate; basically, you data looks something like this:
[ {x0, y0, z0, t0}, {x1, y1, z1, t1}, ... , {xn-1, yn-1, zn-1, tn-1} ]
And you wish to fit a function t=f(x,y,z). This would be considered data of length n and dimension 3.

Basically, what I'm getting at here is that the dimension is simply the length of each input vector minus one; this works because Levenberg-Marquardt works only with one-dimensional cost functions (i.e., in the second example, it would not be possible to find a function <t,x>=f(y,z) - that is a vector function mapping <y,z> vectors to <t,x> vectors.

Cost Functions

Guess Data

Setting the Input Data and Values

Stepping and Iterating

Getting the Optimized Solution

Clearing and Resetting

Adjusting the Algorithm

Using Your Own Matrix Implementation

The Matrix Interface

The MatrixFactory Class

The Levenberg-Marquardt Algorithm

@author Fran Lattanzio