/* void InterPolynomial::check(Vector Base, double (*f)( Vector ) ) { int i,n=sz(); double r, bound; for (i=0; i<n; i++) { r=(*f)(NewtonPoints[i]+Base); bound=(*this)(NewtonPoints[i]); if ((condorAbs(bound-r)>1e-15)&&(condorAbs(bound-r)>1e-3*condorAbs(bound))) { printf("error\n"); test(); } // for (j=0; j<n; j++) // r=poly.NewtonBasis[j](poly.NewtonPoints[i]); } } void InterPolynomial::test() { unsigned i,j,n=d->n; Matrix M(n,n); double **m=M; for (i=0; i<n; i++) for (j=0; j<n; j++) m[i][j]=NewtonBasis[i](NewtonPoints[j]); M.print(); }; */ void InterPolynomial::replace(int t, Vector pointToAdd, double valueF) { //not tested updateM(pointToAdd, valueF); if (t<0) return; Vector *xx=NewtonPoints; Polynomial *pp=NewtonBasis, t1; int i, N=nPtsUsed; double t2=(pp[t]( pointToAdd )); if (t2==0) return; t1=pp[t]/=t2; for (i=0; i<t; i++) pp[i]-= pp[i]( pointToAdd )*t1; for (i=t+1; i<N; i++) pp[i]-= pp[i]( pointToAdd )*t1; xx[t].copyFrom(pointToAdd); // update the coefficents of general poly. valueF-=(*this)(pointToAdd); if (condorAbs(valueF)>1e-11) (*this)+=valueF*pp[t]; // test(); }
void test_updateM() { byte results[] = {3, 4, 3, 3}; uint b = 2; Hyperloglog *hll = create_hll(b, 0); uint64_t digest; for (uint32_t i = 0; i < 10; i++) { digest = MurmurHash64A(&i, 4, 42); updateM(hll, digest); } assert_array_eq(results, hll->M, hll->m, byte); free(hll); }
void Spline::addP(Vector2d p, int i) { m_p.insert(m_p.begin()+i+1, p); updateM(); }
void Spline::addP(Vector2d p) { m_p.push_back(p); updateM(); }