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

Function compare

tests/test_v_cont_removal.cpp:136–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136static bool compare(const std::vector<float>& a, const std::vector<float>& b,
137 const char* label, float tol) {
138 float max_diff = 0;
139 int max_idx = 0;
140 for (size_t i = 0; i < a.size(); i++) {
141 float d = std::fabs(a[i] - b[i]);
142 if (d > max_diff) { max_diff = d; max_idx = (int)i; }
143 }
144 bool ok = max_diff <= tol;
145 fprintf(stderr, " %s [%s]: max_diff=%.8f at [%d] (a=%.6f b=%.6f) (%zu elements)\n",
146 ok ? "PASS" : "FAIL", label, max_diff, max_idx,
147 a[max_idx], b[max_idx], a.size());
148 return ok;
149}
150
151int main() {
152 auto* cpu = ggml_backend_cpu_init();

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected