2727import numpy as np
2828
2929__all__ = [
30- "__upcast_float16_array " ,
31- "__downcast_float128_array " ,
32- "__supported_array_or_not_implemented " ,
30+ "_upcast_float16_array " ,
31+ "_downcast_float128_array " ,
32+ "_supported_array_or_not_implemented " ,
3333]
3434
3535
36- def __upcast_float16_array (x ):
36+ def _upcast_float16_array (x ):
3737 """
3838 Used in _scipy_fft to upcast float16 to float32,
3939 instead of float64, as mkl_fft would do
@@ -46,18 +46,18 @@ def __upcast_float16_array(x):
4646 if xdt == np .longdouble and not xdt == np .float64 :
4747 raise ValueError ("type %s is not supported" % xdt )
4848 if not isinstance (x , np .ndarray ):
49- __x = np .asarray (x )
50- xdt = __x .dtype
49+ _x = np .asarray (x )
50+ xdt = _x .dtype
5151 if xdt == np .half :
5252 # no half-precision routines, so convert to single precision
53- return np .asarray (__x , dtype = np .float32 )
53+ return np .asarray (_x , dtype = np .float32 )
5454 if xdt == np .longdouble and not xdt == np .float64 :
5555 raise ValueError ("type %s is not supported" % xdt )
56- return __x
56+ return _x
5757 return x
5858
5959
60- def __downcast_float128_array (x ):
60+ def _downcast_float128_array (x ):
6161 """
6262 Used in _numpy_fft to unsafely downcast float128/complex256 to
6363 complex128, instead of raising an error
@@ -69,27 +69,27 @@ def __downcast_float128_array(x):
6969 elif xdt == np .clongdouble and not xdt == np .complex128 :
7070 return np .asarray (x , dtype = np .complex128 )
7171 if not isinstance (x , np .ndarray ):
72- __x = np .asarray (x )
73- xdt = __x .dtype
72+ _x = np .asarray (x )
73+ xdt = _x .dtype
7474 if xdt == np .longdouble and not xdt == np .float64 :
7575 return np .asarray (x , dtype = np .float64 )
7676 elif xdt == np .clongdouble and not xdt == np .complex128 :
7777 return np .asarray (x , dtype = np .complex128 )
78- return __x
78+ return _x
7979 return x
8080
8181
82- def __supported_array_or_not_implemented (x ):
82+ def _supported_array_or_not_implemented (x ):
8383 """
8484 Used in _scipy_fft to convert array to float32,
85- float64, complex64, or complex128 type or return NotImplemented
85+ float64, complex64, or complex128 type or raise NotImplementedError
8686 """
87- __x = np .asarray (x )
87+ _x = np .asarray (x )
8888 black_list = [np .half ]
8989 if hasattr (np , "float128" ):
9090 black_list .append (np .float128 )
9191 if hasattr (np , "complex256" ):
9292 black_list .append (np .complex256 )
93- if __x .dtype in black_list :
94- return NotImplemented
95- return __x
93+ if _x .dtype in black_list :
94+ raise NotImplementedError
95+ return _x
0 commit comments