NAME

PDL::Slatec - PDL interface to some LINPACK and EISPACK routines - DEPRECATED

SYNOPSIS

use PDL::Slatec;

($ndeg, $r, $ierr, $c) = polyfit($x, $y, $w, $maxdeg, $eps);

DESCRIPTION

This module is now deprecated in favour of PDL::LinearAlgebra.

This module serves the dual purpose of providing an interface to parts of the slatec library and showing how to interface PDL to an external library. Using this library requires a Fortran compiler; the source for the routines is provided for convenience.

Currently available are routines to: manipulate matrices; calculate FFT's; and fit data using polynomials.

Piecewise cubic Hermite interpolation (PCHIP)

These routines are now in PDL::Primitive as of PDL 2.096.

FUNCTIONS

eigsys

Eigenvalues and eigenvectors of a real positive definite symmetric matrix.

($eigvals,$eigvecs) = eigsys($mat)

Note: this function should be extended to calculate only eigenvalues if called in scalar context!

This is the EISPACK routine rs.

matinv

Inverse of a square matrix

($inv) = matinv($mat)

polyfit

Convenience wrapper routine about the polfit slatec function. Separates supplied arguments and return values.

Fit discrete data in a least squares sense by polynomials in one variable. Handles broadcasting correctly--one can pass in a 2D PDL (as $y) and it will pass back a 2D PDL, the rows of which are the polynomial regression results (in $r) corresponding to the rows of $y.

($ndeg, $r, $ierr, $c, $coeffs, $rms) = polyfit($x, $y, $w, $maxdeg, [$eps]);

$coeffs = polyfit($x,$y,$w,$maxdeg,[$eps]);

where on input:

$x and $y are the values to fit to a polynomial. $w are weighting factors $maxdeg is the maximum degree of polynomial to use and $eps is the required degree of fit.

and the output switches on list/scalar context.

In list context:

$ndeg is the degree of polynomial actually used $r is the values of the fitted polynomial $ierr is a return status code, and $c is some working array or other (preserved for historical purposes) $coeffs is the polynomial coefficients of the best fit polynomial. $rms is the rms error of the fit.

In scalar context, only $coeffs is returned.

Historically, $eps was modified in-place to be a return value of the rms error. This usage is deprecated, and $eps is an optional parameter now. It is still modified if present.

$c is a working array accessible to Slatec - you can feed it to several other Slatec routines to get nice things out. It does not broadcast correctly and should probably be fixed by someone. If you are reading this, that someone might be you.

This version of polyfit handles bad values correctly. Bad values in $y are ignored for the fit and give computed values on the fitted curve in the return. Bad values in $x or $w are ignored for the fit and result in bad elements in the output.

polycoef

Convenience wrapper routine around the pcoef slatec function. Separates supplied arguments and return values.

Convert the polyfit/polfit coefficients to Taylor series form.

$tc = polycoef($l, $c, $x);

detslatec

compute the determinant of an invertible matrix

$mat = identity(5); # unity matrix
$det = detslatec $mat;

Usage:

$determinant = detslatec $matrix;
Signature: detslatec(mat(n,m); [o] det())

detslatec computes the determinant of an invertible matrix and barfs if the matrix argument provided is non-invertible. The matrix broadcasts as usual.

This routine was previously known as det which clashes now with det which is provided by PDL::MatrixOps.

fft

Fast Fourier Transform

$v_in = pdl(1,0,1,0);
($azero,$x,$y) = PDL::Slatec::fft($v_in);

PDL::Slatec::fft is a convenience wrapper for "ezfftf", and performs a Fast Fourier Transform on an input vector $v_in. The return values are the same as for "ezfftf".

rfft

reverse Fast Fourier Transform

$v_out = PDL::Slatec::rfft($azero,$x,$y);
print $v_in, $vout
[1 0 1 0] [1 0 1 0]

PDL::Slatec::rfft is a convenience wrapper for "ezfftb", and performs a reverse Fast Fourier Transform. The input is the same as the output of "PDL::Slatec::fft", and the output of rfft is a data vector, similar to what is input into "PDL::Slatec::fft".

svdc

Signature: (x(n,p); [o] s(p); [o] e(p); [o] u(n,p); [o] v(p,p); [t] work(n); longlong job(); longlong [o] info())

singular value decomposition of a matrix

svdc does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

poco

Signature: ([io] a(n,n); [o] rcond(); [o] z(n); longlong [o] info())

Factor a real symmetric positive definite matrix and estimate the condition number of the matrix.

poco does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

geco

Signature: (a(n,n); longlong [o] ipvt(n); [o] rcond(); [o] z(n))

Factor a matrix using Gaussian elimination and estimate the condition number of the matrix.

geco does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

gefa

Signature: ([io] a(n,n); longlong [o] ipvt(n); longlong [o] info())

Factor a matrix using Gaussian elimination.

gefa does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

podi

Signature: ([io] a(n,n); [o] det(two=2); longlong job())

Compute the determinant and inverse of a certain real symmetric positive definite matrix using the factors computed by "poco".

podi does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

gedi

Signature: ([io] a(n,n); longlong ipvt(n); [o] det(two=2); [t] work(n); longlong job())

Compute the determinant and inverse of a matrix using the factors computed by "geco" or "gefa".

gedi does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

gesl

Signature: (a(lda,n); longlong ipvt(n); [io] b(n); longlong job())

Solve the real system A*X=B or TRANS(A)*X=B using the factors computed by "geco" or "gefa".

gesl does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

rs

Signature: (a(n,n); [o] w(n); longlong matz(); [o] z(n,n); [t] fvone(n); [t] fvtwo(n); longlong [o] ierr())

This subroutine calls the recommended sequence of subroutines from the eigensystem subroutine package (EISPACK) to find the eigenvalues and eigenvectors (if desired) of a REAL SYMMETRIC matrix.

rs does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

ezffti

Signature: (longlong n(); [io] wsave(foo); longlong [o] ifac(ni=15))

Subroutine ezffti initializes the work array wsave(3n or more) and ifac() which is used in both "ezfftf" and "ezfftb". The prime factorization of n together with a tabulation of the trigonometric functions are computed and stored in wsave().

ezffti does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

ezfftf

Signature: (r(n); [o] azero(); [o] a(n); [o] b(n); wsave(foo); longlong ifac(ni=15))

ezfftf does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

ezfftb

Signature: ([o] r(n); azero(); a(n); b(n); wsave(foo); longlong ifac(ni=15))

ezfftb does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

pcoef

Signature: (longlong l(); c(); [o] tc(bar); a(foo))

Convert the polfit coefficients to Taylor series form. c and a() must be of the same type.

pcoef does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

polyvalue

Signature: (longlong l(); x(); [o] yfit(); [o] yp(nder); a(foo); PDL_LongLong nder => nder)

Use the coefficients c generated by "polyfit" (or "polfit") to evaluate the polynomial fit of degree l, along with the first nder of its derivatives, at a specified point x. Broadcasts correctly over multiple x positions.

($yfit, $yp) = polyvalue($l, $nder, $x, $c);

polyvalue does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

polfit

Signature: (x(n); y(n); w(n); longlong maxdeg(); longlong [o]ndeg(); [io]eps(); [o]r(n); longlong [o]ierr(); [o]a(foo=CALC(3*($SIZE(n) + $SIZE(bar)))); [o]coeffs(bar);[t]xtmp(n);[t]ytmp(n);[t]wtmp(n);[t]rtmp(n); IV max_maxdeg_plus1 => bar)

Fit discrete data in a least squares sense by polynomials in one variable. x(), y() and w() must be of the same type. This version handles bad values appropriately

polfit processes bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

AUTHOR

Copyright (C) 1997 Tuomas J. Lukka. Copyright (C) 2000 Tim Jenness, Doug Burke. All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file is separated from the PDL distribution, the copyright notice should be included in the file.