int main() { unsigned char b[] = { 0x0f, 0xff, 0xf0, 0xAA, 0x78, 0x11 }; BitVector bv1(b, sizeof(b) / sizeof(*b)); BitVector bv2("10010100111100101010001010010010101"); bv1.print("bv1 before modification"); for (int i = 36; i < bv1.bits(); i++) { bv1.clear(i); } bv1.print("bv1 after modification"); bv2.print("bv2 before modification"); for (int j = bv2.bits()-10; j < bv2.bits(); j++) { bv2.clear(j); } bv2.set(30); bv2.print("bv2 after modification"); bv2.bits(bv2.bits() / 2); bv2.print("bv2 cut in half"); bv2.bits(bv2.bits() + 10); bv2.print("bv2 grown by 10"); BitVector bv3((unsigned char *) 0); return 0; } ///:~
void setUp() { emptyUbs = new UpperBoundSet(); simpleUbs = new UpperBoundSet(); MOLP simpleMOLP; std::vector<double> xVect; BVect bv1(1, 2, xVect); BVect bv2(2, 1, xVect); BEdge be(bv1, bv2); simpleMOLP.push_back(be); simpleUbs->merge(simpleMOLP); bigUbs = new UpperBoundSet(); MOLP m1; BVect bv1m1(2, 17, xVect); BVect bv2m1(3, 15, xVect); BVect bv3m1(5, 14, xVect); BEdge be1m1(bv1m1, bv2m1); BEdge be2m1(bv2m1, bv3m1); m1.push_back(be1m1); m1.push_back(be2m1); MOLP m2; BVect bv1m2(8, 11, xVect); BVect bv2m2(9, 9, xVect); BVect bv3m2(11, 8, xVect); BEdge be1m2(bv1m2, bv2m2); BEdge be2m2(bv2m2, bv3m2); m2.push_back(be1m2); m2.push_back(be2m2); MOLP m3; BVect bv1m3(14, 5, xVect); BVect bv2m3(15, 3, xVect); BVect bv3m3(17, 2, xVect); BEdge be1m3(bv1m3, bv2m3); BEdge be2m3(bv2m3, bv3m3); m3.push_back(be1m3); m3.push_back(be2m3); bigUbs->merge(m1); bigUbs->merge(m2); bigUbs->merge(m3); }
double SimilarityWrapper(const T &bv1,const std::string &pkl,double a,double b, double (*metric)(const T &,const T &,double,double),bool returnDistance){ T bv2(pkl); return SimilarityWrapper(bv1,bv2,a,b,metric,returnDistance); }