par - 1 year ago 126

Python Question

Given a

`scipy.sparse.csr.csr_matrix`

The reason I would like to do this is to compute

`inv(D) A`

`D`

`A`

`A`

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Returns the main diagonal of the matrix

Example:

```
>>> import numpy as np
>>> from scipy.sparse import csr_matrix
>>> mymat = csr_matrix((4, 4), dtype=np.int8).toarray()
>>> mymat.diagonal()
array([0, 0, 0, 0], dtype=int8)
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**