﻿ Revised Interpolation Toolkit in Iridium | Christoph Rüegg

The next release of Math.NT Iridium, Iteration 16, comes with a revised interpolation architecture and implementation.

Up to now, the interpolation classes have been a bit awkward to use, partially because of the SampleList collection class you had to use, and because of the design in general. It also provided only two interpolation algorithms, which are both somewhat outdated these days.

The new implementation provides some newer more stable algorithms (like Floater and Hormann's algorithm for pole-free rational interpolation) together with a cleaner design. Additionally, some of the algorithms can also provide the first and second derivative and in the case of splines even a definite integration. There is also a new facade/portal class that reduces building an interpolation to one simple method call. Usually you would just use this facade class to build/precompute an interpolation, but all the algorithms are also publicly available in the Algorithms-namespace, so if you know what you're doing you can use them directly.

Sample code, which uses a pole-free rational barycentric interpolation (the default algorithm) with 5 given sample pairs (t, x(t)):

 1: 2: 3: 4: 5:  double[] t = new double[] { -2, -1, 0, 1, 2}; double[] x = new double[] { 1, 2, -1, 0, 1}; var method = Interpolation.Create(t, x); double res = method.Interpolate(0.5); 

Simple, isn't it?

Unfortunately it was not possible to fit the new design into the old classes, so the new classes and interfaces replace the old classes completely. These old classes are still there for now and continue to work, but they're marked as obsolete and we recommend strongly to upgrade your code base to the new architecture.

The new architecture has already been checked in to the source repository. If you're interested, please have a look at it and provide feedback - it's not released yet so we can still change it completely :).