|
| 1 | +from typing import Protocol |
| 2 | + |
| 3 | +__all__ = ("ArrayNamespace",) |
| 4 | + |
| 5 | +# =================================================================== |
| 6 | +# Creation Functions |
| 7 | +# TODO: arange, asarray, empty, empty_like, eye, from_dlpack, full, full_like, |
| 8 | +# linspace, meshgrid, ones, ones_like, tril, triu, zeros, zeros_like |
| 9 | + |
| 10 | +# =================================================================== |
| 11 | +# Data Type Functions |
| 12 | +# TODO: astype, broadcast_arrays, broadcast_to, can_cast, finfo, iinfo, |
| 13 | +# result_type |
| 14 | + |
| 15 | +# =================================================================== |
| 16 | +# Element-wise Functions |
| 17 | +# TODO: abs, acos, acosh, add, asin, asinh, atan, atan2, atanh, bitwise_and, |
| 18 | +# bitwise_invert, bitwise_left_shift, bitwise_or, bitwise_right_shift, |
| 19 | +# bitwise_xor, ceil, cos, cosh, divide, equal, exp, exp2, expm1, floor, |
| 20 | +# floor_divide, greater, greater_equal, isfinite, isinf, isnan, less, |
| 21 | +# less_equal, log, log1p, log2, log10, logical_and, logical_not, logical_or, |
| 22 | +# logical_xor, multiply, negative, not_equal, positive, pow, remainder, round, |
| 23 | +# sign, sin, sinh, square, sqrt, subtract, tan, tanh, trunc |
| 24 | + |
| 25 | + |
| 26 | +# =================================================================== |
| 27 | +# Linear Algebra Functions |
| 28 | +# TODO: matmul, matrix_transpose, tensordot, vecdot |
| 29 | + |
| 30 | +# =================================================================== |
| 31 | +# Manipulation Functions |
| 32 | +# TODO: concat, expand_dims, flip, permute_dims, reshape, roll, squeeze, stack |
| 33 | + |
| 34 | +# =================================================================== |
| 35 | +# Searching Functions |
| 36 | +# TODO: argmax, argmin, nonzero, where |
| 37 | + |
| 38 | +# =================================================================== |
| 39 | +# Set Functions |
| 40 | +# TODO: unique_all, unique_counts, unique_inverse, unique_values |
| 41 | + |
| 42 | +# =================================================================== |
| 43 | +# Sorting Functions |
| 44 | +# TODO: argsort, sort |
| 45 | + |
| 46 | +# =================================================================== |
| 47 | +# Statistical Functions |
| 48 | +# TODO: max, mean, min, prod, std, sum, var |
| 49 | + |
| 50 | +# =================================================================== |
| 51 | +# Utility Functions |
| 52 | +# TODO: all, any |
| 53 | + |
| 54 | +# =================================================================== |
| 55 | +# Full Namespace |
| 56 | + |
| 57 | + |
| 58 | +class ArrayNamespace(Protocol): |
| 59 | + """Protocol for an Array API-compatible namespace.""" |
0 commit comments