@@ -454,20 +454,13 @@ inline static void run_integration_test(const char* name, deglib::Metric metric,
454454 const uint32_t additional_swap_tries = 0 ;
455455 const uint32_t thread_count = 1 ;
456456
457- // Compute byte size per vector based on metric type
458- size_t feature_bytes;
459- if (metric == deglib::Metric::FP16InnerProduct)
460- feature_bytes = dim * sizeof (uint16_t );
461- else if (metric == deglib::Metric::EVPInnerProduct)
462- feature_bytes = 2 * (dim / 8 );
463- else
464- feature_bytes = (static_cast <int >(metric) & 0x10 ) ? dim * sizeof (uint8_t ) : dim * sizeof (float );
465-
466457 // Build DEG Graph using the specified metric feature space
467458 const deglib::FloatSpace feature_space = dist_variant.has_value ()
468459 ? deglib::FloatSpace (dim, metric, dist_variant.value ())
469460 : deglib::FloatSpace (dim, metric);
470461
462+ const size_t feature_bytes = feature_space.get_data_size ();
463+
471464 deglib::graph::SizeBoundedGraph graph (static_cast <uint32_t >(base_count), edges_per_vertex,
472465 std::move (feature_space));
473466
@@ -587,7 +580,7 @@ inline static void run_builder_integration_test(const char* name, deglib::Metric
587580 std::optional<deglib::DistanceVariant> dist_variant,
588581 deglib::builder::OptimizationTarget optimization_target)
589582{
590- if (static_cast < int >( metric) & 0x10 )
583+ if (metric. get_data_type () == deglib::MetricDataType::Uint8 )
591584 {
592585 // uint8 metric
593586 std::vector<uint8_t > base_data;
@@ -678,20 +671,13 @@ inline static void run_regression_test(const char* name, deglib::Metric metric,
678671 const uint32_t additional_swap_tries = 0 ;
679672 const uint32_t thread_count = 1 ;
680673
681- // Compute byte size per vector based on metric type
682- size_t feature_bytes;
683- if (metric == deglib::Metric::FP16InnerProduct)
684- feature_bytes = dim * sizeof (uint16_t );
685- else if (metric == deglib::Metric::EVPInnerProduct)
686- feature_bytes = 2 * (dim / 8 );
687- else
688- feature_bytes = (static_cast <int >(metric) & 0x10 ) ? dim * sizeof (uint8_t ) : dim * sizeof (float );
689-
690674 // Build DEG Graph using the specified metric feature space
691675 const deglib::FloatSpace feature_space = dist_variant.has_value ()
692676 ? deglib::FloatSpace (dim, metric, dist_variant.value ())
693677 : deglib::FloatSpace (dim, metric);
694678
679+ const size_t feature_bytes = feature_space.get_data_size ();
680+
695681 deglib::graph::SizeBoundedGraph graph (static_cast <uint32_t >(base_count), edges_per_vertex,
696682 std::move (feature_space));
697683
0 commit comments