blitzpp / blitz

Blitz++ Multi-Dimensional Array Library for C++
https://github.com/blitzpp/blitz/wiki
Other
404 stars 83 forks source link

patch: cubic spline interpolation of complex 1D array #86

Open slayoo opened 5 years ago

slayoo commented 5 years ago

Migrated from SF: https://sourceforge.net/p/blitz/patches/8/

interp1D.tar.gz

Original comment by "van den Bosch" (SF user: sedibald):

This patch allows for the interpolation of 1D complex arrays by means of cubic splines. The abscissaes of the array must be real. It contains 4 programs:

  • spline_f2 : which computes the second derivatives of f at each ascissa x
  • splinterp1D_point : which interpolates f at the real abscissa x_i
  • splinterp1D_array : which interpolates f at the real array of abscissa x_i

These three programs are grouped in splinterp1D.cpp and splinterp1D.h. The natural condition (i.e. f2(0) = f2(toEnd) = 0.0) at both ends is assumed. The extension to allow user to choose f2 or f1 at both ends is straightforward, and will be done if needed.

  • test_interp.cpp : a simple routine for testing the interpolation. One can easily change the function generating the array.