MCPcopy Create free account
hub / github.com/VectorDB-NTU/RaBitQ-Library / metric_from_string

Function metric_from_string

python_bindings/bindings_common.hpp:19–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace rabitqlib::python_bindings {
18
19inline rabitqlib::MetricType metric_from_string(const std::string& metric) {
20 if (metric == "l2") {
21 return rabitqlib::METRIC_L2;
22 }
23 if (metric == "ip" || metric == "innerproduct") {
24 return rabitqlib::METRIC_IP;
25 }
26 throw std::invalid_argument("Unsupported metric. Use 'l2' or 'ip'.");
27}
28
29inline std::string metric_to_string(rabitqlib::MetricType metric) {
30 return metric == rabitqlib::METRIC_IP ? "ip" : "l2";

Callers 3

SymqgIndexMethod · 0.85
HnswIndexMethod · 0.85
IvfIndexMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected