ENH: add `mdot`: fast dot with multiple arguments.

This is not ready to be merged!

`mdot` makes it easy to chain `dot`. Think of `mdot` as this:

    def mdot(*args): return reduce(np.dot, args)

However, `mdot` uses the fact that matrix multiplication is associative and
finds the optimal order of multiplications with dynamic programing before
doing the mutiplication. This can speed up the multiplication quite a bit.

The algorithm follows:
Cormen, "Introduction to Algorithms", Chapter 15.2, p. 370-378

Note: currently `mdot` only works with arrays which have `ndim == 2` to avoid
ambiguities of `dot`. Also see the discussion in #4311.

TODO:
- [ ] Decide if `ndim != 2` should be ok
- [ ] Add unittests
- [ ] Do we need more documentation?
Is there a general numpy rule on using `*args` vs. a single sequence of operands in public functions? Many e.g. `concatenate` and the like, require passing all the arguments in a tuple or list, but there are examples of the other way too, e.g. `einsum`. I hate having to write those extra parenthesis, but I also dislike not being able to explicitly list the keyword arguments in the function definition.