how to fold/accumulate a numpy matrix product (dot)?,"from functools import reduce