/** * BInterpolate.java -- Build an interpolating polynomial * * By Bob Jenkins, October 1999 * Permission granted to use, reuse, rewrite this without notifying me. */ // A vector. // Assumes that all vectors are of the same length. public class BInterpolate { BMatrix InterpolationMatrix; double offset; int length; // set up to interpolate "length" evenly spaced values BInterpolate(int length) { this.length = length; this.offset = -length/2.0; this.InterpolationMatrix = makeInterpolationMatrix(length); } // This generates a matrix that lets us quickly find the polynomial // which passes through length consecutive points. The matrix only final BMatrix makeInterpolationMatrix(int length) { BMatrix x = new BMatrix(length); BVector v = new BVector(length); BVector vt = new BVector(length); for (int i=0; i