Added possibility to use sparse matrices through eye and diag