MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / compare_flat

Function compare_flat

tests/test_e2e_pcs.cpp:82–106  ·  view source on GitHub ↗

Compare raw flat data (same byte layout between Python and C++)

Source from the content-addressed store, hash-verified

80
81// Compare raw flat data (same byte layout between Python and C++)
82static metric_row compare_flat(const char * stage, const char * label,
83 const std::string & cpp_path,
84 const std::string & ref_path,
85 float atol) {
86 auto cpp = load_ref_f32(cpp_path);
87 auto ref = load_ref_f32(ref_path);
88 metric_row m;
89 m.stage = stage;
90 m.name = label;
91 m.tolerance = atol;
92 if (cpp.data.empty() || ref.data.empty()) {
93 fprintf(stderr, " [SKIP] %s (cpp=%s ref=%s)\n", label,
94 cpp.data.empty() ? "missing" : "ok",
95 ref.data.empty() ? "missing" : "ok");
96 return m;
97 }
98 std::string s;
99 for (size_t i = 0; i < ref.shape.size(); ++i) {
100 if (i > 0) s += ",";
101 s += std::to_string(ref.shape[i]);
102 }
103 m.shape_str = s;
104 int n = std::min(cpp.numel(), ref.numel());
105 return compute_full_metrics(cpp.data.data(), ref.data.data(), n, atol);
106}
107
108int main(int argc, char ** argv) {
109 if (argc < 3) {

Callers 1

mainFunction · 0.85

Calls 3

load_ref_f32Function · 0.85
compute_full_metricsFunction · 0.70
numelMethod · 0.45

Tested by

no test coverage detected