Add flatened matrix constructor