#include #include #include //From http://www.richelbilderbeek.nl/CppRescale.htm const std::vector > Rescale( std::vector > v, const double newMin, const double newMax) { const double oldMin = MinElement(v); const double oldMax = MaxElement(v); typedef std::vector >::iterator RowIter; RowIter y = v.begin(); const RowIter maxy = v.end(); for ( ; y!=maxy; ++y) { typedef std::vector::iterator ColIter; ColIter x = y->begin(); const ColIter maxx = y->end(); for ( ; x!=maxx; ++x) { *x = Rescale(*x,oldMin,oldMax,newMin,newMax); } } return v; }