Hi all,

I’m working on some code for an efficient (lme4-like) linear mixed model for the Stan library. I’m piggybacking quite heavily off `normal_id_glm_lpdf.hpp`

.

I’ve got most of the details worked out, although it’s got a few complications (mainly due to Eigen’s limited sparse matrix features).

But my main problem right now is that I have 8 potential autodiff parameters (5 vector-like parameters, 2 dense matrix-like parameters, and one scalar parameter), which is more than the five assumed by the implementation of `operands_and_partials`

. Is there an obvious way to get around this?

- In almost every application, at most three of these will be vars, but following convention, I’m making sure every
`double`

can be a`var`

. - I’m assuming the
`ops_partials.edge1_.partials_`

syntax is correct rather than the`operands_and_partials_d_x1_`

syntax from the arXiv paper on the math library. Please let me know if that’s wrong.

Edit: I’m probably going to hit similar road blocks with the traits meta-programs. Let me know if the solution is different here.

Edit 2: Actually, would this work for the metaprograms?

```
return_type<T1, T2, return_type<T3,T4>::type >::type
```

Thanks!

Dan