File perl-Algorithm-CurveFit.spec of Package perl-Algorithm-CurveFit

#
# spec file for package perl-Algorithm-CurveFit
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           perl-Algorithm-CurveFit
Version:        1.05
Release:        0
%define cpan_name Algorithm-CurveFit
Summary:        Nonlinear Least Squares Fitting
License:        Artistic-1.0 or GPL-1.0+
Group:          Development/Libraries/Perl
Url:            http://search.cpan.org/dist/Algorithm-CurveFit/
Source0:        http://www.cpan.org/authors/id/S/SM/SMUELLER/%{cpan_name}-%{version}.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl(Math::MatrixReal)
BuildRequires:  perl(Math::Symbolic) >= 0.602
BuildRequires:  perl(Module::Build) >= 0.360000
Requires:       perl(Math::MatrixReal)
Requires:       perl(Math::Symbolic) >= 0.602
Recommends:     perl(Test::Pod) >= 1.0
Recommends:     perl(Test::Pod::Coverage) >= 1.0
%{perl_requires}

%description
'Algorithm::CurveFit' implements a nonlinear least squares curve fitting
algorithm. That means, it fits a curve of known form (sine-like,
exponential, polynomial of degree n, etc.) to a given set of data points.

For details about the algorithm and its capabilities and flaws, you're
encouraged to read the MathWorld page referenced below. Note, however, that
it is an iterative algorithm that improves the fit with each iteration
until it converges. The following rule of thumb usually holds true:

The curve fitting algorithm is accessed via the 'curve_fit' subroutine. It
requires the following parameters as 'key => value' pairs:

* formula

The formula should be a string that can be parsed by Math::Symbolic.
Alternatively, it can be an existing Math::Symbolic tree. Please refer to
the documentation of that module for the syntax.

Evaluation of the formula for a specific value of the variable (X-Data) and
the parameters (see below) should yield the associated Y-Data value in case
of perfect fit.

* variable

The 'variable' is the variable in the formula that will be replaced with
the X-Data points for evaluation. If omitted in the call to 'curve_fit',
the name 'x' is default. (Hence 'xdata'.)

* params

The parameters are the symbols in the formula whose value is varied by the
algorithm to find the best fit of the curve to the data. There may be one
or more parameters, but please keep in mind that the number of parameters
not only increases processing time, but also decreases the quality of the
fit.

The value of this options should be an anonymous array. This array should
hold one anonymous array for each parameter. That array should hold (in
order) a parameter name, an initial guess, and optionally an accuracy
measure.

Example:

  $params = [
    ['parameter1', 5,  0.00001],
    ['parameter2', 12, 0.0001 ],
    ...
  ];

  Then later:
  curve_fit(
  ...
    params => $params,
  ...
  );

The accuracy measure means that if the change of parameters from one
iteration to the next is below each accuracy measure for each parameter,
convergence is assumed and the algorithm stops iterating.

In order to prevent looping forever, you are strongly encouraged to make
use of the accuracy measure (see also: maximum_iterations).

The final set of parameters is *not* returned from the subroutine but the
parameters are modified in-place. That means the original data structure
will hold the best estimate of the parameters.

* xdata

This should be an array reference to an array holding the data for the
variable of the function. (Which defaults to 'x'.)

* ydata

This should be an array reference to an array holding the function values
corresponding to the x-values in 'xdata'.

* maximum_iterations

Optional parameter to make the process stop after a given number of
iterations. Using the accuracy measure and this option together is
encouraged to prevent the algorithm from going into an endless loop in some
cases.

The subroutine returns the sum of square residuals after the final
iteration as a measure for the quality of the fit.

%prep
%setup -q -n %{cpan_name}-%{version}
find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644

%build
%{__perl} Build.PL installdirs=vendor
./Build build flags=%{?_smp_mflags}

%check
./Build test

%install
./Build install destdir=%{buildroot} create_packlist=0
%perl_gen_filelist

%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes examples README

%changelog
openSUSE Build Service is sponsored by