moved require(Matrix) statement