Small bug in precon
I notice the sparse precon matrix P is converted to list-of-lists (lil) format incorrectly:
973 if len(fixed_atoms) != 0:
974 self.P.tolil()
975 for i in fixed_atoms:
976 self.P[i, :] = 0.0
977 self.P[:, i] = 0.0
978 self.P[i, i] = 1.0
P.tolil() does not change a matrix to lil format, but rather builds and returns a new lil_matrix. The line should probably be replaced by self.P = self.P.tolil().
(But actually since self.P is set to csr a few lines further down, consider using a local variable instead of self.P for the processing, as the self namespace is only useful for state that must persist after the method returns, and the lil_matrix is not supposed to persist)
This happens in two places (since that snippet was copied and pasted, which we mustn't do -- please replace any and all duplicate code by programming constructs such as descriptively named helper functions.).