Add support for rectangular matrices