From f5d47edb24d3eba9e4666a37e8d448d1582a6ad2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 6 Apr 2014 01:32:35 +0200 Subject: optimisation to cubic interpolation: remove a basis function by doing an value translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- test/cubic_interpolation | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/cubic_interpolation b/test/cubic_interpolation index 6346547..dac0d99 100755 --- a/test/cubic_interpolation +++ b/test/cubic_interpolation @@ -79,7 +79,7 @@ def interpolate(small, tension = 0): large = [None] * len(small) ** 2 small_, large_ = len(small) - 1, len(large) - 1 # Basis functions - h00 = lambda t : (1 + 2 * t) * (1 - t) ** 2 + #h00 = lambda t : (1 + 2 * t) * (1 - t) ** 2 h10 = lambda t : t * (1 - t) ** 2 h01 = lambda t : t ** 2 * (3 - 2 * t) h11 = lambda t : t ** 2 * (t - 1) @@ -108,7 +108,7 @@ def interpolate(small, tension = 0): # Tangents mj, mk = c_ * tangent(small, j, small_), c_ * tangent(small, k, small_) # Interpolation - large[i] = h00(w) * pj + h10(w) * mj + h01(w) * pk + h11(w) * mk + large[i] = pj + h10(w) * mj + h01(w) * (pk - pj) + h11(w) * mk return large # Plot interpolation -- cgit v1.2.3-70-g09d2