Stan  2.14.0
probability, sampling & optimization
expression.hpp
Go to the documentation of this file.
1 #ifndef STAN_LANG_AST_NODE_EXPRESSION_HPP
2 #define STAN_LANG_AST_NODE_EXPRESSION_HPP
3 
5 
6 // #include <stan/lang/ast/node/nil.hpp>
7 // #include <stan/lang/ast/node/int_literal.hpp>
8 // #include <stan/lang/ast/node/double_literal.hpp>
9 // #include <stan/lang/ast/node/array_expr.hpp>
10 // #include <stan/lang/ast/node/variable.hpp>
11 // #include <stan/lang/ast/node/fun.hpp>
12 // #include <stan/lang/ast/node/integrate_ode.hpp>
13 // #include <stan/lang/ast/node/integrate_ode_control.hpp>
14 // #include <stan/lang/ast/node/index_op.hpp>
15 // #include <stan/lang/ast/node/index_op_sliced.hpp>
16 // #include <stan/lang/ast/node/conditional_op.hpp>
17 // #include <stan/lang/ast/node/binary_op.hpp>
18 // #include <stan/lang/ast/node/unary_op.hpp>
19 
20 #include <boost/variant/recursive_variant.hpp>
21 #include <string>
22 #include <vector>
23 
24 namespace stan {
25  namespace lang {
26 
27  struct nil;
28  struct int_literal;
29  struct double_literal;
30  struct array_expr;
31  struct variable;
32  struct fun;
33  struct integrate_ode;
34  struct integrate_ode_control;
35  struct index_op;
36  struct index_op_sliced;
37  struct conditional_op;
38  struct binary_op;
39  struct unary_op;
40 
41  struct expression {
42  typedef boost::variant<boost::recursive_wrapper<nil>,
43  boost::recursive_wrapper<int_literal>,
44  boost::recursive_wrapper<double_literal>,
45  boost::recursive_wrapper<array_expr>,
46  boost::recursive_wrapper<variable>,
47  boost::recursive_wrapper<integrate_ode>,
48  boost::recursive_wrapper<integrate_ode_control>,
49  boost::recursive_wrapper<fun>,
50  boost::recursive_wrapper<index_op>,
51  boost::recursive_wrapper<index_op_sliced>,
52  boost::recursive_wrapper<conditional_op>,
53  boost::recursive_wrapper<binary_op>,
54  boost::recursive_wrapper<unary_op> >
56 
57  expression();
58  expression(const expression& e);
59 
60  // template <typename Expr> expression(const Expr& expr);
61  expression(const nil& expr); // NOLINT(runtime/explicit)
62  expression(const int_literal& expr); // NOLINT(runtime/explicit)
63  expression(const double_literal& expr); // NOLINT(runtime/explicit)
64  expression(const array_expr& expr); // NOLINT(runtime/explicit)
65  expression(const variable& expr); // NOLINT(runtime/explicit)
66  expression(const fun& expr); // NOLINT(runtime/explicit)
67  expression(const integrate_ode& expr); // NOLINT(runtime/explicit)
68  expression(const integrate_ode_control& expr); // NOLINT
69  expression(const index_op& expr); // NOLINT(runtime/explicit)
70  expression(const index_op_sliced& expr); // NOLINT(runtime/explicit)
71  expression(const conditional_op& expr); // NOLINT(runtime/explicit)
72  expression(const binary_op& expr); // NOLINT(runtime/explicit)
73  expression(const unary_op& expr); // NOLINT(runtime/explicit)
74  expression(const expression_t& expr_); // NOLINT(runtime/explicit)
75 
76  expr_type expression_type() const;
77  int total_dims() const;
78 
79  expression& operator+=(const expression& rhs);
80  expression& operator-=(const expression& rhs);
81  expression& operator*=(const expression& rhs);
82  expression& operator/=(const expression& rhs);
83 
85  };
86 
87  }
88 }
89 #endif
expression & operator-=(const expression &rhs)
Node for holding a double literal.
Probability, optimization and sampling library.
Structure to hold an array expression.
Definition: array_expr.hpp:17
Structure for an indexed expression.
Definition: index_op.hpp:14
Structure for function application.
Definition: fun.hpp:17
Structure of the type of an expression, which consists of a base type and a number of dimensions...
Definition: expr_type.hpp:14
Structure for integrate diff eq statement.
expr_type expression_type() const
expression & operator*=(const expression &rhs)
expression & operator+=(const expression &rhs)
boost::variant< boost::recursive_wrapper< nil >, boost::recursive_wrapper< int_literal >, boost::recursive_wrapper< double_literal >, boost::recursive_wrapper< array_expr >, boost::recursive_wrapper< variable >, boost::recursive_wrapper< integrate_ode >, boost::recursive_wrapper< integrate_ode_control >, boost::recursive_wrapper< fun >, boost::recursive_wrapper< index_op >, boost::recursive_wrapper< index_op_sliced >, boost::recursive_wrapper< conditional_op >, boost::recursive_wrapper< binary_op >, boost::recursive_wrapper< unary_op > > expression_t
Definition: expression.hpp:55
AST structure for holding an expression with a sequence of indexes.
Structure for the conditional operator.
Structure to hold a variable.
Definition: variable.hpp:14
AST structure for unary operations consisting of an operation and argument.
Definition: unary_op.hpp:14
Node for storing binary operations consisting of an operation and left and right arguments.
Definition: binary_op.hpp:15
The nil structure used as a placeholder for undefined or empty values in several structures.
Definition: nil.hpp:11
expression & operator/=(const expression &rhs)
Structure for a diff eq integration statement with control parameters for the integrator.

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