With C++11, static const locals are guaranteed to be constructed in a single thread. So the whole singleton is really simple as described in: https://stackoverflow.com/questions/1008019/c-singleton-design-pattern

Yes, if you mean the above pattern, that’s the way to go. Member variables or functions can’t be static by definition. Static functions are nonmember class functions and static variables are nonmember class variables.

There are only two big efficiency differences. Eigen vectors can be constructed at a given size without initializing elements. Standard vectors are much more efficient to append to because you can resize. Of course, Eigen vectors are necessary if you’re going to do linear algebra and you’d have to pay a penalty to copy from a standard vector. Otherwise, they work exactly the same way as far as memory allocation is used—they both use the standard RAII pattern (not from GoF and only capitalized because it’s an acronym).

This is a general principle. The problem is that you need them for generality in code and for static evaluations. `Eigen::Tensor`

will have a template parameter, right?

I think it’s not just allocation, it’s also simple indexing and slice/block mapping. The allocation means we don’t need collections of collections, which means we get memory locality. That’s a big deal if we have more than 1D containers. `Eigen::Matrix`

provides the same advantages if we only need 2D structures. If sizes are known at compile time, we can use the new array classes in C++11.

Right—that’ll make accessing the columns memory local. They’ll be cheap to access via Map or `.col()`

, but won’t be efficient to copy into full `VectorXd`

. So it’ll depend how they get used and/or serialized over the network. A plain old matrix should be much easier to serialize than a sequence of structures.