Add support for sparse mats