From fd255dc22ed0ab0c30b97a6706cfcd303c74b856 Mon Sep 17 00:00:00 2001 From: Kyle Oman Date: Sat, 14 Dec 2024 09:04:41 +0000 Subject: [PATCH] Fill in FFT functions, continue roughing in. --- swiftsimio/_array_functions.py | 270 ++++++++++++++++----------------- tests/test_cosmo_array.py | 144 +++++++++--------- 2 files changed, 207 insertions(+), 207 deletions(-) diff --git a/swiftsimio/_array_functions.py b/swiftsimio/_array_functions.py index 1d3b6bd8..91054c18 100644 --- a/swiftsimio/_array_functions.py +++ b/swiftsimio/_array_functions.py @@ -296,42 +296,42 @@ def concatenate(tup, axis=0, out=None, dtype=None, casting="same_kind"): # @implements(np.cross) -# def ...(...): -# from unyt._array_functions import ... as unyt_... +# def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None): +# from unyt._array_functions import cross as unyt_cross -# helper_result = _prepare_array_func_args(...) +# helper_result = _prepare_array_func_args(a, b, axisa=axisa, axisb=axisb, axisc=axisc, axis=axis) # ret_cf = ...() -# res = unyt_...(*helper_result["args"], **helper_result["kwargs"]) +# res = unyt_cross(*helper_result["args"], **helper_result["kwargs"]) # return _return_helper(res, helper_result, ret_cf, out=out) # @implements(np.intersect1d) -# def ...(...): -# from unyt._array_functions import ... as unyt_... +# def intersect1d(ar1, ar2, assume_unique=False, return_indices=False): +# from unyt._array_functions import intersect1d as unyt_intersect1d -# helper_result = _prepare_array_func_args(...) +# helper_result = _prepare_array_func_args(ar1, ar2, assume_unique=assume_unique, return_indices=return_indices) # ret_cf = ...() -# res = unyt_...(*helper_result["args"], **helper_result["kwargs"]) +# res = unyt_intersect1d(*helper_result["args"], **helper_result["kwargs"]) # return _return_helper(res, helper_result, ret_cf, out=out) # @implements(np.union1d) -# def ...(...): -# from unyt._array_functions import ... as unyt_... +# def union1d(ar1, ar2): +# from unyt._array_functions import union1d as unyt_union1d -# helper_result = _prepare_array_func_args(...) +# helper_result = _prepare_array_func_args(ar1, ar2) # ret_cf = ...() -# res = unyt_...(*helper_result["args"], **helper_result["kwargs"]) +# res = unyt_union1d(*helper_result["args"], **helper_result["kwargs"]) # return _return_helper(res, helper_result, ret_cf, out=out) # @implements(np.linalg.norm) -# def ...(...): -# from unyt._array_functions import ... as unyt_... +# def linalg_norm(x, ord=None, axis=None, keepdims=False): +# from unyt._array_functions import linalg_norm as unyt_linalg_norm -# helper_result = _prepare_array_func_args(...) +# helper_result = _prepare_array_func_args(x, ord=ord, axis=axis, keepdims=keepdims) # ret_cf = ...() -# res = unyt_...(*helper_result["args"], **helper_result["kwargs"]) +# res = unyt_linalg_norm(*helper_result["args"], **helper_result["kwargs"]) # return _return_helper(res, helper_result, ret_cf, out=out) @@ -407,185 +407,185 @@ def stack(arrays, axis=0, out=None, *, dtype=None, casting="same_kind"): # @implements(np.around) -# def around(...): +# def around(a, decimals=0, out=None): # from unyt._array_functions import around as unyt_around -# helper_result = _prepare_array_func_args(...) +# helper_result = _prepare_array_func_args(a, decimals=decimals, out=out) # ret_cf = ...() # res = unyt_around(*helper_result["args"], **helper_result["kwargs"]) # return _return_helper(res, helper_result, ret_cf, out=out) # @implements(np.block) -# def block(...): +# def block(arrays): # from unyt._array_functions import block as unyt_block -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_block(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) +# helper_result_concat_items = _prepare_array_func_args(*arrays) +# ret_cf = _preserve_cosmo_factor(helper_result_concat_items["ca_cfs"][0]) +# res = unyt_block(helper_result_concat_items["args"]) +# return _return_helper(res, helper_result_concat_items, ret_cf) # UNYT HAS A COPY-PASTED TYPO fft -> ftt -# @implements(np.fft.fft) -# def ftt_fft(...): -# from unyt._array_functions import ftt_fft as unyt_fft_fft +@implements(np.fft.fft) +def ftt_fft(a, n=None, axis=-1, norm=None, out=None): + from unyt._array_functions import ftt_fft as unyt_fft_fft -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_fft(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, n=n, axis=axis, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_fft(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.fft2) -# def ftt_fft2(...): -# from unyt._array_functions import ftt_fft2 as unyt_fft_fft2 +@implements(np.fft.fft2) +def ftt_fft2(a, s=None, axes=(-2, -1), norm=None, out=None): + from unyt._array_functions import ftt_fft2 as unyt_fft_fft2 -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_fft2(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_fft2(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.fftn) -# def ftt_fftn(...): -# from unyt._array_functions import ftt_fftn as unyt_fft_fftn +@implements(np.fft.fftn) +def ftt_fftn(a, s=None, axes=None, norm=None, out=None): + from unyt._array_functions import ftt_fftn as unyt_fft_fftn -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_fftn(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_fftn(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.hfft) -# def ftt_hfft(...): -# from unyt._array_functions import ftt_hfft as unyt_fft_hfft +@implements(np.fft.hfft) +def ftt_hfft(a, n=None, axis=-1, norm=None, out=None): + from unyt._array_functions import ftt_hfft as unyt_fft_hfft -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_hfft(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, n=n, axis=axis, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_hfft(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.rfft) -# def ftt_rfft(...): -# from unyt._array_functions import ftt_rfft as unyt_fft_rfft +@implements(np.fft.rfft) +def ftt_rfft(a, n=None, axis=-1, norm=None, out=None): + from unyt._array_functions import ftt_rfft as unyt_fft_rfft -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_rfft(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, n=n, axis=axis, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_rfft(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.rfft2) -# def fft_rfft2(...): -# from unyt._array_functions import ftt_rfft2 as unyt_fft_rfft2 +@implements(np.fft.rfft2) +def fft_rfft2(a, s=None, axes=(-2, -1), norm=None, out=None): + from unyt._array_functions import ftt_rfft2 as unyt_fft_rfft2 -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_rfft2(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_rfft2(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.rfftn) -# def fft_rfftn(...): -# from unyt._array_functions import ftt_rfftn as unyt_fft_rfftn +@implements(np.fft.rfftn) +def fft_rfftn(a, s=None, axes=None, norm=None, out=None): + from unyt._array_functions import ftt_rfftn as unyt_fft_rfftn -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_rfftn(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_rfftn(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.ifft) -# def fft_ifft(...): -# from unyt._array_functions import ftt_ifft as unyt_fft_ifft +@implements(np.fft.ifft) +def fft_ifft(a, n=None, axis=-1, norm=None, out=None): + from unyt._array_functions import ftt_ifft as unyt_fft_ifft -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_ifft(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, n=n, axis=axis, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_ifft(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.ifft2) -# def fft_ifft2(...): -# from unyt._array_functions import ftt_ifft2 as unyt_fft_ifft2 +@implements(np.fft.ifft2) +def fft_ifft2(a, s=None, axes=(-2, -1), norm=None, out=None): + from unyt._array_functions import ftt_ifft2 as unyt_fft_ifft2 -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_ifft2(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_ifft2(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.ifftn) -# def fft_ifftn(...): -# from unyt._array_functions import ftt_ifftn as unyt_fft_ifftn +@implements(np.fft.ifftn) +def fft_ifftn(a, s=None, axes=None, norm=None, out=None): + from unyt._array_functions import ftt_ifftn as unyt_fft_ifftn -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_ifftn(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_ifftn(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.ihfft) -# def fft_ihfft(...): -# from unyt._array_functions import ftt_ihfft as unyt_fft_ihfft +@implements(np.fft.ihfft) +def fft_ihfft(a, n=None, axis=-1, norm=None, out=None): + from unyt._array_functions import ftt_ihfft as unyt_fft_ihfft -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_ihfft(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, n=n, axis=axis, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_ihfft(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.irfft) -# def fft_irfft(...): -# from unyt._array_functions import ftt_irfft as unyt_fft_irfft +@implements(np.fft.irfft) +def fft_irfft(a, n=None, axis=-1, norm=None, out=None): + from unyt._array_functions import ftt_irfft as unyt_fft_irfft -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_irfft(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, n=n, axis=axis, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_irfft(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.irfft2) -# def fft_irfft2(...): -# from unyt._array_functions import ftt_irfft2 as unyt_fft_irfft2 +@implements(np.fft.irfft2) +def fft_irfft2(a, s=None, axes=(-2, -1), norm=None, out=None): + from unyt._array_functions import ftt_irfft2 as unyt_fft_irfft2 -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_irfft2(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_irfft2(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.irfftn) -# def fft_irfftn(...): -# from unyt._array_functions import ftt_irfftn as unyt_fft_irfftn +@implements(np.fft.irfftn) +def fft_irfftn(a, s=None, axes=None, norm=None, out=None): + from unyt._array_functions import ftt_irfftn as unyt_fft_irfftn -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_irfftn(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(a, s=s, axes=axes, norm=norm, out=out) + ret_cf = _reciprocal_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_irfftn(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf, out=out) -# @implements(np.fft.fftshift) -# def fft_fftshift(...): -# from unyt._array_functions import fft_fftshift as unyt_fft_fftshift +@implements(np.fft.fftshift) +def fft_fftshift(x, axes=None): + from unyt._array_functions import fft_fftshift as unyt_fft_fftshift -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_fftshift(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(x, axes=axes) + ret_cf = _preserve_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_fftshift(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf) -# @implements(np.fft.ifftshift) -# def fft_ifftshift(...): -# from unyt._array_functions import fft_ifftshift as unyt_fft_ifftshift +@implements(np.fft.ifftshift) +def fft_ifftshift(x, axes=None): + from unyt._array_functions import fft_ifftshift as unyt_fft_ifftshift -# helper_result = _prepare_array_func_args(...) -# ret_cf = ...() -# res = unyt_fft_ifftshift(*helper_result["args"], **helper_result["kwargs"]) -# return _return_helper(res, helper_result, ret_cf, out=out) + helper_result = _prepare_array_func_args(x, axes=axes) + ret_cf = _preserve_cosmo_factor(helper_result["ca_cfs"][0]) + res = unyt_fft_ifftshift(*helper_result["args"], **helper_result["kwargs"]) + return _return_helper(res, helper_result, ret_cf) # @implements(np.sort_complex) diff --git a/tests/test_cosmo_array.py b/tests/test_cosmo_array.py index 44fcd126..5240ae3f 100644 --- a/tests/test_cosmo_array.py +++ b/tests/test_cosmo_array.py @@ -109,74 +109,19 @@ def test_handled_funcs(self): "linalg.pinv": (ca(np.eye(3)),), "linalg.svd": (ca(np.eye(3)),), "histogram": (ca(np.arange(3)),), - "histogram2d": (ca(np.arange(3)), ca(np.arange(3))), - "histogramdd": (ca(np.arange(3)),), + # "histogram2d": (ca(np.arange(3)), ca(np.arange(3))), + # "histogramdd": (ca(np.arange(3)),), "concatenate": (ca(np.eye(3)),), - "cross": (ca(np.arange(3)), ca(np.arange(3))), - "intersect1d": (ca(np.arange(3)), ca(np.arange(3))), - "union1d": (ca(np.arange(3)), ca(np.arange(3))), + # "cross": (ca(np.arange(3)), ca(np.arange(3))), + # "intersect1d": (ca(np.arange(3)), ca(np.arange(3))), + # "union1d": (ca(np.arange(3)), ca(np.arange(3))), "vstack": (ca(np.arange(3)),), "hstack": (ca(np.arange(3)),), "dstack": (ca(np.arange(3)),), "column_stack": (ca(np.arange(3)),), "stack": (ca(np.arange(3)),), - "around": (ca(np.arange(3)),), - "block": (ca(np.arange(3)),), - "sort_complex": (ca(np.arange(3)),), - "linspace": (ca(1), ca(2), 10), - "logspace": (ca(1, unit=u.dimensionless), ca(2, unit=u.dimensionless), 10), - "geomspace": (ca(1), ca(1), 10), - "prod": (ca(np.arange(3)),), - "var": (ca(np.arange(3)),), - "trace": (ca(np.eye(3)),), - "percentile": (ca(np.arange(3)), 30), - "quantile": (ca(np.arange(3)), 0.3), - "nanpercentile": (ca(np.arange(3)), 30), - "nanquantile": (ca(np.arange(3)), 0.3), - "diff": (ca(np.arange(3)),), - "ediff1d": (ca(np.arange(3)),), - "ptp": (ca(np.arange(3)),), - "cumprod": (ca(np.arange(3)),), - "pad": (ca(np.arange(3)), 3), - "choose": (np.arange(3), ca(np.eye(3))), - "insert": (ca(np.arange(3)), 1, ca(1)), - "isin": (ca(np.arange(3)), ca(np.arange(3))), - "in1d": (ca(np.arange(3)), ca(np.arange(3))), - "interp": (ca(np.arange(3)), ca(np.arange(3)), ca(np.arange(3))), - "isclose": (ca(np.arange(3)), ca(np.arange(3))), - "allclose": (ca(np.arange(3)), ca(np.arange(3))), - "array_equal": (ca(np.arange(3)), ca(np.arange(3))), - "array_equiv": (ca(np.arange(3)), ca(np.arange(3))), - "searchsorted": (ca(np.arange(3)), ca(np.arange(3))), - "select": ( - [np.arange(3) < 1, np.arange(3) > 1], - [ca(np.arange(3)), ca(np.arange(3))], - ca(1), - ), - "setdiff1d": (ca(np.arange(3)), ca(np.arange(3, 6))), - "sinc": (ca(np.arange(3)),), - "clip": (ca(np.arange(3)), ca(1), ca(2)), - "where": (ca(np.arange(3)), ca(np.arange(3)), ca(np.arange(3))), - "triu": (ca(np.arange(3)),), - "tril": (ca(np.arange(3)),), - "einsum": ("ii->i", ca(np.eye(3))), - "convolve": (ca(np.arange(3)), ca(np.arange(3))), - "correlate": (ca(np.arange(3)), ca(np.arange(3))), - "tensordot": (ca(np.eye(3)), ca(np.eye(3))), - "unwrap": (ca(np.arange(3)),), - "linalg.norm": (ca(np.arange(3)),), - "linalg.det": (ca(np.eye(3)),), - "linalg.outer": (ca(np.arange(3)), ca(np.arange(3))), - "linalg.solve": (ca(np.eye(3)), ca(np.eye(3))), - "linalg.tensorsolve": ( - ca(np.eye(24).reshape((6, 4, 2, 3, 4))), - ca(np.ones((6, 4))), - ), - "linalg.eigvals": (ca(np.eye(3)),), - "linalg.eigvalsh": (ca(np.eye(3)),), - "linalg.lstsq": (ca(np.eye(3)), ca(np.eye(3))), - "linalg.eig": (ca(np.eye(3)),), - "linalg.eigh": (ca(np.eye(3)),), + # "around": (ca(np.arange(3)),), + # "block": (ca(np.arange(3)),), "fft.fft": (ca(np.arange(3)),), "fft.fft2": (ca(np.eye(3)),), "fft.fftn": (ca(np.arange(3)),), @@ -193,16 +138,71 @@ def test_handled_funcs(self): "fft.irfftn": (ca(np.arange(3)),), "fft.fftshift": (ca(np.arange(3)),), "fft.ifftshift": (ca(np.arange(3)),), - "copyto": (ca(np.arange(3)), ca(np.arange(3))), - "savetxt": (savetxt_file, ca(np.arange(3))), - "fill_diagonal": (ca(np.eye(3)), ca(np.arange(3))), - "apply_over_axes": (lambda x, axis: x, ca(np.eye(3)), (0, 1)), - "place": (ca(np.arange(3)), np.arange(3) > 0, ca(np.arange(3))), - "put": (ca(np.arange(3)), np.arange(3), ca(np.arange(3))), - "put_along_axis": (ca(np.arange(3)), np.arange(3), ca(np.arange(3)), 0), - "putmask": (ca(np.arange(3)), np.arange(3), ca(np.arange(3))), - "array_repr": (ca(np.arange(3)),), - "trapezoid": (ca(np.arange(3)),), + # "sort_complex": (ca(np.arange(3)),), + # "linspace": (ca(1), ca(2), 10), + # "logspace": (ca(1, unit=u.dimensionless), ca(2, unit=u.dimensionless), 10), + # "geomspace": (ca(1), ca(1), 10), + # "prod": (ca(np.arange(3)),), + # "var": (ca(np.arange(3)),), + # "trace": (ca(np.eye(3)),), + # "percentile": (ca(np.arange(3)), 30), + # "quantile": (ca(np.arange(3)), 0.3), + # "nanpercentile": (ca(np.arange(3)), 30), + # "nanquantile": (ca(np.arange(3)), 0.3), + # "diff": (ca(np.arange(3)),), + # "ediff1d": (ca(np.arange(3)),), + # "ptp": (ca(np.arange(3)),), + # "cumprod": (ca(np.arange(3)),), + # "pad": (ca(np.arange(3)), 3), + # "choose": (np.arange(3), ca(np.eye(3))), + # "insert": (ca(np.arange(3)), 1, ca(1)), + # "isin": (ca(np.arange(3)), ca(np.arange(3))), + # "in1d": (ca(np.arange(3)), ca(np.arange(3))), + # "interp": (ca(np.arange(3)), ca(np.arange(3)), ca(np.arange(3))), + # "isclose": (ca(np.arange(3)), ca(np.arange(3))), + # "allclose": (ca(np.arange(3)), ca(np.arange(3))), + # "array_equal": (ca(np.arange(3)), ca(np.arange(3))), + # "array_equiv": (ca(np.arange(3)), ca(np.arange(3))), + # "searchsorted": (ca(np.arange(3)), ca(np.arange(3))), + # "select": ( + # [np.arange(3) < 1, np.arange(3) > 1], + # [ca(np.arange(3)), ca(np.arange(3))], + # ca(1), + # ), + # "setdiff1d": (ca(np.arange(3)), ca(np.arange(3, 6))), + # "sinc": (ca(np.arange(3)),), + # "clip": (ca(np.arange(3)), ca(1), ca(2)), + # "where": (ca(np.arange(3)), ca(np.arange(3)), ca(np.arange(3))), + # "triu": (ca(np.arange(3)),), + # "tril": (ca(np.arange(3)),), + # "einsum": ("ii->i", ca(np.eye(3))), + # "convolve": (ca(np.arange(3)), ca(np.arange(3))), + # "correlate": (ca(np.arange(3)), ca(np.arange(3))), + # "tensordot": (ca(np.eye(3)), ca(np.eye(3))), + # "unwrap": (ca(np.arange(3)),), + # "linalg.norm": (ca(np.arange(3)),), + # "linalg.det": (ca(np.eye(3)),), + # "linalg.outer": (ca(np.arange(3)), ca(np.arange(3))), + # "linalg.solve": (ca(np.eye(3)), ca(np.eye(3))), + # "linalg.tensorsolve": ( + # ca(np.eye(24).reshape((6, 4, 2, 3, 4))), + # ca(np.ones((6, 4))), + # ), + # "linalg.eigvals": (ca(np.eye(3)),), + # "linalg.eigvalsh": (ca(np.eye(3)),), + # "linalg.lstsq": (ca(np.eye(3)), ca(np.eye(3))), + # "linalg.eig": (ca(np.eye(3)),), + # "linalg.eigh": (ca(np.eye(3)),), + # "copyto": (ca(np.arange(3)), ca(np.arange(3))), + # "savetxt": (savetxt_file, ca(np.arange(3))), + # "fill_diagonal": (ca(np.eye(3)), ca(np.arange(3))), + # "apply_over_axes": (lambda x, axis: x, ca(np.eye(3)), (0, 1)), + # "place": (ca(np.arange(3)), np.arange(3) > 0, ca(np.arange(3))), + # "put": (ca(np.arange(3)), np.arange(3), ca(np.arange(3))), + # "put_along_axis": (ca(np.arange(3)), np.arange(3), ca(np.arange(3)), 0), + # "putmask": (ca(np.arange(3)), np.arange(3), ca(np.arange(3))), + # "array_repr": (ca(np.arange(3)),), + # "trapezoid": (ca(np.arange(3)),), } functions_checked = list() bad_funcs = dict()