Return the (dense) vector of the diagonal elements.
(self)
| 1273 | |
| 1274 | @property |
| 1275 | def diag(self): |
| 1276 | """Return the (dense) vector of the diagonal elements.""" |
| 1277 | in_diag = (self.rows == self.cols) |
| 1278 | diag = np.zeros(min(self.n, self.n), dtype=np.float64) # default 0. |
| 1279 | diag[self.rows[in_diag]] = self.vals[in_diag] |
| 1280 | return diag |
| 1281 | |
| 1282 | |
| 1283 | def _cg(A, b, x0=None, tol=1.e-10, maxiter=1000): |
no outgoing calls