Mercurial > hg > kwantix
view src/include/utils.hpp @ 40:eaa99e09607d
Remove indentation due to namespace scope
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Fri, 12 Mar 2010 09:21:07 -0600 (2010-03-12) |
parents | bb8a95bf2aa4 |
children | 11395e64852f |
line wrap: on
line source
/*! \file utils.hpp * \brief Defines some miscellaneous functions. * * \file utils.cpp * \brief Implementations and instantiations of the functions and * classes declared in utils.hpp */ #ifndef __UTILS_HPP__ #define __UTILS_HPP__ #include <string> #include <map> #include <set> #include "linalg.hpp" namespace kwantix{ ///Clears whitespace from front and back of string s. std::string trim(const std::string& s); ///Does map m contain thing? template<typename K, typename V> bool contains(const std::map<K,V>& m, K thing); ///Does set s contain thing? template<typename E> bool contains(const std::set<E>& s, E thing); ///Does set s1 include set s2? template<typename E> bool includes(const std::set<E>& s1, const std::set<E>& s2); ///Reads matrices from filenames. kwantix::matrix read_matrix(std::string filename); ///Reads vectors from filenames. kwantix::vector read_vector(std::string filename); /*! \brief Reads map<point,double> from a matrix. * *Last column is the value at each point which is represented in *turn by the rest of the row. */ std::map<kwantix::point, double> read_pd_map(std::string filename); ///Outputs some information about generic exceptions. void show_exception(kwantix::error exc); } #endif