This is just a comment because it isn’t ready for a PR (and won’t be).

Eigen 3.4 supports list-initialization (no more need for `.finished()`

and friends) and has STL iterators, including the const ones (thus it can be used with the Ranges TS and supports the standard library algorithms on containers). In my opinion, it will be a desirable upgrade, especially when used with `.eval()`

for returning results.

It also contains a bugfix that has been back ported to 3.3 that changes the GEMM template that stan has specialized, preventing stan from compiling.

https://eigen.tuxfamily.org/bz/show_bug.cgi?id=1741

These don’t appear to be huge changes like the ones that caused this old issue:

So, I made the following two changes and wanted to note them here so they can later be referred to by myself or others. This is just to get some unit tests in my main project to pass. It isn’t to get stan’s tests to pass, and certainly doesn’t handle stan’s performance tests. Probably the final stan template specialization will need to handle more than just the non-trivial result stride (of 1) in order to keep performance high. It is also likely that my changes aren’t complete (possibly not even correct). Anyway, here they are:

```
diff --git a/stan/math/rev/mat/fun/Eigen_NumTraits.hpp b/stan/math/rev/mat/fun/Eigen_NumTraits.hpp
--- a/stan/math/rev/mat/fun/Eigen_NumTraits.hpp
+++ b/stan/math/rev/mat/fun/Eigen_NumTraits.hpp
@@ -189,7 +189,7 @@ template <typename Index, int LhsStorageOrder, bool ConjugateLhs,
int RhsStorageOrder, bool ConjugateRhs>
struct general_matrix_matrix_product<Index, stan::math::var, LhsStorageOrder,
ConjugateLhs, stan::math::var,
- RhsStorageOrder, ConjugateRhs, ColMajor> {
+ RhsStorageOrder, ConjugateRhs, ColMajor,1> {
typedef stan::math::var LhsScalar;
typedef stan::math::var RhsScalar;
typedef stan::math::var ResScalar;
@@ -204,7 +204,7 @@ struct general_matrix_matrix_product<Index, stan::math::var, LhsStorageOrder,
EIGEN_DONT_INLINE
static void run(Index rows, Index cols, Index depth, const LhsScalar* lhs,
Index lhsStride, const RhsScalar* rhs, Index rhsStride,
- ResScalar* res, Index resStride, const ResScalar& alpha,
+ ResScalar* res,Index, Index resStride, const ResScalar& alpha,
level3_blocking<LhsScalar, RhsScalar>& /* blocking */,
GemmParallelInfo<Index>* /* info = 0 */) {
for (Index i = 0; i < cols; i++) {
```