Commit b83a378
committed
Workaround np.linalg.solve ambiguity
NumPy's solve() does not handle the ambiguity around x2 being 1-D vector vs.
an n-D stack of matrices in the way that the standard specifies. Namely, x2
should be treated as a 1-D vector iff it is 1-dimensional, and a stack of
matrices in all other cases. This workaround is borrowed from
array-api-strict.
See numpy/numpy#15349 and
data-apis/array-api#285.
Note that this workaround only works for NumPy. CuPy currently does not
support stacked vectors for solve() (see
https://github.com/cupy/cupy/blob/main/cupy/cublas.py#L43), and the workaround
in cupy.array_api.linalg does not seem to actually function.1 parent 645f9a8 commit b83a378
1 file changed
+48
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
36 | 83 | | |
37 | 84 | | |
38 | 85 | | |
| |||
54 | 101 | | |
55 | 102 | | |
56 | 103 | | |
| 104 | + | |
57 | 105 | | |
58 | 106 | | |
59 | 107 | | |
| |||
0 commit comments