c++ Hermite interpolation algorithm in Boost

为君一笑 提交于 2019-12-11 08:48:38

问题


I'm trying to use Boost c++ library for Hermite interpolation, but it's not well documented and I'm not well understand.

My case is to calculate y values at some x position from data points such as:

X: 0.9, 1.7, 2.55, 3.39...
Y: 0.9, 0.8, 0.85, 0.84...

And get result with equal x spaces (x space 0.5):

X: 0.5, 1.00, 1.5, 2.00, 2.5, 3.0,...
Y: 0.8, 0.95, 0.8, 0.85, 0.9, 0.9,...

Can boost be helpful for me? I had found more implementations of Hermite in web, but examples and it's result output was not what I'm looking for. I think thats because I don't understand how it works. When I read about Hermite I tought that algorithm should ask for some points, spacing value and might few other input values and then calculate and return new points, but I was wrong and now lost..

http://www.boost.org/doc/libs/1_47_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_poly/hermite.html

Maybe someone has experience using Hermite and had similar case?


回答1:


Well, first of all, Hermite was a prolific mathematician, so Hermite polynomials (an orthogonal family) are unrelated to Hermite interpolating polynomials that arise in the interpolation method.

Second, Hermite interpolation is applied when you have values of first few function derivatives as well as function values at each point, so it's not really applicable in your case.

In Boost specifically, I could find only this algorithm for non-uniform interpolation: http://www.boost.org/doc/libs/1_65_0/libs/math/doc/html/math_toolkit/interpolate/barycentric.html —hopefully it is good enough for your purposes.




回答2:


Boost provides barycentric rational interpolation for non-uniform spaced interpolation. This change landed in 1.65, so it's fairly new and you might have to update your boost. If you need uniform spacing and derivatives, evaluate this interpolant and equal spaced points and use the cubic_b_spline interpolation.



来源:https://stackoverflow.com/questions/46440399/c-hermite-interpolation-algorithm-in-boost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!