8
我找不到解释in the documentation或在线任何地方。 '线性'代表什么,它有什么作用?在SciPy中,什么是“线性”插值?
我找不到解释in the documentation或在线任何地方。 '线性'代表什么,它有什么作用?在SciPy中,什么是“线性”插值?
综观scipy/interpolate/interpolate.py
源, slinear
是为了1
if kind in ['zero', 'slinear', 'quadratic', 'cubic']:
order = {'nearest': 0, 'zero': 0,'slinear': 1,
'quadratic': 2, 'cubic': 3}[kind]
kind = 'spline'
一个spline ...
if kind in ('linear', 'nearest'):
# Make a "view" of the y array that is rotated to the interpolation
# axis.
minval = 2
if kind == 'linear':
self._call = self._call_linear
elif kind == 'nearest':
self.x_bds = (x[1:] + x[:-1])/2.0
self._call = self._call_nearest
else:
minval = order + 1
self._call = self._call_spline
self._spline = splmake(x, y, order=order)
由于文档为splmake
状态:
def splmake(xk, yk, order=3, kind='smoothest', conds=None):
"""
Return a representation of a spline given data-points at internal knots
...
你打败了我。我想出了相同的结论。 –
@NilsWerner尽管如果我们两个都不得不求助于源代码,但这是文档不完整的一个很好的指示。 – Hooked
什么时候可以选择'线性'超线性'?一个非常简短的测试显示'线性'更快,并返回相同的结果。 –