PDL::Fit::LM

PDL::Fit::LM is a Levenber-Marquardt fitting routine for PDL.
Download

PDL::Fit::LM Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Christian Soeller
  • Publisher web site:
  • http://search.cpan.org/~hbiersma/MQSeries-1.28-b/MQSeries/QueueManager.pm

PDL::Fit::LM Tags


PDL::Fit::LM Description

PDL::Fit::LM is a Levenber-Marquardt fitting routine for PDL. PDL::Fit::LM is a Levenber-Marquardt fitting routine for PDL.Currently, only Levenberg-Marquardt fitting is implemented. Other procedures should be added as required. For a fairly concise overview on fitting see Numerical Recipes, chapter 15 "Modeling of data".SYNOPSIS use PDL::Fit::LM; $ym = lmfit $x, $y, $sig, &expfunc, $a, {Maxiter => 300};FUNCTIONSlmfitLevenberg-Marquardt fitting of a user supplied model function ($ym,$a,$covar,$iters) = lmfit $x, $y, $sig, &expfunc, $a, {Maxiter => 300, Eps => 1e-3};Options: Maxiter: maximum number of iterations before giving up Eps: convergence citerium for fit; success when normalized change in chisquare smaller than EpsThe user supplied sub routine reference should accept 4 argumentsa vector of independent values $xa vector of fitting parametersa vector of dependent variables that will be assigned upon returna matrix of partial derivatives with respect to the fitting parameters that will be assigned upon returnAs an example take this definition of a single exponential with 3 parameters (width, amplitude, offset): sub expdec { my ($x,$par,$ym,$dyda) = @_; my ($a,$b,$c) = map {$par->slice("($_)")} (0..2); my $arg = $x/$a; my $ex = exp($arg); $ym .= $b*$ex+$c; my (@dy) = map {$dyda->slice(",($_)")} (0..2); $dy .= -$b*$ex*$arg/$a; $dy .= $ex; $dy .= 1; }Note usage of the .= operator for assignmentIn scalar context returns a vector of the fitted dependent variable. In list context returns fitted y-values, vector of fitted parameters, an estimate of the covariance matrix (as an indicator of goodness of fit) and number of iterations performed.tlmfitthreaded version of Levenberg-Marquardt fitting routine mfit tlmfit $x, $y, float(1)->dummy(0), $na, float(200), float(1e-4), $ym=null, $afit=null, &expdec;Signature: tlmfit(x(n);y(n);sig(n);a(m);iter();eps(); ym(n); ao(m); OtherPar => subref)a threaded version of lmfit by using perl threading. Direct threading in lmfit seemed difficult since we have an if condition in the iteration. In principle that can be worked around by using where but .... Send a threaded lmfit version if you work it out!Since we are using perl threading here speed is not really great but it is just convenient to have a threaded version for many applications (no explicit for-loops required, etc). Suffers from some of the current limitations of perl level threading.Requirements:· Perl


PDL::Fit::LM Related Software