replaced pow() by multiplication, improved routine to remove null columns of the sparse matrix