| 317 | ///Templates for turning vectors (1D-matrices) into strings |
| 318 | template <class T> |
| 319 | std::string vec_to_string(const std::vector<T>& a, const char* fmt) { |
| 320 | if (a.size() < 1) return {""}; |
| 321 | std::stringstream out; |
| 322 | out << "[ " << format(fmt, a[0]); |
| 323 | for (size_t j = 1; j < a.size(); j++) { |
| 324 | out << ", " << format(fmt, a[j]); |
| 325 | } |
| 326 | out << " ]"; |
| 327 | return out.str(); |
| 328 | }; |
| 329 | template <class T> |
| 330 | std::string vec_to_string(const std::vector<T>& a) { |
| 331 | return vec_to_string(std::vector<double>(a.begin(), a.end()), stdFmt); |
no test coverage detected