Automatic Differentiation
 
Loading...
Searching...
No Matches
get.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_GET_HPP
2#define STAN_MATH_PRIM_FUN_GET_HPP
3
6#include <cmath>
7#include <cstddef>
8#include <cstdlib>
9#include <vector>
10
11namespace stan {
12
22template <typename T, typename = require_stan_scalar_t<T>>
23inline T get(const T& x, size_t n) {
24 return x;
25}
26
34template <typename T>
35inline T get(const std::vector<T>& x, size_t n) {
36 return x[n];
37}
38
46template <typename T, typename = require_eigen_t<T>>
47inline scalar_type_t<T> get(const T& m, size_t n) {
48 return m(static_cast<int>(n));
49}
50
51} // namespace stan
52#endif
T get(const T &x, size_t n)
Returns the provided element.
Definition get.hpp:23
typename scalar_type< T >::type scalar_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...