1 #ifndef STAN_LANG_AST_NODE_INDEX_OP_DEF_HPP 2 #define STAN_LANG_AST_NODE_INDEX_OP_DEF_HPP 3 4 #include <stan/lang/ast.hpp> 5 #include <vector> 6 7 namespace stan { 8 namespace lang { 9 index_op()10index_op::index_op() {} 11 index_op(const expression & expr,const std::vector<std::vector<expression>> & dimss)12index_op::index_op(const expression& expr, 13 const std::vector<std::vector<expression> >& dimss) 14 : expr_(expr), dimss_(dimss) { 15 infer_type(); 16 } 17 infer_type()18void index_op::infer_type() { 19 size_t total = 0U; 20 for (size_t i = 0; i < dimss_.size(); ++i) 21 total += dimss_[i].size(); 22 type_ = infer_type_indexing(expr_.bare_type(), total); 23 } 24 25 } // namespace lang 26 } // namespace stan 27 #endif 28