npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
EigenParameters.hh
Go to the documentation of this file.
1 #ifndef EMSUNFOLD_EIGENPARAMETERS_HH_
2 #define EMSUNFOLD_EIGENPARAMETERS_HH_
3 
4 /*!
5 // \file EigenParameters.hh
6 //
7 // \brief Parameters specifying how to search for eigenvalues/eigenvectors
8 // of covariance matrices using TRLAN
9 //
10 // Author: I. Volobouev
11 //
12 // July 2014
13 */
14 
15 #include <iostream>
16 
17 namespace emsunfold {
18  /** Main parameters steering TRLAN behavior */
20  {
21  public:
22  /**
23  // This constructor has the following aruments:
24  //
25  // tolerance -- This parameter determines how closely the
26  // eigenvector equation must be satisfied.
27  // If the matrix is A, eigenvalue lambda,
28  // and eigenvector x, the condition is
29  // || A x - lambda x || < tolerance * || A ||,
30  // where || A || stands for the Frobenius
31  // norm of A. If tolerance is 0 or negative,
32  // a reasonable internal default will be used.
33  //
34  // tailFraction -- The code will attempt to determine the largest
35  // eigenvalues of the given covariance matrix.
36  // "tailFraction" is the stopping target: if
37  // the sum of the calculated eigenvalues is
38  // sufficiently close to the matrix trace, the
39  // calculation will stop. "tailFraction" is the
40  // ratio of the sum of eigenvalues not calculated
41  // to the matrix trace.
42  //
43  // This cutoff affects entropy-based calculation
44  // of the number of degrees of freedom (NDoF) for
45  // covariance matrices. The relative precision
46  // of NDoF calculation for an N x N matrix will
47  // be roughly -tailFraction*log(tailFraction/N).
48  //
49  // increaseRate -- The code will increase the number of
50  // calculated eigenpairs gradually, starting from
51  // "minEigenvalues". This is the factor by which
52  // the number of calculated eigenpairs is
53  // increased during each subsequent attempt
54  // to satisfy the "tailFraction" criterion.
55  // This argument should probably be somewhere
56  // between 1.1 and 1.5.
57  //
58  // minEigenvalues -- The minimum number of eigenpairs to calculate.
59  //
60  // maxEigenvalues -- The code will not attempt to calculate more
61  // eigenpairs than "maxEigenvalues" even if the
62  // "tailFraction" target is not satisfied.
63  //
64  // lanczosBasisSize -- The size of the Lanczos basis. In principle,
65  // the larger the basis size, the better the
66  // algorithm will perform. It appears that making
67  // the basis size twice larger than the number
68  // of requested eigenpairs works really well.
69  // The main limitation is the amount of computer
70  // memory needed to store these basis vectors.
71  // Also, the cost of re-orthogonalization starts
72  // to contribute when the number of vectors
73  // becomes really large. See comments in the TRLAN
74  // user guide for more details about choosing the
75  // value of this parameter.
76  //
77  // Note that "trlanEigensystem" function will
78  // ignore this parameter if it's value is
79  // unacceptably small. In particular, the
80  // basis size will be set to the smaller of
81  // 2*(# of desired eigenvectors) and
82  // (# of desired eigenvectors) + 6.
83  //
84  // restartScheme -- TRLAN restarting scheme: 1, 2, 3, 4, or 5.
85  // See the TRLAN user guide for the meaning
86  // of these arguments.
87  //
88  // maxOperatorCalls -- Hard limit on the number of matrix-vector
89  // multiplications in a single TRLAN run. The
90  // TRLAN user guide suggests 1000 per eigenvalue
91  // found (so something like 1000*maxEigenvalues).
92  */
93  EigenParameters(double tolerance, double tailFraction,
94  double increaseRate, int minEigenvalues,
95  int maxEigenvalues, int lanczosBasisSize,
96  int restartScheme, int maxOperatorCalls);
97 
98  //@{
99  /** A simple inspector of object properties */
100  inline double tolerance() const {return tol_;}
101  inline double tailFraction() const {return tailFraction_;}
102  inline double increaseRate() const {return increaseRate_;}
103  inline int minEigenvalues() const {return minEigenvalues_;}
104  inline int maxEigenvalues() const {return maxEigenvalues_;}
105  inline int lanczosBasisSize() const {return maxlan_;}
106  inline int restartScheme() const {return restartScheme_;}
107  inline int maxOperatorCalls() const {return maxmv_;}
108  //@}
109 
110  private:
111  double tol_;
112  double tailFraction_;
113  double increaseRate_;
114  int minEigenvalues_;
115  int maxEigenvalues_;
116  int maxlan_;
117  int restartScheme_;
118  int maxmv_;
119  };
120 }
121 
122 std::ostream& operator<<(std::ostream& os, const emsunfold::EigenParameters& p);
123 
124 #include "npstat/emsunfold/EigenParameters.icc"
125 
126 #endif // EMSUNFOLD_EIGENPARAMETERS_HH_
Definition: EigenParameters.hh:20
EigenParameters(double tolerance, double tailFraction, double increaseRate, int minEigenvalues, int maxEigenvalues, int lanczosBasisSize, int restartScheme, int maxOperatorCalls)
double tolerance() const
Definition: EigenParameters.hh:100
Definition: AbsSparseUnfoldingFilterND.hh:25