Compute the inverse of a matrix with LU decomposition and forward / backward substitutions. Parameters ---------- a : array_like Square matrix to be inverted. Returns ------- ainv : Array Inverse of the matrix `a`.
(a)
| 1261 | |
| 1262 | |
| 1263 | def inv(a): |
| 1264 | """ |
| 1265 | Compute the inverse of a matrix with LU decomposition and |
| 1266 | forward / backward substitutions. |
| 1267 | |
| 1268 | Parameters |
| 1269 | ---------- |
| 1270 | a : array_like |
| 1271 | Square matrix to be inverted. |
| 1272 | |
| 1273 | Returns |
| 1274 | ------- |
| 1275 | ainv : Array |
| 1276 | Inverse of the matrix `a`. |
| 1277 | """ |
| 1278 | return solve(a, eye(a.shape[0], chunks=a.chunks[0][0])) |
| 1279 | |
| 1280 | |
| 1281 | def _cholesky_lower(a): |