Files
perl-Math-Spline/perl-Math-Spline.spec
2025-08-12 18:15:22 +02:00

83 lines
3.0 KiB
RPMSpec

#
# spec file for package perl-Math-Spline
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define cpan_name Math-Spline
Name: perl-Math-Spline
Version: 0.20.0
Release: 0
# 0.02 -> normalize -> 0.20.0
%define cpan_version 0.02
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Math::Spline Perl module
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/C/CH/CHORNY/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Math::Derivative)
Requires: perl(Math::Derivative)
Provides: perl(Math::Spline) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
This package provides cubic spline interpolation of numeric data. The data
is passed as references to two arrays containing the x and y ordinates. It
may be used as an exporter of the numerical functions or, more easily as a
class module.
The *Math::Spline* class constructor *new* takes references to the arrays
of x and y ordinates of the data. An interpolation is performed using the
*evaluate* method, which, when given an x ordinate returns the interpolate
y ordinate at that value.
The *spline* function takes as arguments references to the x and y ordinate
array, a reference to the 2nd derivatives (calculated using *Derivative2*,
the low index of the interval in which to interpolate and the x ordinate in
that interval. Returned is the interpolated y ordinate. Two functions are
provided to look up the appropriate index in the array of x data. For
random calls *binsearch* can be used - give a reference to the x ordinates
and the x loopup value it returns the low index of the interval in the data
in which the value lies. Where the lookups are strictly in ascending
sequence (e.g. if interpolating to produce a higher resolution data set to
draw a curve) the *linsearch* function may more efficiently be used. It
performs like *binsearch*, but requires a third argument being the previous
index value, which is incremented if necessary.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc README Release
%changelog