00001 00005 #ifndef __UTILS_H__ 00006 #define __UTILS_H__ 00007 00008 #include <string> 00009 #include <map> 00010 #include <set> 00011 #include "linalg.hpp" 00012 00017 namespace utils{ 00019 std::string trim(const std::string& s); 00020 00022 template<typename K, typename V> 00023 bool contains(const std::map<K,V>& m, K thing); 00025 template<typename E> 00026 bool contains(const std::set<E>& s, E thing); 00027 00029 template<typename E> 00030 bool includes(const std::set<E>& s1, const std::set<E>& s2); 00031 00033 linalg::matrix read_matrix(std::string filename); 00035 linalg::vector read_vector(std::string filename); 00036 00042 std::map<linalg::point, double> read_pd_map(std::string filename); 00043 00045 void show_exception(error_handling::error exc); 00046 00047 } 00048 00049 #endif