| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

VectorBuilderHelper.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_META_VECTORBUILDER_HELPER_HPP
2 #define STAN_MATH_PRIM_SCAL_META_VECTORBUILDER_HELPER_HPP
3
4 #include <stan/math/prim/scal/meta/contains_vector.hpp>
5 #include <stdexcept>
6
7 namespace stan {
8
24 template<typename T1, bool used, bool is_vec>
25 class VectorBuilderHelper {
26 public:
27 explicit VectorBuilderHelper(size_t /* n */) { }
28
29 T1& operator[](size_t /* i */) {
30 throw std::logic_error("used is false. this should never be called");
31 }
32
33 typedef T1 type;
34
35 inline type& data() {
36 throw std::logic_error("used is false. this should never be called");
37 }
38 };
39
40 template<typename T1>
41 class VectorBuilderHelper<T1, true, false> {
42 private:
43 T1 x_;
44 public:
45 explicit VectorBuilderHelper(size_t /* n */) : x_(0.0) { }
46 T1& operator[](size_t /* i */) {
47 return x_;
48 }
49
50 typedef T1 type;
51
52 inline type& data() {
53 return x_;
54 }
55 };
56
57 }
58 #endif
stan
Definition: log_sum_exp.hpp:8
stan::VectorBuilderHelper< T1, true, false >::data
type & data()
Definition: VectorBuilderHelper.hpp:52
stan::VectorBuilderHelper::data
type & data()
Definition: VectorBuilderHelper.hpp:35
stan::VectorBuilderHelper::operator[]
T1 & operator[](size_t)
Definition: VectorBuilderHelper.hpp:29
stan::VectorBuilderHelper::type
T1 type
Definition: VectorBuilderHelper.hpp:33
stan::VectorBuilderHelper< T1, true, false >::operator[]
T1 & operator[](size_t)
Definition: VectorBuilderHelper.hpp:46
stan::VectorBuilderHelper
VectorBuilder allocates type T1 values to be used as intermediate values.
Definition: VectorBuilderHelper.hpp:25
contains_vector.hpp
stan::VectorBuilderHelper< T1, true, false >::type
T1 type
Definition: VectorBuilderHelper.hpp:50
stan::VectorBuilderHelper::VectorBuilderHelper
VectorBuilderHelper(size_t)
Definition: VectorBuilderHelper.hpp:27
stan::VectorBuilderHelper< T1, true, false >::VectorBuilderHelper
VectorBuilderHelper(size_t)
Definition: VectorBuilderHelper.hpp:45

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