Does not now attempt optimisation if matrix has zero length.
Declaration of matrix size is left to def.r.