Stan  2.10.0
probability, sampling & optimization
rvalue_at.hpp
Go to the documentation of this file.
1 #ifndef STAN_MODEL_INDEXING_RVALUE_AT_HPP
2 #define STAN_MODEL_INDEXING_RVALUE_AT_HPP
3 
5 
6 namespace stan {
7 
8  namespace model {
9 
10  // relative indexing from 0; multi-indexing and return from 1
11  // no error checking from these methods, just indexing
12 
21  inline int rvalue_at(int n, const index_multi& idx) {
22  return idx.ns_[n];
23  }
24 
33  inline int rvalue_at(int n, const index_omni& idx) {
34  return n + 1;
35  }
36 
47  inline int rvalue_at(int n, const index_min& idx) {
48  return idx.min_ + n;
49  }
50 
61  inline int rvalue_at(int n, const index_max& idx) {
62  return n + 1;
63  }
64 
75  inline int rvalue_at(int n, const index_min_max& idx) {
76  return idx.min_ + n;
77  }
78 
79  }
80 }
81 #endif
Probability, optimization and sampling library.
int rvalue_at(int n, const index_multi &idx)
Return the index in the underlying array corresponding to the specified position in the specified mul...
Definition: rvalue_at.hpp:21
Structure for an indexing consisting of multiple indexes.
Definition: index.hpp:39
Structure for an indexing from a minimum index (inclusive) to a maximum index (inclusive).
Definition: index.hpp:97
Structure for an indexing from a minimum index (inclusive) to the end of a container.
Definition: index.hpp:63
Structure for an indexing that consists of all indexes for a container.
Definition: index.hpp:55
std::vector< int > ns_
Definition: index.hpp:40
Structure for an indexing from the start of a container to a specified maximum index (inclusive)...
Definition: index.hpp:79

     [ Stan Home Page ] © 2011–2016, Stan Development Team.