index.hpp
Go to the documentation of this file.
1 #ifndef STAN_MODEL_INDEXING_INDEX_HPP
2 #define STAN_MODEL_INDEXING_INDEX_HPP
3 
4 #include <vector>
5 
6 namespace stan {
7 
8  namespace model {
9 
10  // SINGLE INDEXING (reduces dimensionality)
11 
12  /**
13  * Structure for an indexing consisting of a single index.
14  * Applying this index reduces the dimensionality of the container
15  * to which it is applied by one.
16  */
17  struct index_uni {
18  int n_;
19 
20  /**
21  * Construct a single indexing from the specified index.
22  *
23  * @param n single index.
24  */
25  explicit index_uni(int n)
26  : n_(n) {
27  }
28  };
29 
30 
31 
32  // MULTIPLE INDEXING (does not reduce dimensionality)
33 
34 
35  /**
36  * Structure for an indexing consisting of multiple indexes. The
37  * indexes do not need to be unique or in order.
38  */
39  struct index_multi {
40  std::vector<int> ns_;
41 
42  /**
43  * Construct a multiple indexing from the specified indexes.
44  *
45  * @param ns multiple indexes.
46  */
47  explicit index_multi(const std::vector<int>& ns) : ns_(ns) { }
48  };
49 
50 
51  /**
52  * Structure for an indexing that consists of all indexes for a
53  * container. Applying this index is a no-op.
54  */
55  struct index_omni {
56  };
57 
58 
59  /**
60  * Structure for an indexing from a minimum index (inclusive) to
61  * the end of a container.
62  */
63  struct index_min {
64  int min_;
65 
66  /**
67  * Construct an indexing from the specified minimum index (inclusive).
68  *
69  * @param min minimum index (inclusive).
70  */
71  explicit index_min(int min) : min_(min) { }
72  };
73 
74 
75  /**
76  * Structure for an indexing from the start of a container to a
77  * specified maximum index (inclusive).
78  */
79  struct index_max {
80  int max_;
81 
82  /**
83  * Construct an indexing from the start of the container up to
84  * the specified maximum index (inclusive).
85  *
86  * @param max maximum index (inclusive).
87  */
88  explicit index_max(int max) : max_(max) { }
89  };
90 
91 
92 
93  /**
94  * Structure for an indexing from a minimum index (inclusive) to a
95  * maximum index (inclusive).
96  */
97  struct index_min_max {
98  int min_;
99  int max_;
100 
101  /**
102  * Construct an indexing from the specified minimum index
103  * (inclusive) and maximum index (inclusive).
104  *
105  * @param min minimum index (inclusive).
106  * @param max maximum index (inclusive).
107  */
108  explicit index_min_max(int min, int max) : min_(min), max_(max) { }
109  };
110 
111  }
112 }
113 #endif
index_min(int min)
Definition: index.hpp:71
index_max(int max)
Definition: index.hpp:88
static const double ns
Module that plots metrics from reconstructed cosmic ray data.
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
std::vector< int > ns_
Definition: index.hpp:40
index_min_max(int min, int max)
Definition: index.hpp:108
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
const XML_Char XML_Content * model
Definition: expat.h:151
index_multi(const std::vector< int > &ns)
Definition: index.hpp:47