`min`, `max` and `square` don't accept complex arrays
See original GitHub issueNumpy has a (somewhat strange) policy of ordering according to real part first, and then breaking ties according to the imaginary part. CuPy currently raises the following error:
>>> a = cupy.array([1j, 2, 3])
>>> cupy.min(a)
TypeError Traceback (most recent call last)
[...]/cupy/core/fusion.py in __call__(self, *args, **kwargs)
819 return self._numpy_op(*args, **kwargs)
820 else:
--> 821 return self._cupy_op(*args, **kwargs)
822
823
[...]/cupy/statistics/order.py in amin(a, axis, out, keepdims, dtype)
30 """
31 # TODO(okuta): check type
---> 32 return a.min(axis=axis, dtype=dtype, out=out, keepdims=keepdims)
33
34
[...]/cupy/core/core.pyx in cupy.core.core.ndarray.min()
[...]/cupy/core/core.pyx in cupy.core.core.ndarray.min()
[...]/cupy/core/reduction.pxi in cupy.core.core.simple_reduction_function.__call__()
[...]/cupy/core/elementwise.pxi in cupy.core.core._guess_routine()
TypeError: Wrong type ((<class 'numpy.complex128'>,)) of arguments for cupy_min
I don’t know if you want to follow Numpy here, but I guess a more specific error message would be a good thing in that case.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
java - Why do we initially set min and max to the first value in ...
Setting min to 0 initially means that it will never change if all the values are > 0. Similarly for max if all...
Read more >Chapter 4. NumPy Basics: Arrays and Vectorized Computation
Here are some of the things it provides: ndarray , a fast and space-efficient multidimensional array providing vectorized arithmetic operations and ...
Read more >Computation on Arrays: Broadcasting | Python Data Science ...
Broadcasting is simply a set of rules for applying binary ufuncs (e.g., addition, subtraction, multiplication, etc.) on arrays of different sizes.
Read more >Look Ma, No For-Loops: Array Programming With NumPy
Extending the logic from the pure-Python example, you can find the difference between each price and a running minimum (element-wise), and then take...
Read more >Guidelines and examples of array formulas - Microsoft Support
You can use array formulas to perform complex tasks, such as: Quickly create sample datasets. Count the number of characters contained in a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kmaehashi this is fixed.
We implemented some ufunc for complex (#1281).