Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
233 views
in Technique[技术] by (71.8m points)

c# - Akima interpolation of an array of doubles

Assuming I have an array of doubles, what's a good algorithm to sample this series using Akima interpolation? I'm too stupid to translate that mathematical description into code.

// values is an array of doubles
// idx is the index of the left-hand value for the current interpolation
// t is the normalized parameter between values[idx] and values[idx+1]
// Don't worry about array bounds, I'll handle that separately.
public double InterpolateAkima(double[] values, int idx, double t)
{
  ...?
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Repost and expansion on my answer to another SO question that was closed as a duplicate of this question - as suggested by a comment on that question.

Akima's original paper: ``A new method of interpolation and smooth curve fitting based on local procedures'', Journal of ACM 17, 4 (1970), 589-602

http://www.leg.ufpr.br/lib/exe/fetch.php/wiki:internas:biblioteca:akima.pdf

C implementation

https://github.com/ampl/gsl/blob/master/interpolation/akima.c

C# implementation

https://gist.github.com/dreikanter/3526685

Delphi implementation (see procedure BuildAkimaSpline in delphi/src/spline3.pas)

http://www.alglib.net/translator/re/alglib-2.6.0.delphi.zip

Akima's Fortran 66 implementation

http://cran.r-project.org/web/packages/akima/

Fortran 90 implementation

http://miyoshi.googlecode.com/svn-history/r72/trunk/common/common.f90

Java implementation

https://commons.apache.org/proper/commons-math/jacoco/org.apache.commons.math3.analysis.interpolation/AkimaSplineInterpolator.java.html

Lisp implementation "for AutoCAD 2d-Polylines"

http://autocad.xarch.at/code/candido/akima.lsp

Matlab implementation

http://www.mathworks.se/matlabcentral/fileexchange/1814-akima-interpolation

Pascal implementation (program description)

http://jean-pierre.moreau.pagesperso-orange.fr/Pascal/akima_pas.txt

Python implementation

http://www.lfd.uci.edu/~gohlke/code/akima.py.html

VB6 implementation (see subroutine BuildAkimaSpline in vb6/src/spline3.bas)

http://www.alglib.net/translator/re/alglib-2.6.0.vb6.zip

http://www.koders.com/cpp/fid1393B9D668316C1700966643DE0609660B9CB13A.aspx?s=%22Brian+Smith%22


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...