slow naive sparse matrix multiplication and inverse