npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
matrixIndexPairs.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_MATRIXINDEXPAIRS_HH_
2 #define NPSTAT_MATRIXINDEXPAIRS_HH_
3 
4 /*!
5 // \file matrixIndexPairs.hh
6 //
7 // \brief Utility for enumerating pairs on diagonals of symmetric matrices
8 //
9 // Author: I. Volobouev
10 //
11 // July 2018
12 */
13 
14 #include <vector>
15 #include <utility>
16 
17 namespace npstat {
18  typedef std::pair<unsigned,unsigned> UUPair;
19 
20  /*
21  // This function will collect all index pairs (i, j) on the main
22  // diagonal of a square matrix and above (therefore, i <= j), with
23  // "nDiagonalsToUse" diagonals included in the result. Naturally,
24  // "nDiagonalsToUse" argument must not exceed "nRows". The (0, 0) pair
25  // will be excluded from the result in case "remove00" argument is "true".
26  // If "addAllZeroPairs" argument is "true", all pairs of type (0, j)
27  // will be added as well (the inclusion of the (0, 0) pair is still
28  // governed by the "remove00" argument).
29  //
30  // This function is expected to be useful in some scenarios involving
31  // symmetric matrices.
32  */
33  std::vector<UUPair> matrixIndexPairs(unsigned nDiagonalsToUse,
34  unsigned nRows, bool remove00=false,
35  bool addAllZeroPairs=false);
36 }
37 
38 #endif // NPSTAT_MATRIXINDEXPAIRS_HH_
Definition: AbsArrayProjector.hh:14