/* VERTWT.C: returns a probability weight for each vertex of the hypercube * containing a point to be interpolated such that the weighted * average (expectation) of the vertices equals the point to be * interpolated. Used in interpolate.c and interp.c * * Input vectors: * * indx: a dx1 vector of indices (i1,i2,...,id) where ij is 0 or 1, * with 0 being the lower bound in dimension j, and 1 being the * upper bound in that dimension * * wts: a dx1 vector if wts (w1,w2,...,wd) each in the unit interval * such that if xj is the jth coordinate of the point x to be * interpolated, then xj=wj*ubnd(j)+(1-wj)*lbnd(j), where * lbnd(j) is the smaller value of the jth component of the * hypercube containing x and ubnd(j) is the larger value of the * hypercube containing x, i.e. * * lbnd(j) <= xj <= ubnd(j), j=1,...,d * * * John Rust, University of Maryland, June 2005 */ double vertwt(double *wts,int *indx,int d) { double wt; int i; wt=1.0; for (i=0; i