|
4 | 4 |
|
5 | 5 | import numpy as np
|
6 | 6 |
|
7 |
| -from ..common import _aliases |
8 |
| - |
9 | 7 | from .._internal import get_xp
|
| 8 | +from ..common import _aliases |
| 9 | +from ..common import _linalg |
10 | 10 |
|
11 |
| -asarray = asarray_numpy = partial(_aliases._asarray, namespace='numpy') |
| 11 | +asarray = asarray_numpy = partial(_aliases._asarray, namespace="numpy") |
12 | 12 | asarray.__doc__ = _aliases._asarray.__doc__
|
13 | 13 |
|
14 | 14 | bool = np.bool_
|
|
64 | 64 |
|
65 | 65 | # These functions are completely new here. If the library already has them
|
66 | 66 | # (i.e., numpy 2.0), use the library version instead of our wrapper.
|
67 |
| -if hasattr(np, 'vecdot'): |
| 67 | +if hasattr(np, "vecdot"): |
68 | 68 | vecdot = np.vecdot
|
69 | 69 | else:
|
70 | 70 | vecdot = get_xp(np)(_aliases.vecdot)
|
71 |
| -if hasattr(np, 'isdtype'): |
| 71 | +if hasattr(np, "isdtype"): |
72 | 72 | isdtype = np.isdtype
|
73 | 73 | else:
|
74 | 74 | isdtype = get_xp(np)(_aliases.isdtype)
|
| 75 | + |
| 76 | + |
| 77 | +cross = get_xp(np)(_linalg.cross) |
| 78 | +outer = get_xp(np)(_linalg.outer) |
| 79 | +EighResult = _linalg.EighResult |
| 80 | +QRResult = _linalg.QRResult |
| 81 | +SlogdetResult = _linalg.SlogdetResult |
| 82 | +SVDResult = _linalg.SVDResult |
| 83 | +eigh = get_xp(np)(_linalg.eigh) |
| 84 | +qr = get_xp(np)(_linalg.qr) |
| 85 | +slogdet = get_xp(np)(_linalg.slogdet) |
| 86 | +svd = get_xp(np)(_linalg.svd) |
| 87 | +cholesky = get_xp(np)(_linalg.cholesky) |
| 88 | +matrix_rank = get_xp(np)(_linalg.matrix_rank) |
| 89 | +pinv = get_xp(np)(_linalg.pinv) |
| 90 | +matrix_norm = get_xp(np)(_linalg.matrix_norm) |
| 91 | +svdvals = get_xp(np)(_linalg.svdvals) |
| 92 | +diagonal = get_xp(np)(_linalg.diagonal) |
| 93 | +trace = get_xp(np)(_linalg.trace) |
| 94 | + |
| 95 | +# These functions are completely new here. If the library already has them |
| 96 | +# (i.e., numpy 2.0), use the library version instead of our wrapper. |
| 97 | +if hasattr(np.linalg, "vector_norm"): |
| 98 | + vector_norm = np.linalg.vector_norm |
| 99 | +else: |
| 100 | + vector_norm = get_xp(np)(_linalg.vector_norm) |
0 commit comments