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 );
const ftype & min() const
Minimum of map.
Definition: map_utils.h:69
static void sort_increasing(const M &map, std::vector< int > &index)
Sort a list into increasing order.
Definition: map_utils.cpp:57
static void sort_decreasing(const M &map, std::vector< int > &index)
Sort a list into decreasing order.
Definition: map_utils.cpp:66
Range - upper and lower bounds of some type.
Definition: clipper_stats.h:56
const Range range() const
Range.
Definition: map_utils.h:71
ftype64 ftype
ftype definition for floating point representation
Definition: clipper_precision.h:58
const ftype & std_dev() const
Std deviation of map.
Definition: map_utils.h:68
Map_stats()
null constructor
Definition: map_utils.h:65
static bool is_nan(const ftype32 f)
fast Util::nan() test
Definition: clipper_util.h:82
Generic map sorting class.
Definition: map_utils.h:91
Generic map statistics class.
Definition: map_utils.h:62
const ftype & max() const
Maximum of map.
Definition: map_utils.h:70
const ftype & mean() const
Mean of map.
Definition: map_utils.h:67