int main() { double prec; clock_t start, end; ivector x(2); x[1] = interval(-2.0,2.0); x[2] = interval(-2.0,2.0); MinimalSubPaving A; A = new SPMinimalnode(x); // find the image of A with the function // f1 = x1^2 + x2 - x2^2 // f1 = x1^2 + x2^2 cout << "Characterization of the set Sc3=f(A)" << endl << "with f1(x) = x1^2 + x2 - x2^2," << endl << " f2(x) = x1^2 + x2^2," << endl; cout << "by realizing the image of f by ImageSp" << endl; cout << "Enter a precision (between 1 and 0.001): "; cin >> prec; start = clock(); // use Image SP to find a characterisation of the image // of Sc using the function in IVF MinimalSubPaving Sc3 = ImageSp(IVF_ex11_35, A, prec); end = clock(); cout << "Computing time : " << ((static_cast<double>(end - start)) / CLOCKS_PER_SEC) << " s."<< endl; cout << "The volume is " << spVolume(Sc3) << endl; cout << "The number of leaves is " << spLeaves(Sc3) << endl; // To realize a file output of the MinimalSubPaving Sc ofstream os4("new_image.txt"); // Filename os4 << 2 << endl; // Dimension of the MinimalSubPaving os4 << interval(-2.0,2.0) << " " // Domain MinimalSubPaving << interval(-2.0,2.0) << " " << endl; os4 << "Precision is " << prec << endl; // Precision used os4 << Sc3 << endl; // Image MinimalSubPaving itself cout << "The output MinimalSubPaving has been written to new_image.txt" << endl << endl; delete A; delete Sc3; return 0; }
int main() { const uint32_t length = 256; std::vector<Obj4> os4(length), os4d(length); std::vector<Obj8> os8(length), os8d(length); std::vector<Obj16> os16(length), os16d(length); std::vector<Obj32> os32(length), os32d(length); std::vector<Obj64> os64(length), os64d(length); benchmark_fun("obj 4", [&](uint32_t i) { return os4d[i] = os4[i]; }, length); benchmark_fun("obj 8", [&](uint32_t i) { return os8d[i] = os8[i]; }, length); benchmark_fun("obj 16", [&](uint32_t i) { return os16d[i] = os16[i]; }, length); benchmark_fun("obj 32", [&](uint32_t i) { return os32d[i] = os32[i]; }, length); benchmark_fun("obj 64", [&](uint32_t i) { return os64d[i] = os64[i]; }, length); return 0; }