@@ -34,7 +34,8 @@ class ops_partials_edge<double, var> {
3434 : partial_(0 ), partials_(partial_), operand_(op) {}
3535
3636 private:
37- template <typename , typename , typename , typename , typename , typename >
37+ template <typename , typename , typename , typename , typename , typename ,
38+ typename , typename , typename >
3839 friend class stan ::math::operands_and_partials;
3940 var operand_;
4041 static constexpr int size () noexcept { return 1 ; }
@@ -109,15 +110,22 @@ inline void update_adjoints(StdVec1& x, const Vec2& y, const vari& z) {
109110 * @tparam Op3 type of the third operand
110111 * @tparam Op4 type of the fourth operand
111112 * @tparam Op5 type of the fifth operand
113+ * @tparam Op6 type of the sixth operand
114+ * @tparam Op7 type of the seventh operand
115+ * @tparam Op8 type of the eighth operand
112116 */
113- template <typename Op1, typename Op2, typename Op3, typename Op4, typename Op5>
114- class operands_and_partials <Op1, Op2, Op3, Op4, Op5, var> {
117+ template <typename Op1, typename Op2, typename Op3, typename Op4, typename Op5,
118+ typename Op6, typename Op7, typename Op8>
119+ class operands_and_partials <Op1, Op2, Op3, Op4, Op5, Op6, Op7, Op8, var> {
115120 public:
116121 internal::ops_partials_edge<double , std::decay_t <Op1>> edge1_;
117122 internal::ops_partials_edge<double , std::decay_t <Op2>> edge2_;
118123 internal::ops_partials_edge<double , std::decay_t <Op3>> edge3_;
119124 internal::ops_partials_edge<double , std::decay_t <Op4>> edge4_;
120125 internal::ops_partials_edge<double , std::decay_t <Op5>> edge5_;
126+ internal::ops_partials_edge<double , std::decay_t <Op6>> edge6_;
127+ internal::ops_partials_edge<double , std::decay_t <Op7>> edge7_;
128+ internal::ops_partials_edge<double , std::decay_t <Op8>> edge8_;
121129
122130 explicit operands_and_partials (const Op1& o1) : edge1_(o1) {}
123131 operands_and_partials (const Op1& o1, const Op2& o2)
@@ -130,6 +138,35 @@ class operands_and_partials<Op1, Op2, Op3, Op4, Op5, var> {
130138 operands_and_partials (const Op1& o1, const Op2& o2, const Op3& o3,
131139 const Op4& o4, const Op5& o5)
132140 : edge1_(o1), edge2_(o2), edge3_(o3), edge4_(o4), edge5_(o5) {}
141+ operands_and_partials (const Op1& o1, const Op2& o2, const Op3& o3,
142+ const Op4& o4, const Op5& o5, const Op6& o6)
143+ : edge1_(o1),
144+ edge2_ (o2),
145+ edge3_(o3),
146+ edge4_(o4),
147+ edge5_(o5),
148+ edge6_(o6) {}
149+ operands_and_partials (const Op1& o1, const Op2& o2, const Op3& o3,
150+ const Op4& o4, const Op5& o5, const Op6& o6,
151+ const Op7& o7)
152+ : edge1_(o1),
153+ edge2_(o2),
154+ edge3_(o3),
155+ edge4_(o4),
156+ edge5_(o5),
157+ edge6_(o6),
158+ edge7_(o7) {}
159+ operands_and_partials (const Op1& o1, const Op2& o2, const Op3& o3,
160+ const Op4& o4, const Op5& o5, const Op6& o6,
161+ const Op7& o7, const Op8& o8)
162+ : edge1_(o1),
163+ edge2_(o2),
164+ edge3_(o3),
165+ edge4_(o4),
166+ edge5_(o5),
167+ edge6_(o6),
168+ edge7_(o7),
169+ edge8_(o8) {}
133170
134171 /* * \ingroup type_trait
135172 * Build the node to be stored on the autodiff graph.
@@ -150,8 +187,11 @@ class operands_and_partials<Op1, Op2, Op3, Op4, Op5, var> {
150187 operand2 = edge2_.operand (), partial2 = edge2_.partial (),
151188 operand3 = edge3_.operand (), partial3 = edge3_.partial (),
152189 operand4 = edge4_.operand (), partial4 = edge4_.partial (),
153- operand5 = edge5_.operand (),
154- partial5 = edge5_.partial ()](const auto & vi) mutable {
190+ operand5 = edge5_.operand (), partial5 = edge5_.partial (),
191+ operand6 = edge6_.operand (), partial6 = edge6_.partial (),
192+ operand7 = edge7_.operand (), partial7 = edge7_.partial (),
193+ operand8 = edge8_.operand (),
194+ partial8 = edge8_.partial ()](const auto & vi) mutable {
155195 if (!is_constant<Op1>::value) {
156196 internal::update_adjoints (operand1, partial1, vi);
157197 }
@@ -167,6 +207,15 @@ class operands_and_partials<Op1, Op2, Op3, Op4, Op5, var> {
167207 if (!is_constant<Op5>::value) {
168208 internal::update_adjoints (operand5, partial5, vi);
169209 }
210+ if (!is_constant<Op6>::value) {
211+ internal::update_adjoints (operand6, partial6, vi);
212+ }
213+ if (!is_constant<Op7>::value) {
214+ internal::update_adjoints (operand7, partial7, vi);
215+ }
216+ if (!is_constant<Op8>::value) {
217+ internal::update_adjoints (operand8, partial8, vi);
218+ }
170219 });
171220 }
172221};
@@ -186,7 +235,8 @@ class ops_partials_edge<double, std::vector<var>> {
186235 operands_(op.begin(), op.end()) {}
187236
188237 private:
189- template <typename , typename , typename , typename , typename , typename >
238+ template <typename , typename , typename , typename , typename , typename ,
239+ typename , typename , typename >
190240 friend class stan ::math::operands_and_partials;
191241 Op operands_;
192242
@@ -207,7 +257,8 @@ class ops_partials_edge<double, Op, require_eigen_st<is_var, Op>> {
207257 operands_(ops) {}
208258
209259 private:
210- template <typename , typename , typename , typename , typename , typename >
260+ template <typename , typename , typename , typename , typename , typename ,
261+ typename , typename , typename >
211262 friend class stan ::math::operands_and_partials;
212263 arena_t <Op> operands_;
213264 inline int size () const noexcept { return this ->operands_ .size (); }
@@ -228,7 +279,8 @@ class ops_partials_edge<double, var_value<Op>, require_eigen_t<Op>> {
228279 operands_(ops) {}
229280
230281 private:
231- template <typename , typename , typename , typename , typename , typename >
282+ template <typename , typename , typename , typename , typename , typename ,
283+ typename , typename , typename >
232284 friend class stan ::math::operands_and_partials;
233285 var_value<Op> operands_;
234286
@@ -256,7 +308,8 @@ class ops_partials_edge<double, std::vector<Eigen::Matrix<var, R, C>>> {
256308 }
257309
258310 private:
259- template <typename , typename , typename , typename , typename , typename >
311+ template <typename , typename , typename , typename , typename , typename ,
312+ typename , typename , typename >
260313 friend class stan ::math::operands_and_partials;
261314 Op operands_;
262315
@@ -286,7 +339,8 @@ class ops_partials_edge<double, std::vector<std::vector<var>>> {
286339 }
287340
288341 private:
289- template <typename , typename , typename , typename , typename , typename >
342+ template <typename , typename , typename , typename , typename , typename ,
343+ typename , typename , typename >
290344 friend class stan ::math::operands_and_partials;
291345 Op operands_;
292346 inline int size () const noexcept {
@@ -311,7 +365,8 @@ class ops_partials_edge<double, std::vector<var_value<Op>>,
311365 }
312366
313367 private:
314- template <typename , typename , typename , typename , typename , typename >
368+ template <typename , typename , typename , typename , typename , typename ,
369+ typename , typename , typename >
315370 friend class stan ::math::operands_and_partials;
316371 std::vector<var_value<Op>, arena_allocator<var_value<Op>>> operands_;
317372
0 commit comments