8 #ifndef IMPSCORE_FUNCTOR_STATISTICAL_H
9 #define IMPSCORE_FUNCTOR_STATISTICAL_H
11 #include <IMP/score_functor/score_functor_config.h>
14 #include "internal/PMFTable.h"
16 IMPSCOREFUNCTOR_BEGIN_NAMESPACE
51 template <
class Key,
bool BIPARTITE,
bool INTERPOLATE,
bool SPARSE=false>
53 internal::PMFTable<BIPARTITE, INTERPOLATE, SPARSE> table_;
65 threshold_(threshold), key_(k){
67 "Constructor can only be used for non-bipartite scores.");
68 table_.template initialize<Key>(data_file);
82 threshold_(threshold), key_(k){
84 "Constructor can only be used for bipartite scores.");
85 table_.template initialize<Key>(data_file);
90 double distance)
const {
91 if (distance >= threshold_ || distance < 0.001) {
96 if (pt==-1 || lt==-1)
return 0;
97 return table_.get_score(pt, lt, distance);
102 double distance)
const {
103 if (distance >= threshold_ || distance < 0.001) {
106 int pt= m->get_attribute(key_, pp[0]);
107 int lt= m->get_attribute(key_, pp[1]);
109 return table_.get_score_with_derivative(pt,
112 double get_maximum_range(
Model *,
113 const base::Array<2, ParticleIndex>& )
const {
114 return std::min(threshold_, table_.get_max());
116 bool get_is_trivially_zero(
Model *m,
117 const base::Array<2, ParticleIndex>& p,
118 double squared_distance)
const {
119 return squared_distance > algebra::get_squared(get_maximum_range(m,p));
123 IMPSCOREFUNCTOR_END_NAMESPACE