IMP logo
IMP Reference Guide  develop.cb6747d2d1,2024/03/28
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-2022 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 #include <boost/scoped_array.hpp>
16 
17 IMPEM_BEGIN_NAMESPACE
18 
19 //! Cross correlation coefficient calculator.
20 /** Store CCC and derivative values and recompute then every X steps.
21  */
22 class IMPEMEXPORT CoarseCCatIntervals : public IMP::Object {
23 
24  public:
25  CoarseCCatIntervals(const int &ncd);
26 
28 
29  //! Evaluate the cross-correlation value only every X calls to the function.
30  /**
31  Evaluates the value of the cross correlation term
32  but only at given intervals to save computation time.
33  Otherwise, the same value is returned.
34  This function has an special behavior, as it
35  does not return the true cross correlation coefficient ccc,
36  but the value: scalefac*(1-ccc)
37 
38  The reason why is to use this term as part of an scoring
39  function that is better the lower the term.
40  If you want the cross correlation coefficient,
41  use cross_correlation_coefficient() instead.
42  \param[in] em_map exp EM map
43  \note correct RMSD and mean MUST be in the header!
44  \param[in] model_map an empty map that will contain the sampled
45 particles in the access_p
46  \param[in] scalefac scale factor to apply to the value of the cross
47 correlation term
48  \param[in] deriv input derivatives (only the size is used)
49  \param[in] lderiv if true, the derivatives of the term are computed
50  \param[in] eval_interval the number of times the function is going to return
51 the same value before computing the values again
52  \return the value of the cross correlation term: scalefac * (1-CCC)
53  and a vector of derivatives
54  */
55  std::pair<double, algebra::Vector3Ds> evaluate(
56  DensityMap *em_map, SampledDensityMap *model_map,
57  const algebra::Vector3Ds &deriv, float scalefac, bool lderiv,
58  unsigned long eval_interval);
59 
61 
62  protected:
63  void allocate_derivatives_array(int ncd);
64  //! Number of times the evaluation has been called.
65  /** The evaluation is only performed the first time and when calls_counter
66  reaches eval_interval. Otherwise the stored_cc_ value is returned */
68  //! Stored correlation value
69  float stored_cc_;
70  //! Stored derivative terms
71  boost::scoped_array<double> stored_dvx_, stored_dvy_, stored_dvz_;
72  // true when memory for the terms storing the derivatives has been assigned
73  bool dv_memory_allocated_;
74 };
75 
76 IMPEM_END_NAMESPACE
77 
78 #endif /* IMPEM_COARSE_CCAT_INTERVALS_H */
Perform coarse fitting between two density objects.
float stored_cc_
Stored correlation value.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Class for handling density maps.
Definition: DensityMap.h:95
Class for sampling a density map from particles.
Common base class for heavy weight IMP objects.
Definition: Object.h:111
boost::scoped_array< double > stored_dvx_
Stored derivative terms.
Cross correlation coefficient calculator.
int calls_counter_
Number of times the evaluation has been called.