@@ -550,47 +550,5 @@ TEMPLATE_TEST_CASE("DDSketch serialize - deserialize test", "[ddsketch][random]"
550550 ss.clear ();
551551
552552 }
553-
554-
555- }
556-
557- TEST_CASE (" quantile" , " [ddsketch]" ) {
558- DDSketch<CollapsingLowestDenseStore<8 , A>, LinearlyInterpolatedMapping> sk (0.01 );
559- std::random_device rd{};
560- std::mt19937_64 gen{rd ()};
561- // std::normal_distribution<double> d(0.0, 1.0);
562- std::exponential_distribution<double > d (1.5 );
563- int sample_size = 10000000 ;
564-
565- std::vector<double > values;
566-
567- tdigest<double , A> td (100 );
568- DDSketch<CollapsingLowestDenseStore<4096 , A>, LogarithmicMapping> ddsketch (0.001 );
569- DDSketch<SparseStore<A>, LogarithmicMapping> sparse_sk (0.01 );
570- for (size_t i = 0 ; i < sample_size; ++i) {
571- double val = d (gen);
572- values.push_back (val);
573- ddsketch.update (val);
574- sparse_sk.update (val);
575- td.update (val);
576- }
577-
578- std::sort (values.begin (), values.end ());
579-
580-
581- std::cout << ddsketch.to_string ();
582- std::cout << std::endl;
583- std::cout << sparse_sk.to_string ();
584- std::cout << std::endl;
585- std::cout << td.to_string ();
586-
587- std::cout << std::setprecision (20 ) << std::fixed;
588- for (double q = 0.0 ; q <= 1.00 ; q += 0.01 ) {
589- const double true_q = values[(sample_size-1 ) * q];
590- const double ddsketch_est = std::abs (true_q - ddsketch.get_quantile (q)) / true_q;
591- const double tdigest_est = std::abs (true_q - td.get_quantile (q)) / true_q;
592- std::cout << q << " " << ddsketch_est << " " << tdigest_est << std::endl;
593- // std::cout << std::setw(4) << q << " " << values[(sample_size-1) * q] << " " << std::setw(15) << ddsketch.get_quantile(q) << " " << std::setw(15) << sparse_sk.get_quantile(q) << " " << std::setw(15) << td.get_quantile(q) << " " << std::endl;
594- }
595553}
596554} /* namespace datasketches */
0 commit comments