| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
matrix_vari.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_CORE_MATRIX_VARI_HPP
2 #define STAN_MATH_REV_CORE_MATRIX_VARI_HPP
3
4 #include <stan/math/rev/mat/fun/Eigen_NumTraits.hpp>
5 #include <stan/math/prim/mat/fun/Eigen.hpp>
6 #include <stan/math/rev/core/var.hpp>
7 #include <stan/math/rev/core/vari.hpp>
8
9 namespace stan {
10 namespace math {
11
12 class op_matrix_vari : public vari {
13 protected:
14 const size_t size_;
15 vari** vis_;
16 public:
17 template <int R, int C>
18 op_matrix_vari(double f,
19 const Eigen::Matrix<stan::math::var, R, C>& vs) :
20 vari(f),
21 size_(vs.size()) {
22 vis_ = reinterpret_cast<vari**>
23 (operator new(sizeof(vari*) * vs.size()));
24 for (int i = 0; i < vs.size(); ++i)
25 vis_[i] = vs(i).vi_;
26 }
27 vari* operator[](size_t n) const {
28 return vis_[n];
29 }
30 size_t size() {
31 return size_;
32 }
33 };
34
35 }
36 }
37 #endif
vari.hpp
Eigen_NumTraits.hpp
stan::math::vari
The variable implementation base class.
Definition: vari.hpp:28
stan::math::op_matrix_vari::operator[]
vari * operator[](size_t n) const
Definition: matrix_vari.hpp:27
stan::math::op_matrix_vari::op_matrix_vari
op_matrix_vari(double f, const Eigen::Matrix< stan::math::var, R, C > &vs)
Definition: matrix_vari.hpp:18
stan::math::op_matrix_vari::vis_
vari ** vis_
Definition: matrix_vari.hpp:15
var.hpp
Eigen.hpp
stan::math::op_matrix_vari::size
size_t size()
Definition: matrix_vari.hpp:30
stan::math::op_matrix_vari
Definition: matrix_vari.hpp:12
stan::math::op_matrix_vari::size_
const size_t size_
Definition: matrix_vari.hpp:14

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