Speed up python calls to SparseMatrix.setRowFromDense

Fixes #1584.