diff --git a/brainunit/math/_fun_accept_unitless.py b/brainunit/math/_fun_accept_unitless.py index 18e592d..45b77a2 100644 --- a/brainunit/math/_fun_accept_unitless.py +++ b/brainunit/math/_fun_accept_unitless.py @@ -27,11 +27,7 @@ 'exprel', 'exp', 'exp2', 'expm1', 'log', 'log10', 'log1p', 'log2', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh', 'cos', 'cosh', 'sin', 'sinc', 'sinh', 'tan', - 'tanh', 'deg2rad', 'rad2deg', 'degrees', 'radians', 'angle', - - # math funcs only accept unitless (unary) can return Quantity - 'round', 'around', 'round_', 'rint', - 'floor', 'ceil', 'trunc', 'fix', 'modf', 'frexp', + 'tanh', 'deg2rad', 'rad2deg', 'degrees', 'radians', 'angle', 'frexp', # math funcs only accept unitless (binary) 'hypot', 'arctan2', 'logaddexp', 'logaddexp2', @@ -748,232 +744,6 @@ def frexp( return _fun_accept_unitless_unary(jnp.frexp, x, unit_to_scale=unit_to_scale) -def _fun_accept_unitless_return_keep_unit( - func: Callable, - x: jax.typing.ArrayLike | Quantity, - *args, - unit_to_scale: Optional[Unit] = None, - **kwargs -): - if isinstance(x, Quantity): - if unit_to_scale is None: - assert x.is_unitless, (f'Input should be unitless for the function "{func}" ' - f'when scaling "unit_to_scale" is not provided.') - x = x.mantissa - return func(x, *args, **kwargs) - else: - assert isinstance(unit_to_scale, Unit), f'unit_to_scale should be a Unit instance. Got {unit_to_scale}' - r = func(x.to_decimal(unit_to_scale), *args, **kwargs) - return jax.tree.map(lambda a: a * unit_to_scale, r) - else: - # assert unit_to_scale is None, f'Unit should be None for the function "{func}" when "x" is not a Quantity.' - return func(x, *args, **kwargs) - - -@set_module_as('brainunit.math') -def round_( - x: Union[Quantity, jax.typing.ArrayLike], - unit_to_scale: Optional[Unit] = None, -) -> jax.Array: - """ - Round an array to the nearest integer. - - Parameters - ---------- - x : array_like, Quantity - Input array. - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.round_, x, unit_to_scale=unit_to_scale) - - -@set_module_as('brainunit.math') -def around( - x: Union[Quantity, jax.typing.ArrayLike], - decimals: int = 0, - unit_to_scale: Optional[Unit] = None, -) -> jax.Array: - """ - Round an array to the nearest integer. - - Parameters - ---------- - x : array_like, Quantity - Input array. - decimals : int, optional - Number of decimal places to round to (default is 0). - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.around, x, unit_to_scale=unit_to_scale, decimals=decimals) - - -@set_module_as('brainunit.math') -def round( - x: Union[Quantity, jax.typing.ArrayLike], - decimals: int = 0, - unit_to_scale: Optional[Unit] = None, -) -> jax.Array | Quantity: - """ - Round an array to the nearest integer. - - Parameters - ---------- - x : array_like, Quantity - Input array. - decimals : int, optional - Number of decimal places to round to (default is 0). - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.round, x, unit_to_scale=unit_to_scale, decimals=decimals) - - -@set_module_as('brainunit.math') -def rint( - x: Union[Quantity, jax.typing.ArrayLike], - unit_to_scale: Optional[Unit] = None, -) -> Union[Quantity, jax.Array]: - """ - Round an array to the nearest integer. - - Parameters - ---------- - x : array_like, Quantity - Input array. - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.rint, x, unit_to_scale=unit_to_scale) - - -@set_module_as('brainunit.math') -def floor( - x: Union[Quantity, jax.typing.ArrayLike], - unit_to_scale: Optional[Unit] = None, -) -> jax.Array: - """ - Return the floor of the argument. - - Parameters - ---------- - x : array_like, Quantity - Input array. - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.floor, x, unit_to_scale=unit_to_scale) - - -@set_module_as('brainunit.math') -def ceil( - x: Union[Quantity, jax.typing.ArrayLike], - unit_to_scale: Optional[Unit] = None, -) -> jax.Array: - """ - Return the ceiling of the argument. - - Parameters - ---------- - x : array_like, Quantity - Input array. - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.ceil, x, unit_to_scale=unit_to_scale) - - -@set_module_as('brainunit.math') -def trunc( - x: Union[Quantity, jax.typing.ArrayLike], - unit_to_scale: Optional[Unit] = None, -) -> jax.Array: - """ - Return the truncated value of the argument. - - Parameters - ---------- - x : array_like, Quantity - Input array. - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.trunc, x, unit_to_scale=unit_to_scale) - - -@set_module_as('brainunit.math') -def fix( - x: Union[Quantity, jax.typing.ArrayLike], - unit_to_scale: Optional[Unit] = None, -) -> jax.Array: - """ - Return the nearest integer towards zero. - - Parameters - ---------- - x : array_like, Quantity - Input array. - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - out : jax.Array - """ - return _fun_accept_unitless_return_keep_unit(jnp.fix, x, unit_to_scale=unit_to_scale) - - -@set_module_as('brainunit.math') -def modf( - x: Union[Quantity, jax.typing.ArrayLike], - unit_to_scale: Optional[Unit] = None, -) -> Tuple[jax.Array, jax.Array]: - """ - Return the fractional and integer parts of the array elements. - - Parameters - ---------- - x : array_like, Quantity - Input array. - unit_to_scale : Unit, optional - The unit to scale the ``x``. - - Returns - ------- - The fractional and integral parts of the input, both with the same dimension. - """ - return _fun_accept_unitless_return_keep_unit(jnp.modf, x, unit_to_scale=unit_to_scale) - - # math funcs only accept unitless (binary) # ---------------------------------------- diff --git a/brainunit/math/_fun_accept_unitless_test.py b/brainunit/math/_fun_accept_unitless_test.py index dab3c3d..7b9277d 100644 --- a/brainunit/math/_fun_accept_unitless_test.py +++ b/brainunit/math/_fun_accept_unitless_test.py @@ -14,9 +14,7 @@ 'arctanh', 'cos', 'cosh', 'sin', 'sinc', 'sinh', 'tan', 'tanh', ] -fun_accept_unitless_unary_2_results = [ - 'modf', 'frexp', -] + fun_accept_unitless_binary = [ 'hypot', 'arctan2', 'logaddexp', 'logaddexp2', 'corrcoef', 'correlate', 'cov', @@ -24,10 +22,7 @@ fun_accept_unitless_binary_ldexp = [ 'ldexp', ] -fun_accept_unitless_unary_can_return_quantity = [ - 'round', 'around', 'round_', 'rint', - 'floor', 'ceil', 'trunc', 'fix', -] + fun_elementwise_bit_operation_unary = [ 'bitwise_not', 'invert', ] @@ -70,36 +65,6 @@ def test_fun_accept_unitless_unary_1(self, value): with pytest.raises(bu.UnitMismatchError): result = fun(q, unit_to_scale=bu.nS) - @parameterized.product( - value=[(1.123, 2.567, 3.891), (1.23, 2.34, 3.45)] - ) - def test_fun_accept_unitless_binary_2_results(self, value): - bm_fun_list = [getattr(bm, fun) for fun in fun_accept_unitless_unary_2_results] - jnp_fun_list = [getattr(jnp, fun) for fun in fun_accept_unitless_unary_2_results] - - for bm_fun, jnp_fun in zip(bm_fun_list, jnp_fun_list): - print(f'fun: {bm_fun.__name__}') - result1, result2 = bm_fun(jnp.array(value)) - expected1, expected2 = jnp_fun(jnp.array(value)) - assert_quantity(result1, expected1) - assert_quantity(result2, expected2) - - q = value * meter - result1, result2 = bm_fun(q, unit_to_scale=meter) - expected1, expected2 = jnp_fun(jnp.array(value)) - if bm_fun.__name__ == 'modf': - assert_quantity(result1, expected1, meter) - assert_quantity(result2, expected2, meter) - else: - assert_quantity(result1, expected1) - assert_quantity(result2, expected2) - - with pytest.raises(AssertionError): - result1, result2 = bm_fun(q) - - with pytest.raises(bu.UnitMismatchError): - result1, result2 = bm_fun(q, unit_to_scale=bu.second) - @parameterized.product( value=[[(1.0, 2.0), (3.0, 4.0), ], [(1.23, 2.34, 3.45), (4.56, 5.67, 6.78)]] @@ -153,31 +118,6 @@ def test_func_accept_unitless_binary_ldexp(self, value): with pytest.raises(AssertionError): result = bm_fun(q1, q2) - @parameterized.product( - value=[(1.123, 2.567, 3.891), (1.23, 2.34, 3.45)] - ) - def test_fun_accept_unitless_unary_can_return_quantity(self, value): - bm_fun_list = [getattr(bm, fun) for fun in fun_accept_unitless_unary_can_return_quantity] - jnp_fun_list = [getattr(jnp, fun) for fun in fun_accept_unitless_unary_can_return_quantity] - - for bm_fun, jnp_fun in zip(bm_fun_list, jnp_fun_list): - print(f'fun: {bm_fun.__name__}') - - result = bm_fun(jnp.array(value)) - expected = jnp_fun(jnp.array(value)) - assert_quantity(result, expected) - - q = value * meter - result = bm_fun(q, unit_to_scale=meter) - expected = jnp_fun(jnp.array(value)) - assert_quantity(result, expected, meter) - - with pytest.raises(AssertionError): - result = bm_fun(q) - - with pytest.raises(bu.UnitMismatchError): - result = bm_fun(q, unit_to_scale=bu.second) - @parameterized.product( value=[(1, 2), (1, 2, 3)] ) diff --git a/brainunit/math/_fun_keep_unit.py b/brainunit/math/_fun_keep_unit.py index a582d2b..1e7f687 100644 --- a/brainunit/math/_fun_keep_unit.py +++ b/brainunit/math/_fun_keep_unit.py @@ -24,7 +24,8 @@ from ._fun_array_creation import asarray from .._base import (Quantity, - fail_for_dimension_mismatch, get_unit, + fail_for_dimension_mismatch, + get_unit, UNITLESS, unit_scale_align_to_first, remove_unitless) @@ -54,6 +55,9 @@ 'nanmedian', 'nanmean', 'nanstd', 'diff', 'rot90', 'intersect1d', 'nan_to_num', 'percentile', 'nanpercentile', 'quantile', 'nanquantile', + # math funcs only accept unitless (unary) can return Quantity + 'round', 'around', 'round_', 'rint', 'floor', 'ceil', 'trunc', 'fix', 'modf', + # math funcs keep unit (binary) 'fmod', 'mod', 'copysign', 'remainder', 'maximum', 'minimum', 'fmax', 'fmin', 'lcm', 'gcd', 'trace', @@ -3320,3 +3324,182 @@ def unique( equal_nan=equal_nan, size=size, fill_value=fill_value) + + +@set_module_as('brainunit.math') +def round_( + x: Union[Quantity, jax.typing.ArrayLike], +) -> jax.Array: + """ + Round an array to the nearest integer. + + Parameters + ---------- + x : array_like, Quantity + Input array. + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.round_, x) + + +@set_module_as('brainunit.math') +def around( + x: Union[Quantity, jax.typing.ArrayLike], + decimals: int = 0, +) -> jax.Array: + """ + Round an array to the nearest integer. + + Parameters + ---------- + x : array_like, Quantity + Input array. + decimals : int, optional + Number of decimal places to round to (default is 0). + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.around, x, decimals=decimals) + + +@set_module_as('brainunit.math') +def round( + x: Union[Quantity, jax.typing.ArrayLike], + decimals: int = 0, +) -> jax.Array | Quantity: + """ + Round an array to the nearest integer. + + Parameters + ---------- + x : array_like, Quantity + Input array. + decimals : int, optional + Number of decimal places to round to (default is 0). + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.round, x, decimals=decimals) + + +@set_module_as('brainunit.math') +def rint( + x: Union[Quantity, jax.typing.ArrayLike], +) -> Union[Quantity, jax.Array]: + """ + Round an array to the nearest integer. + + Parameters + ---------- + x : array_like, Quantity + Input array. + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.rint, x) + + +@set_module_as('brainunit.math') +def floor( + x: Union[Quantity, jax.typing.ArrayLike], +) -> jax.Array: + """ + Return the floor of the argument. + + Parameters + ---------- + x : array_like, Quantity + Input array. + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.floor, x) + + +@set_module_as('brainunit.math') +def ceil( + x: Union[Quantity, jax.typing.ArrayLike], +) -> jax.Array: + """ + Return the ceiling of the argument. + + Parameters + ---------- + x : array_like, Quantity + Input array. + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.ceil, x) + + +@set_module_as('brainunit.math') +def trunc( + x: Union[Quantity, jax.typing.ArrayLike], +) -> jax.Array: + """ + Return the truncated value of the argument. + + Parameters + ---------- + x : array_like, Quantity + Input array. + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.trunc, x) + + +@set_module_as('brainunit.math') +def fix( + x: Union[Quantity, jax.typing.ArrayLike], +) -> jax.Array: + """ + Return the nearest integer towards zero. + + Parameters + ---------- + x : array_like, Quantity + Input array. + + Returns + ------- + out : jax.Array + """ + return _fun_keep_unit_unary(jnp.fix, x) + + +@set_module_as('brainunit.math') +def modf( + x: Union[Quantity, jax.typing.ArrayLike], +) -> Tuple[jax.Array, jax.Array]: + """ + Return the fractional and integer parts of the array elements. + + Parameters + ---------- + x : array_like, Quantity + Input array. + + Returns + ------- + The fractional and integral parts of the input, both with the same dimension. + """ + if isinstance(x, Quantity): + return jax.tree.map(lambda y: Quantity(y, unit=x.unit), jnp.modf(x.mantissa)) + return jnp.modf(x) diff --git a/brainunit/math/_fun_keep_unit_test.py b/brainunit/math/_fun_keep_unit_test.py index c9ad3fe..83118bb 100644 --- a/brainunit/math/_fun_keep_unit_test.py +++ b/brainunit/math/_fun_keep_unit_test.py @@ -35,6 +35,10 @@ 'nanmin', 'nanmax', 'ptp', 'average', 'mean', 'std', 'nanmedian', 'nanmean', 'nanstd', 'diff', 'nan_to_num', ] +fun_accept_unitless_unary_can_return_quantity = [ + 'round', 'around', 'round_', 'rint', + 'floor', 'ceil', 'trunc', 'fix', +] fun_keep_unit_math_binary = [ 'fmod', 'mod', 'remainder', 'maximum', 'minimum', 'fmax', 'fmin', @@ -49,6 +53,9 @@ fun_keep_unit_math_unary_misc = [ 'trace', 'lcm', 'gcd', 'copysign', 'rot90', 'intersect1d', ] +fun_accept_unitless_unary_2_results = [ + 'modf', +] class TestFunKeepUnitSquenceInputs(parameterized.TestCase): @@ -503,7 +510,7 @@ def test_extract(self): a = array * bu.second result_q = bu.math.extract(q > 1, a) expected_q = jnp.extract(q > 1, jnp.array([1, 2, 3])) * bu.second - assert bu.math.allclose(result_q , expected_q) + assert bu.math.allclose(result_q, expected_q) def test_take(self): array = jnp.array([4, 3, 5, 7, 6, 8]) @@ -682,6 +689,49 @@ def test_fun_keep_unit_quantile(self, value, q, unit): expected = jnp_fun(jnp.array(value), q) assert_quantity(result, expected, unit=unit) + @parameterized.product( + value=[(1.123, 2.567, 3.891), (1.23, 2.34, 3.45)] + ) + def test_fun_accept_unitless_binary_2_results(self, value): + bm_fun_list = [getattr(bm, fun) for fun in fun_accept_unitless_unary_2_results] + jnp_fun_list = [getattr(jnp, fun) for fun in fun_accept_unitless_unary_2_results] + + for fun in fun_accept_unitless_unary_2_results: + bm_fun = getattr(bm, fun) + jnp_fun = getattr(jnp, fun) + + print(f'fun: {bm_fun.__name__}') + result1, result2 = bm_fun(jnp.array(value)) + expected1, expected2 = jnp_fun(jnp.array(value)) + assert_quantity(result1, expected1) + assert_quantity(result2, expected2) + + for unit in [meter, ms]: + q = value * unit + result1, result2 = bm_fun(q) + expected1, expected2 = jnp_fun(jnp.array(value)) + assert_quantity(result1, expected1, unit) + assert_quantity(result2, expected2, unit) + + @parameterized.product( + value=[(1.123, 2.567, 3.891), (1.23, 2.34, 3.45)] + ) + def test_fun_accept_unitless_unary_can_return_quantity(self, value): + for fun in fun_accept_unitless_unary_can_return_quantity: + bm_fun = getattr(bm, fun) + jnp_fun = getattr(jnp, fun) + + print(f'fun: {bm_fun.__name__}') + result = bm_fun(jnp.array(value)) + expected = jnp_fun(jnp.array(value)) + assert_quantity(result, expected) + + for unit in [meter, ms]: + q = value * unit + result = bm_fun(q) + expected = jnp_fun(jnp.array(value)) + assert_quantity(result, expected, unit) + class TestFunKeepUnitMathFunMisc(parameterized.TestCase): def test_trace(self): diff --git a/docs/apis/brainunit.math.array-creation.rst b/docs/apis/brainunit.math.array-creation.rst deleted file mode 100644 index abff032..0000000 --- a/docs/apis/brainunit.math.array-creation.rst +++ /dev/null @@ -1,40 +0,0 @@ -Array Creation Functions -======================== - -.. currentmodule:: brainunit.math -.. automodule:: brainunit.math - -.. autosummary:: - :template: classtemplate.rst - :toctree: generated/ - - full - eye - identity - tri - empty - ones - zeros - full_like - diag - tril - triu - empty_like - ones_like - zeros_like - fill_diagonal - array - asarray - arange - linspace - logspace - meshgrid - vander - tril_indices - tril_indices_from - triu_indices - triu_indices_from - from_numpy - as_numpy - tree_ones_like - tree_zeros_like diff --git a/docs/apis/brainunit.math.change-unit.rst b/docs/apis/brainunit.math.change-unit.rst deleted file mode 100644 index 00b3e8b..0000000 --- a/docs/apis/brainunit.math.change-unit.rst +++ /dev/null @@ -1,41 +0,0 @@ -Functions that Changing Unit -============================ - -.. currentmodule:: brainunit.math -.. automodule:: brainunit.math - -.. autosummary:: - :template: classtemplate.rst - :toctree: generated/ - - reciprocal - prod - product - nancumprod - nanprod - cumprod - cumproduct - var - nanvar - cbrt - square - sqrt - multiply - divide - power - cross - true_divide - floor_divide - float_power - divmod - convolve - dot - multi_dot - vdot - vecdot - inner - outer - kron - matmul - tensordot - matrix_power diff --git a/docs/apis/brainunit.math.einops.rst b/docs/apis/brainunit.math.einops.rst deleted file mode 100644 index 3405513..0000000 --- a/docs/apis/brainunit.math.einops.rst +++ /dev/null @@ -1,15 +0,0 @@ -Einstein Operations -=================== - -.. currentmodule:: brainunit.math -.. automodule:: brainunit.math - -.. autosummary:: - :template: classtemplate.rst - :toctree: generated/ - - einreduce - einrearrange - einrepeat - einshape - einsum diff --git a/docs/apis/brainunit.math.keep-unit.rst b/docs/apis/brainunit.math.keep-unit.rst deleted file mode 100644 index e334770..0000000 --- a/docs/apis/brainunit.math.keep-unit.rst +++ /dev/null @@ -1,108 +0,0 @@ -Functions that Keeping Unit -=========================== - -.. currentmodule:: brainunit.math -.. automodule:: brainunit.math - -.. autosummary:: - :template: classtemplate.rst - :toctree: generated/ - - row_stack - concatenate - stack - vstack - hstack - dstack - column_stack - block - append - split - array_split - dsplit - hsplit - vsplit - atleast_1d - atleast_2d - atleast_3d - broadcast_arrays - broadcast_to - reshape - moveaxis - transpose - swapaxes - tile - repeat - flip - fliplr - flipud - roll - expand_dims - squeeze - sort - max - min - amax - amin - diagflat - diagonal - choose - ravel - flatten - unflatten - remove_diag - real - imag - conj - conjugate - negative - positive - abs - sum - nancumsum - nansum - cumsum - ediff1d - absolute - fabs - median - nanmin - nanmax - ptp - average - mean - std - nanmedian - nanmean - nanstd - diff - rot90 - intersect1d - nan_to_num - percentile - nanpercentile - quantile - nanquantile - fmod - mod - copysign - remainder - maximum - minimum - fmax - fmin - lcm - gcd - trace - add - subtract - nextafter - interp - clip - histogram - compress - extract - take - select - where - unique diff --git a/docs/apis/brainunit.math.misc.rst b/docs/apis/brainunit.math.misc.rst deleted file mode 100644 index 4e8331e..0000000 --- a/docs/apis/brainunit.math.misc.rst +++ /dev/null @@ -1,36 +0,0 @@ -Other Functions -=============== - -.. currentmodule:: brainunit.math -.. automodule:: brainunit.math - -.. autosummary:: - :template: classtemplate.rst - :toctree: generated/ - - finfo - iinfo - ndim - isreal - isscalar - isfinite - isinf - isnan - shape - size - get_dtype - is_float - is_int - broadcast_shapes - gradient - bartlett - blackman - hamming - hanning - kaiser - dtype - e - pi - inf - nan - euler_gamma diff --git a/docs/apis/brainunit.math.remove-unit.rst b/docs/apis/brainunit.math.remove-unit.rst deleted file mode 100644 index 8892106..0000000 --- a/docs/apis/brainunit.math.remove-unit.rst +++ /dev/null @@ -1,42 +0,0 @@ -Functions that Removing Unit -============================ - -.. currentmodule:: brainunit.math -.. automodule:: brainunit.math - -.. autosummary:: - :template: classtemplate.rst - :toctree: generated/ - - heaviside - signbit - sign - bincount - digitize - all - any - logical_not - equal - not_equal - greater - greater_equal - less - less_equal - array_equal - isclose - allclose - logical_and - logical_or - logical_xor - alltrue - sometrue - argsort - argmax - argmin - nanargmax - nanargmin - argwhere - nonzero - flatnonzero - searchsorted - count_nonzero diff --git a/docs/apis/brainunit.math.unitless.rst b/docs/apis/brainunit.math.unitless.rst deleted file mode 100644 index cc9e81f..0000000 --- a/docs/apis/brainunit.math.unitless.rst +++ /dev/null @@ -1,61 +0,0 @@ -Functions that Accepting Unitless -================================= - -.. currentmodule:: brainunit.math -.. automodule:: brainunit.math - -.. autosummary:: - :template: classtemplate.rst - :toctree: generated/ - - exprel - exp - exp2 - expm1 - log - log10 - log1p - log2 - arccos - arccosh - arcsin - arcsinh - arctan - arctanh - cos - cosh - sin - sinc - sinh - tan - tanh - deg2rad - rad2deg - degrees - radians - angle - round - around - round_ - rint - floor - ceil - trunc - fix - modf - frexp - hypot - arctan2 - logaddexp - logaddexp2 - corrcoef - correlate - cov - ldexp - bitwise_not - invert - bitwise_and - bitwise_or - bitwise_xor - left_shift - right_shift diff --git a/docs/conf.py b/docs/conf.py index cfe6fa1..5300dff 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,6 +33,8 @@ sys.path.insert(0, os.path.abspath('../')) import brainunit +import auto_generater +auto_generater.main() os.makedirs('apis/', exist_ok=True)