Quantcast
Channel: Math.NET Numerics
Viewing all articles
Browse latest Browse all 971

New Post: Convenience interpolators

$
0
0
I defined a convenience interpolator as an interpolation algorithm wrapped in a transform function. These interpolators follow this template:
class WrappedInterpolator
{
     Func<double,double> _func;
     Func<double,double> _inverse; 
     IIntepolation _underlyingInterp; 
     Func<IEnumerable<double>, IEnumerable<double>, IIntepolation> _interpCreator;

     WrappedInterpolator(IEnumerable<double> sampleX, IEnumerable<double> sampleY)
     {
          var transformY = sampleY.Select(i => _func(i));
          _underlyingInterp = _interpCreator(sampleX, transformY);
     }

     double Interpolate(double t)
     {
            return _inverse(_underlyingInterp(t));
     }
 }
An example would be the LogLinear interpolator.

Do you want to add this to the framework?

Viewing all articles
Browse latest Browse all 971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>