Package minimise :: Module levenberg_marquardt :: Class levenberg_marquardt
[hide private]
[frames] | no frames]

Class levenberg_marquardt

source code


Instance Methods [hide private]
 
__init__(self, chi2_func=None, dchi2_func=None, dfunc=None, errors=None, args=(), x0=None, func_tol=1e-05, maxiter=1000, full_output=0, print_flag=0)
Class for Levenberg-Marquardt minimisation specific functions.
source code
 
backup_current_data(self)
Function to backup the current data into fk_last.
source code
 
create_lm_matrix(self)
Function to create the Levenberg-Marquardt matrix.
source code
 
new_param_func(self)
Find the new parameter vector self.xk_new
source code
 
tests(self)
Levenberg-Marquardt tests.
source code
 
update_data(self)
Function to update the chi-squared value, chi-squared gradient vector, and derivative function matrix.
source code

Inherited from generic_minimise.generic_minimise: generic_minimise

Method Details [hide private]

__init__(self, chi2_func=None, dchi2_func=None, dfunc=None, errors=None, args=(), x0=None, func_tol=1e-05, maxiter=1000, full_output=0, print_flag=0)
(Constructor)

source code 
Class for Levenberg-Marquardt minimisation specific functions.

Function options
~~~~~~~~~~~~~~~~

chi2_func:  User supplied chi-squared function which is run with the function parameters and args as options.
dchi2_func:  User supplied chi-squared gradient function which is run with the function parameters and args as options.
dfunc:  User supplied function which should return a vector of partial derivatives of the function which back calculates
        values for the chi-squared function.
params:  The initial function parameter values.
errors:  The experimental errors.
args:  A tuple containing the arguments to send to chi2_func and dchi2_func.
maxiter:  The maximum number of iterations.
full_output:  A flag specifying what should be returned.


Output
~~~~~~

If full_output = 0, the parameter values and chi-squared value are returned as a tuple.
If full_output = 1, the parameter values, chi-squared value, number of iterations, and the warning flag are returned as a tuple.

Overrides: generic_minimise.generic_minimise.__init__

create_lm_matrix(self)

source code 
Function to create the Levenberg-Marquardt matrix.

The matrix is:

                       _n_
                       \   /     1        d y(xi)   d y(xi)                \ 
        LM_matrix_jk =  >  | ---------- . ------- . ------- . (1 + lambda) |
                       /__ \ sigma_i**2     dj        dk                   /
                       i=1

        where j == k is one of the function parameters.

                       _n_
                       \   /     1        d y(xi)   d y(xi) \ 
        LM_matrix_jk =  >  | ---------- . ------- . ------- |
                       /__ \ sigma_i**2     dj        dk    /
                       i=1

        where j != k are function parameters.

tests(self)

source code 

Levenberg-Marquardt tests.

Overrides: generic_minimise.generic_minimise.tests