|
| 1 | +from typing import Any |
| 2 | +import numpy as np |
| 3 | +import numpy.typing as npt |
| 4 | + |
| 5 | +mat: np.matrix[Any, np.dtype[np.int64]] |
| 6 | +ar_f8: npt.NDArray[np.float64] |
| 7 | + |
| 8 | +reveal_type(mat * 5) # E: numpy.matrix[Any, Any] |
| 9 | +reveal_type(5 * mat) # E: numpy.matrix[Any, Any] |
| 10 | +mat *= 5 |
| 11 | + |
| 12 | +reveal_type(mat**5) # E: numpy.matrix[Any, Any] |
| 13 | +mat **= 5 |
| 14 | + |
| 15 | +reveal_type(mat.sum()) # E: Any |
| 16 | +reveal_type(mat.mean()) # E: Any |
| 17 | +reveal_type(mat.std()) # E: Any |
| 18 | +reveal_type(mat.var()) # E: Any |
| 19 | +reveal_type(mat.prod()) # E: Any |
| 20 | +reveal_type(mat.any()) # E: numpy.bool_ |
| 21 | +reveal_type(mat.all()) # E: numpy.bool_ |
| 22 | +reveal_type(mat.max()) # E: {int64} |
| 23 | +reveal_type(mat.min()) # E: {int64} |
| 24 | +reveal_type(mat.argmax()) # E: {intp} |
| 25 | +reveal_type(mat.argmin()) # E: {intp} |
| 26 | +reveal_type(mat.ptp()) # E: {int64} |
| 27 | + |
| 28 | +reveal_type(mat.sum(axis=0)) # E: numpy.matrix[Any, Any] |
| 29 | +reveal_type(mat.mean(axis=0)) # E: numpy.matrix[Any, Any] |
| 30 | +reveal_type(mat.std(axis=0)) # E: numpy.matrix[Any, Any] |
| 31 | +reveal_type(mat.var(axis=0)) # E: numpy.matrix[Any, Any] |
| 32 | +reveal_type(mat.prod(axis=0)) # E: numpy.matrix[Any, Any] |
| 33 | +reveal_type(mat.any(axis=0)) # E: numpy.matrix[Any, numpy.dtype[numpy.bool_]] |
| 34 | +reveal_type(mat.all(axis=0)) # E: numpy.matrix[Any, numpy.dtype[numpy.bool_]] |
| 35 | +reveal_type(mat.max(axis=0)) # E: numpy.matrix[Any, numpy.dtype[{int64}]] |
| 36 | +reveal_type(mat.min(axis=0)) # E: numpy.matrix[Any, numpy.dtype[{int64}]] |
| 37 | +reveal_type(mat.argmax(axis=0)) # E: numpy.matrix[Any, numpy.dtype[{intp}]] |
| 38 | +reveal_type(mat.argmin(axis=0)) # E: numpy.matrix[Any, numpy.dtype[{intp}]] |
| 39 | +reveal_type(mat.ptp(axis=0)) # E: numpy.matrix[Any, numpy.dtype[{int64}]] |
| 40 | + |
| 41 | +reveal_type(mat.sum(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 42 | +reveal_type(mat.mean(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 43 | +reveal_type(mat.std(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 44 | +reveal_type(mat.var(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 45 | +reveal_type(mat.prod(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 46 | +reveal_type(mat.any(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 47 | +reveal_type(mat.all(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 48 | +reveal_type(mat.max(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 49 | +reveal_type(mat.min(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 50 | +reveal_type(mat.argmax(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 51 | +reveal_type(mat.argmin(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 52 | +reveal_type(mat.ptp(out=ar_f8)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]] |
| 53 | + |
| 54 | +reveal_type(mat.T) # E: numpy.matrix[Any, numpy.dtype[{int64}]] |
| 55 | +reveal_type(mat.I) # E: numpy.matrix[Any, Any] |
| 56 | +reveal_type(mat.A) # E: numpy.ndarray[Any, numpy.dtype[{int64}]] |
| 57 | +reveal_type(mat.A1) # E: numpy.ndarray[Any, numpy.dtype[{int64}]] |
| 58 | +reveal_type(mat.H) # E: numpy.matrix[Any, numpy.dtype[{int64}]] |
| 59 | +reveal_type(mat.getT()) # E: numpy.matrix[Any, numpy.dtype[{int64}]] |
| 60 | +reveal_type(mat.getI()) # E: numpy.matrix[Any, Any] |
| 61 | +reveal_type(mat.getA()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]] |
| 62 | +reveal_type(mat.getA1()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]] |
| 63 | +reveal_type(mat.getH()) # E: numpy.matrix[Any, numpy.dtype[{int64}]] |
| 64 | + |
| 65 | +reveal_type(np.bmat(ar_f8)) # E: numpy.matrix[Any, Any] |
| 66 | +reveal_type(np.bmat([[0, 1, 2]])) # E: numpy.matrix[Any, Any] |
| 67 | +reveal_type(np.bmat("mat")) # E: numpy.matrix[Any, Any] |
| 68 | + |
| 69 | +reveal_type(np.asmatrix(ar_f8, dtype=np.int64)) # E: numpy.matrix[Any, Any] |
0 commit comments