MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / compare_vectors

Function compare_vectors

src/include/utils/utils.hpp:250–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248/// \return the number of errors
249template <typename T>
250inline int compare_vectors(buffer<T>& y, buffer<T>& y_ref, int print_errors = 16, float abs_tol = 1e-1, float rel_tol = 1e-1){
251 int total_errors = 0;
252 for (int i = 0; i < y.size(); i++){
253 if (std::abs(y[i] - y_ref[i]) > abs_tol && std::abs(y[i] - y_ref[i]) / std::abs(y_ref[i]) > rel_tol){
254 if (total_errors < print_errors){
255 header_print("err ", "Error: y[" << i << "] = " << y[i] << " != y_ref[" << i << "] = " << y_ref[i]);
256 }
257 total_errors++;
258 }
259 }
260 if (total_errors > 0){
261 header_print("err ", "Total errors: " << total_errors);
262 }
263 return total_errors;
264}
265
266/// \brief print the matrix
267/// \param matrix the matrix

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected