Stan Math Library
2.8.0
reverse mode automatic differentiation
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Groups
stan
math
prim
mat
fun
array_builder.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_PRIM_MAT_FUN_ARRAY_BUILDER_HPP
2
#define STAN_MATH_PRIM_MAT_FUN_ARRAY_BUILDER_HPP
3
4
#include <
stan/math/prim/mat/fun/promoter.hpp
>
5
#include <vector>
6
7
namespace
stan {
8
namespace
math {
9
15
template
<
typename
T>
16
struct
array_builder
{
17
std::vector<T>
x_
;
18
array_builder
() :
x_
() { }
19
template
<
typename
F>
20
array_builder
&
add
(
const
F& u) {
21
T t;
22
promoter<F, T>::promote
(u, t);
23
x_
.push_back(t);
24
return
*
this
;
25
}
26
std::vector<T>
array
() {
27
return
x_
;
28
}
29
};
30
31
}
32
}
33
#endif
stan::math::array_builder::x_
std::vector< T > x_
Definition:
array_builder.hpp:17
stan::math::array_builder::array
std::vector< T > array()
Definition:
array_builder.hpp:26
stan::math::array_builder::add
array_builder & add(const F &u)
Definition:
array_builder.hpp:20
stan::math::array_builder::array_builder
array_builder()
Definition:
array_builder.hpp:18
promoter.hpp
stan::math::array_builder
Structure for building up arrays in an expression (rather than in statements) using an argumentchaini...
Definition:
array_builder.hpp:16
stan::math::promoter::promote
static void promote(const F &u, T &t)
Definition:
promoter.hpp:15
[
Stan Home Page
]
© 2011–2015, Stan Development Team.