IMP  2.2.0
The Integrative Modeling Platform
CoarseCCatIntervals.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/CoarseCCatIntervals.h
3  * \brief Cross correlation coefficient calculator.
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM_COARSE_CCAT_INTERVALS_H
10 #define IMPEM_COARSE_CCAT_INTERVALS_H
11 
12 #include <IMP/em/em_config.h>
13 #include "CoarseCC.h"
14 #include <vector>
15 
16 IMPEM_BEGIN_NAMESPACE
17 
18 //! Cross correlation coefficient calculator.
19 /** Store CCC and derivative values and recompute then every X steps.
20  */
21 class IMPEMEXPORT CoarseCCatIntervals : public CoarseCC {
22 
23  public:
24  CoarseCCatIntervals(const int &ncd);
25 
27 
28  //! Evaluate the cross-correlation value only every X calls to the function.
29  /**
30  Evaluates the value of the cross correlation term
31  but only at given intervals to save computation time.
32  Otherwise, the same value is returned.
33  This function has an special behavior, as it
34  does not return the true cross correlation coefficient ccc,
35  but the value: scalefac*(1-ccc)
36 
37  The reason why is to use this term as part of an scoring
38  function that is better the lower the term.
39  If you want the cross correlation coefficient,
40  use cross_correlation_coefficient() instead.
41  \param[in] em_map exp EM map
42  \note correct RMSD and mean MUST be in the header!
43  \param[in] model_map an empty map that will contain the sampled
44 particles in the access_p
45  \param[in] scalefac scale factor to apply to the value of the cross
46 correlation term
47  \param[in] deriv input derivatives (only the size is used)
48  \param[in] lderiv if true, the derivatives of the term are computed
49  \param[in] eval_interval the number of times the function is going to return
50 the same value before computing the values again
51  \return the value of the cross correlation term: scalefac * (1-CCC)
52  and a vector of derivatives
53  */
54  std::pair<double, algebra::Vector3Ds> evaluate(
55  DensityMap *em_map, SampledDensityMap *model_map,
56  const algebra::Vector3Ds &deriv, float scalefac, bool lderiv,
57  unsigned long eval_interval);
58 
60 
61  protected:
62  void allocate_derivatives_array(int ncd);
63  //! Number of times the evaluation has been called.
64  /** The evaluation is only performed the first time and when calls_counter
65  reaches eval_interval. Otherwise the stored_cc_ value is returned */
67  //! Stored correlation value
68  float stored_cc_;
69  //! Stored derivative terms
70  double *stored_dvx_, *stored_dvy_, *stored_dvz_;
71  // true when memory for the terms storing the derivatives has been assigned
72  bool dv_memory_allocated_;
73 };
74 
75 IMPEM_END_NAMESPACE
76 
77 #endif /* IMPEM_COARSE_CCAT_INTERVALS_H */
Perform coarse fitting between two density objects.
float stored_cc_
Stored correlation value.
Responsible for performing coarse fitting between two density objects.
Definition: CoarseCC.h:28
Class for handling density maps.
Definition: DensityMap.h:94
Class for sampling a density map from particles.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
double * stored_dvx_
Stored derivative terms.
Cross correlation coefficient calculator.
int calls_counter_
Number of times the evaluation has been called.