(n, *, format="csr")
| 144 | |
| 145 | # Can be replaced with sparse.eye_array once we depend on SciPy >= 1.12 |
| 146 | def _eye_array(n, *, format="csr"): # noqa: A002 |
| 147 | from scipy import sparse |
| 148 | |
| 149 | return sparse.dia_array((np.ones(n), 0), shape=(n, n)).asformat(format) |
| 150 | |
| 151 | |
| 152 | ############################################################################### |
no outgoing calls