cInterpol is a python extension for optimized interpolation of data series where one for each data point knows a fixed number of derivatives (currently supported number of derivates are 0, 1, 2).
It provides a close to 6 orders of magnitude faster (albeit less general)
version of scipy.interpolate.PiecewisePolynomial
(my Core i7-3770K give ~800 000x speed-up).
See examples/perf.py for a quick head-on benchmark between those two (expect a runtime on the order of half a minute). The performance is achieved through the use of multithreaded (OpenMP) C routines (wrapped using Cython).
The formulae for the coefficients are generated using Sympy, and can in theory be modified quite easily. (relevant files: model.py, codeexport.py, *_template.*)
Feel free to enhance modify and make pull request at github.
Example using pip (modify to your own needs):
pip install --user --upgrade -r https://raw.github.com/bjodah/cinterpol/master/requirements.txt
pip install --user --upgrade https://github.com/bjodah/cinterpol/archive/v0.3.3.tar.gz
- Manual installation:
- Clone repository
git clone https://github.com/bjodah/cinterpol.git
- Install dependencies
cd cinterpol; pip install --user --upgrade -r requirements.txt
- To install run
python setup.py install --user
orsudo python setup.py install
.
- Clone repository
See distutils' documentation_ for more options. .. _documentation: http://docs.python.org/2/library/distutils.html
Note that the behaviour of setup(...)
is modified slightly through the use of "CleverExtension" from pycompilation.
Run py.test
if py.test is installed on your system.
Elsewise: cd cInterpol/tests/; make
See examples/perf.py, as of SciPy 0.11 you should expect about 5 orders of magnitude speed-up.
- Python
- NumPy
- Cython >= v0.19.1
- Sympy
- pycompilation >= v0.2.9
Some templates unnecessarily rerendered during setup. Add monotonic interpolator Add cubic splines (+monotone)
There is a git subtree under cInterpol, update through: git subtree --prefix cInterpol/newton_interval pull newton_interval master where the repo "newton_interval" is https://github.com/bjodah/newton_interval.git
Open Source. Released under the very permissive "simplified (2-clause) BSD license". See LICENSE.txt for further details.
Björn Dahlgren, contact (gmail adress): bjodah