45 #ifndef CLIPPER_MAP_UTILS
46 #define CLIPPER_MAP_UTILS
66 template<
class M>
Map_stats(
const M& map );
73 ftype mean_, std_dev_, min_, max_;
95 template<
class M>
static void sort_increasing(
const M& map, std::vector<int>& index );
97 template<
class M>
static void sort_decreasing(
const M& map, std::vector<int>& index );
100 template<
class M>
class Compare_density {
102 Compare_density(
const M& m ) { p = &m; }
103 bool operator() (
const int& i1,
const int& i2 )
const {
return p->get_data(i1) < p->get_data(i2); }
116 ftype64 w, x, s, sx, sxx;
120 for (
typename M::Map_reference_index im = map.first();
121 !im.last(); im.next() ) {
122 w = 1.0 / ftype64( map.multiplicity( im.coord() ) );
123 x = ftype64( map[im] );
128 if ( x < min_ ) min_ = x;
129 if ( x > max_ ) max_ = x;
135 std_dev_ = sqrt( sxx - sx*sx );