#pragma once #include "bark.h" #include #include #define ABS_TOL 0.001f typedef std::vector logit_sequence; typedef std::vector> logit_matrix; /* Comparison utils */ template inline bool all_equal(std::vector s1, std::vector s2, int * n_violations); template inline bool all_equal( std::vector> s1, std::vector> s2, int * n_violations); template inline bool all_close( std::vector s1, std::vector s2, float * max_violation, int * n_violations); /* Test utils */ bool run_test(std::vector truth, std::vector result); bool run_test(std::vector truth, std::vector result); bool run_test(logit_matrix truth, logit_matrix result); bool run_test(bark_codes truth, bark_codes result); /* Load utils */ template void load_test_data(std::string fname, std::vector& input, std::vector& output); template void load_test_data(std::string fname, std::vector& input, std::vector>& output); void load_test_data(std::string fname, std::vector>& input, std::vector& output); template void load_test_data( std::string fname, std::vector> & input, std::vector> & output); template std::vector> transpose(const std::vector> data) { // this assumes that all inner vectors have the same size and // allocates space for the complete result in advance std::vector> result(data[0].size(), std::vector(data.size())); for (size_t i = 0; i < data[0].size(); i++) for (size_t j = 0; j < data.size(); j++) { result[i][j] = data[j][i]; } return result; }