summaryrefslogtreecommitdiffstats
path: root/contrib/python/pythran
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-11-30 19:44:05 +0300
committerrobot-piglet <[email protected]>2025-11-30 19:56:49 +0300
commite7f3f0f49596fba751fdb7c6310083a9d552af52 (patch)
tree50fa8df13f5137de7445045c2407aa262f8090cf /contrib/python/pythran
parent283e67fc2de1fc2838ad9b63b8b9c801300cd20e (diff)
Intermediate changes
commit_hash:0bde86dc1169b5ec3d7f1262262be69fa22b0121
Diffstat (limited to 'contrib/python/pythran')
-rw-r--r--contrib/python/pythran/.dist-info/METADATA5
-rw-r--r--contrib/python/pythran/README.rst2
-rw-r--r--contrib/python/pythran/pythran/analyses/aliases.py13
-rw-r--r--contrib/python/pythran/pythran/analyses/dependencies.py2
-rw-r--r--contrib/python/pythran/pythran/backend.py13
-rw-r--r--contrib/python/pythran/pythran/config.py23
-rw-r--r--contrib/python/pythran/pythran/cxxgen.py2
-rw-r--r--contrib/python/pythran/pythran/cxxtypes.py154
-rw-r--r--contrib/python/pythran/pythran/dist.py18
-rw-r--r--contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/array/array.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/bin.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/complex.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/dict.hpp41
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp29
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/filter.hpp36
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/float_.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/in.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/iter.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/len.hpp2
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/list.hpp42
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/map.hpp109
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/max.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/min.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp21
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/ord.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/pow.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/range.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set.hpp32
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set/difference.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/set/union_.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/slice.hpp27
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp46
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/find.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp32
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/replace.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/split.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/splitlines.hpp35
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/sum.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp66
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/type.hpp131
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/builtins/zip.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/core.hpp17
-rw-r--r--contrib/python/pythran/pythran/pythonic/functools/partial.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/array/array.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp2
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/enumerate.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/filter.hpp22
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp16
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp68
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp23
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp20
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/slice.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp33
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str/splitlines.hpp22
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp53
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/itertools/combinations.hpp23
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/itertools/ifilter.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp22
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp21
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp21
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp16
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp31
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp32
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp46
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/array_split.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp29
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp41
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp320
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp29
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp67
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp48
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp71
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp42
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp48
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp42
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp2
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/frombuffer.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp20
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/interp.hpp67
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp29
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp21
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp20
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp47
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp30
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp40
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp17
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp51
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/vectorize.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/overloads.hpp27
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/random/sample.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp45
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/string/ascii_letters.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/NoneType.hpp90
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/array.hpp71
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/assignable.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/combined.hpp65
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/complex.hpp33
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/dict.hpp229
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp21
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp66
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/file.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/generator.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/int.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/list.hpp105
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp412
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp42
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_binary_op.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp39
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp410
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp447
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp137
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp16
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp63
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp142
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_ufunc.hpp17
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_unary_op.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp56
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/set.hpp39
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/slice.hpp32
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp76
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/str.hpp32
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/traits.hpp51
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp439
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/type.hpp17
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp28
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/allocate.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/broadcast_copy.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp41
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp20
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp63
-rw-r--r--contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/itertools/combinations.hpp20
-rw-r--r--contrib/python/pythran/pythran/pythonic/itertools/count.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/itertools/ifilter.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/itertools/islice.hpp37
-rw-r--r--contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp46
-rw-r--r--contrib/python/pythran/pythran/pythonic/itertools/product.hpp41
-rw-r--r--contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/all.hpp47
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/any.hpp44
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/append.hpp26
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/arange.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp96
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp23
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/around.hpp43
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/array.hpp43
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/array_split.hpp22
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp38
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp63
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/average.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp30
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/byte.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/complex128.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/complex256.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/complex64.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp93
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/copy.hpp16
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/correlate.hpp22
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp14
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/cross.hpp31
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp17
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/diag.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/diff.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp27
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/dot.hpp1878
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/empty.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/eye.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp86
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp27
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp58
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp38
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp62
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp36
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp46
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp1110
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp36
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/flip.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/float128.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/float32.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/float64.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/float_.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp26
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/frombuffer.hpp33
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp35
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/full.hpp22
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/imag.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/indices.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/insert.hpp35
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/int16.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/int32.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/int64.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/int8.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/int_.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/intc.hpp30
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/interp.hpp107
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/interp_core.hpp23
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/intersect1d.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp37
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/mean.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/median.hpp32
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp39
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp35
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray/sort.hpp48
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp27
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ones.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/outer.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/place.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/put.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/bytes.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp26
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/real.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp116
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp19
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/roll.hpp51
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp31
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/select.hpp61
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/setdiff1d.hpp17
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/short_.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/sort.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/split.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/stack.hpp35
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/std_.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/take.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/tile.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/trace.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp35
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/tri.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/trim_zeros.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ubyte.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/uint.hpp31
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/uint16.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/uint32.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/uint64.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/uint8.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/uintc.hpp30
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/unique.hpp165
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/ushort.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/var.hpp24
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/vdot.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/where.hpp25
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/zeros.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/add.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/contains.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/div.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/imax.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/imin.hpp18
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/is_.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/itemgetter.hpp22
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/mod.hpp15
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/mul.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/overloads.hpp36
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/sub.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/os/path/join.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/python/core.hpp88
-rw-r--r--contrib/python/pythran/pythran/pythonic/python/exception_handler.hpp138
-rw-r--r--contrib/python/pythran/pythran/pythonic/random/choice.hpp10
-rw-r--r--contrib/python/pythran/pythran/pythonic/random/sample.hpp8
-rw-r--r--contrib/python/pythran/pythran/pythonic/random/shuffle.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/time/time.hpp7
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/NoneType.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/array.hpp79
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/bool.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/cfun.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/complex.hpp81
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/dict.hpp70
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp27
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/exceptions.hpp108
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/file.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/finfo.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/float.hpp12
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/generator.hpp30
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/int.hpp72
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/list.hpp152
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/ndarray.hpp635
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/nditerator.hpp87
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_binary_op.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp13
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp155
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp330
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp125
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp16
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp153
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_unary_op.hpp5
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp54
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/pointer.hpp9
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/raw_array.hpp6
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/set.hpp69
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/slice.hpp129
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/str.hpp82
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/tuple.hpp212
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/type.hpp161
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp84
-rw-r--r--contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp11
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp119
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/iterator.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/meta.hpp2
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp4
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp38
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp40
-rw-r--r--contrib/python/pythran/pythran/pythonic/utils/shared_ref.hpp3
-rw-r--r--contrib/python/pythran/pythran/pythran-darwin.cfg2
-rw-r--r--contrib/python/pythran/pythran/pythran-default.cfg2
-rw-r--r--contrib/python/pythran/pythran/pythran-linux.cfg2
-rw-r--r--contrib/python/pythran/pythran/pythran-linux2.cfg2
-rw-r--r--contrib/python/pythran/pythran/pythran.cfg4
-rw-r--r--contrib/python/pythran/pythran/spec.py27
-rw-r--r--contrib/python/pythran/pythran/tables.py13
-rw-r--r--contrib/python/pythran/pythran/toolchain.py11
-rw-r--r--contrib/python/pythran/pythran/transformations/remove_named_arguments.py89
-rw-r--r--contrib/python/pythran/pythran/types/conversion.py21
-rw-r--r--contrib/python/pythran/pythran/types/signature.py7
-rw-r--r--contrib/python/pythran/pythran/types/type_dependencies.py8
-rw-r--r--contrib/python/pythran/pythran/types/types.py54
-rw-r--r--contrib/python/pythran/pythran/typing.py34
-rw-r--r--contrib/python/pythran/pythran/utils.py4
-rw-r--r--contrib/python/pythran/pythran/version.py2
-rw-r--r--contrib/python/pythran/pythran/xsimd/arch/xsimd_avx.hpp2
-rw-r--r--contrib/python/pythran/ya.make2
657 files changed, 8724 insertions, 10274 deletions
diff --git a/contrib/python/pythran/.dist-info/METADATA b/contrib/python/pythran/.dist-info/METADATA
index 977fa455ed0..9928f1f57b1 100644
--- a/contrib/python/pythran/.dist-info/METADATA
+++ b/contrib/python/pythran/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.4
Name: pythran
-Version: 0.18.0
+Version: 0.18.1
Summary: Ahead of Time compiler for numeric kernels
Author-email: Serge Guelton <[email protected]>
License: Copyright (c) 2012, HPC Project and Serge Guelton
@@ -39,7 +39,6 @@ Project-URL: Changelog, https://pythran.readthedocs.io/en/latest/Changelog.html
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
@@ -89,7 +88,7 @@ It is meant to efficiently compile **scientific programs**, and takes advantage
of multi-cores and SIMD instruction units.
Until 0.9.5 (included), Pythran was supporting Python 3 and Python 2.7.
-It now only supports Python **3**.
+It now only supports Python **3.7** and upward.
Installation
------------
diff --git a/contrib/python/pythran/README.rst b/contrib/python/pythran/README.rst
index eeb9384b2e9..004b314224c 100644
--- a/contrib/python/pythran/README.rst
+++ b/contrib/python/pythran/README.rst
@@ -15,7 +15,7 @@ It is meant to efficiently compile **scientific programs**, and takes advantage
of multi-cores and SIMD instruction units.
Until 0.9.5 (included), Pythran was supporting Python 3 and Python 2.7.
-It now only supports Python **3**.
+It now only supports Python **3.7** and upward.
Installation
------------
diff --git a/contrib/python/pythran/pythran/analyses/aliases.py b/contrib/python/pythran/pythran/analyses/aliases.py
index ff4f2a937fa..df9be140d5b 100644
--- a/contrib/python/pythran/pythran/analyses/aliases.py
+++ b/contrib/python/pythran/pythran/analyses/aliases.py
@@ -14,6 +14,7 @@ import gast as ast
from copy import deepcopy
from itertools import product
import io
+import numpy as np
IntrinsicAliases = dict()
@@ -288,7 +289,10 @@ class Aliases(ModuleAnalysis[GlobalDeclarations]):
for ra in func.return_alias(args_combination):
if isinstance(ra, ast.Subscript):
if isinstance(ra.value, ContainerOf):
- return_aliases.update(ra.value.containees)
+ if np.isnan(ra.value.index) or (isnum(ra.slice) and
+ ra.slice.value ==
+ ra.value.index):
+ return_aliases.update(ra.value.containees)
continue
return_aliases.add(ra)
return return_aliases
@@ -681,7 +685,12 @@ class Aliases(ModuleAnalysis[GlobalDeclarations]):
def wrap(t, aliases):
if isinstance(t, ast.Subscript):
alias, wrapped = wrap(t.value, aliases)
- return alias, {ContainerOf(wrapped)}
+ if isnum(t.slice):
+ return alias, {ContainerOf(wrapped, t.slice.value)}
+ elif isinstance(t.slice, ast.Slice):
+ return alias, wrapped
+ else:
+ return alias, {ContainerOf(wrapped)}
elif isinstance(t, ast.Name):
return t, aliases
else:
diff --git a/contrib/python/pythran/pythran/analyses/dependencies.py b/contrib/python/pythran/pythran/analyses/dependencies.py
index f153558f8c1..e0988e1038e 100644
--- a/contrib/python/pythran/pythran/analyses/dependencies.py
+++ b/contrib/python/pythran/pythran/analyses/dependencies.py
@@ -127,6 +127,8 @@ class Dependencies(ModuleAnalysis):
def visit_Constant(self, node):
if node.value is None:
self.result.add(('builtins', 'None'))
+ elif isinstance(node.value, bytes):
+ self.result.add(('types', 'str')) # FIXME: using str as backend
elif isinstance(node.value, str):
self.result.add(('types', 'str'))
elif isinstance(node.value, complex):
diff --git a/contrib/python/pythran/pythran/backend.py b/contrib/python/pythran/pythran/backend.py
index e5728ab3e0e..2793d52544c 100644
--- a/contrib/python/pythran/pythran/backend.py
+++ b/contrib/python/pythran/pythran/backend.py
@@ -298,12 +298,13 @@ class CxxFunction(ast.NodeVisitor):
def prepare_types(self, node):
# compute arg dump
+ dflt_v = [self.visit(n) for n in node.args.defaults]
dflt_argv = (
[None] * (len(node.args.args) - len(node.args.defaults)) +
- [self.visit(n) for n in node.args.defaults])
+ dflt_v)
dflt_argt = (
[None] * (len(node.args.args) - len(node.args.defaults)) +
- [self.types[n].sgenerate() for n in node.args.defaults])
+ ["decltype({})".format(v) for v in dflt_v])
# compute type dump
result_type = self.types[node][0]
@@ -1012,6 +1013,14 @@ class CxxFunction(ast.NodeVisitor):
ret = 'pythonic::builtins::None'
elif isinstance(node.value, bool):
ret = str(node.value).lower()
+ elif isinstance(node.value, bytes):
+ quoted = "".join('\\' + hex(b)[1:] for b in node.value)
+ # FIXME: using str type as backend
+ if len(node.value) == 1:
+ quoted = quoted.replace("'", r"\'")
+ ret = 'pythonic::types::chr(\'' + quoted + '\')'
+ else:
+ ret = 'pythonic::types::str("' + quoted + '")'
elif isinstance(node.value, str):
quoted = quote_cxxstring(node.value)
if len(node.value) == 1:
diff --git a/contrib/python/pythran/pythran/config.py b/contrib/python/pythran/pythran/config.py
index d24cc1fa486..43320cbff90 100644
--- a/contrib/python/pythran/pythran/config.py
+++ b/contrib/python/pythran/pythran/config.py
@@ -6,6 +6,7 @@ except ImportError:
import io
import logging
import os
+import re
from shlex import split as shsplit
import sys
@@ -226,6 +227,28 @@ def make_extension(python, **extra):
if ldflags is not None:
extension['extra_link_args'].extend(shsplit(ldflags))
+ major = minor = None
+ try:
+ limited_api = cfg.getboolean("backend", "limited_api")
+ if limited_api:
+ if sys.version_info < (3, 10):
+ logger.warning("Setting 'backend.limited_api' is only supported starting with Python 3.10, ignoring.")
+ else:
+ major, minor = 3, 7
+ except ValueError:
+ limited_api = cfg.get("backend", "limited_api")
+ if re.match(r'^3\.[0-9]+$', limited_api):
+ major, minor = map(int, limited_api.split('.'))
+ if (major, minor) < (3, 7):
+ logger.warning("Invalid 'backend.limited_api' entry, expecting at least 3.7, ignoring.")
+ major = minor = None
+ else:
+ logger.warning("Invalid 'backend.limited_api' entry, expected boolean or '3.7+', ignoring.")
+
+ if major is not None:
+ extension["define_macros"].append(f'Py_LIMITED_API={hex(major << 24 | minor << 16)}')
+ extension["py_limited_api"] = True
+
for k, w in extra.items():
extension[k].extend(w)
if cfg.getboolean('pythran', 'complex_hook'):
diff --git a/contrib/python/pythran/pythran/cxxgen.py b/contrib/python/pythran/pythran/cxxgen.py
index 83b9432c405..a75b151858f 100644
--- a/contrib/python/pythran/pythran/cxxgen.py
+++ b/contrib/python/pythran/pythran/cxxgen.py
@@ -653,7 +653,7 @@ class PythonModule(object):
types = []
for wrapper_name, wrapper_types, overload in overloads:
funcs.append("pythonic::types::ufunc_wrapper<{}, {}>".format(
- wrapper_name, ", ".join(wrapper_types)))
+ wrapper_name, ", ".join(wrapper_types[-1:] + wrapper_types[:-1])))
types.extend(overload)
ufunc = '''
diff --git a/contrib/python/pythran/pythran/cxxtypes.py b/contrib/python/pythran/pythran/cxxtypes.py
index c30cd884dc1..c3c5a2f6003 100644
--- a/contrib/python/pythran/pythran/cxxtypes.py
+++ b/contrib/python/pythran/pythran/cxxtypes.py
@@ -3,6 +3,7 @@ This module defines classes needed to manipulate c++ types from pythran.
'''
from inspect import isclass
+from pythran.utils import cxxid
class ordered_set(object):
@@ -47,8 +48,7 @@ class TypeBuilder(object):
typename __combined<long,char>::type
>>> builder.ArgumentType(4)
- typename std::remove_cv<typename std::remove_reference<argument_type4>::\
-type>::type
+ std::remove_cv_t<std::remove_reference_t<argument_type4>>
>>> builder.Assignable(builder.NamedType("long"))
typename pythonic::assignable<long>::type
@@ -59,9 +59,8 @@ type>::type
>>> builder.Lazy(builder.NamedType("long"))
typename pythonic::lazy<long>::type
- >>> builder.DeclType("toto")
- typename std::remove_cv<\
-typename std::remove_reference<decltype(toto)>::type>::type
+ >>> builder.FunctionType("toto")
+ toto
>>> builder.IteratorOfType(builder.NamedType('some'))
typename some::iterator
@@ -69,25 +68,23 @@ typename std::remove_reference<decltype(toto)>::type>::type
typename some::stuff::iterator
>>> builder.IteratorContentType(builder.NamedType('str'))
- typename std::remove_cv<typename std::iterator_traits<\
-typename std::remove_reference<str>::type::iterator>::value_type>::type
+ std::remove_cv_t<typename std::iterator_traits<\
+typename std::remove_reference_t<str>::iterator>::value_type>
>>> builder.GetAttr(builder.NamedType('complex'), 'real')
decltype(pythonic::builtins::getattr(\
pythonic::types::attr::REAL{}, std::declval<complex>()))
>>> builder.ReturnType(builder.NamedType('math::cos'), f_ty)
- decltype(std::declval<math::cos>()(std::declval<float>()))
+ std::result_of_t<math::cos(float)>
>>> t = builder.TupleType(i_ty, builder.NamedType('str'))
>>> builder.ElementType(1, t)
- typename std::tuple_element<1,typename std::remove_reference<\
-decltype(pythonic::types::make_tuple(std::declval<int>(), \
-std::declval<str>()))>::type>::type
+ std::tuple_element_t<1, std::remove_reference_t<pythonic::types::make_tuple_t<int, str>>>
>>> builder.ListType(builder.NamedType('int'))
- pythonic::types::list<typename std::remove_reference<int>::type>
+ pythonic::types::list<std::remove_reference_t<int>>
>>> builder.NDArrayType(builder.NamedType('int'), 1)
pythonic::types::ndarray<int, pythonic::types::pshape<long>>
@@ -96,14 +93,13 @@ std::declval<str>()))>::type>::type
pythonic::types::set<int>
>>> builder.TupleType(i_ty, builder.NamedType('bool'))
- decltype(pythonic::types::make_tuple(std::declval<int>(), \
-std::declval<bool>()))
+ pythonic::types::make_tuple_t<int, bool>
>>> builder.DictType(builder.NamedType('int'), builder.NamedType('float'))
pythonic::types::dict<int,float>
>>> builder.ContainerType(builder.NamedType('int'))
- container<typename std::remove_reference<int>::type>
+ container<std::remove_reference_t<int>>
>>> builder.IndexableType(builder.NamedType('int'))
indexable<int>
@@ -174,12 +170,10 @@ std::declval<bool>()))
A generic parametric type
"""
- prefix = "__ptype{0}"
-
def __init__(self, fun, ptype, index):
super(PType, self).__init__(fun=fun,
type=ptype,
- name=PType.prefix.format(index))
+ name=f"__ptype{index}")
def generate(self, ctx):
return ctx(self.type)
@@ -218,13 +212,11 @@ std::declval<bool>()))
def generate(self, ctx):
if self.arguments:
args = ", ".join(ctx(arg) for arg in self.arguments)
- template_params = "<{0}>".format(args)
+ template_params = f"<{args}>"
else:
template_params = ""
- return "typename {0}::type{1}::{2}".format(self.fun.name,
- template_params,
- self.name)
+ return f"typename {self.fun.name}::type{template_params}::{self.name}"
class CombinedTypes(Type):
"""
@@ -258,11 +250,22 @@ std::declval<bool>()))
sys.setrecursionlimit(current_recursion_limit)
return stypes[0]
else:
- stmp = 'typename __combined<{}>::type'.format(
- ','.join(stypes))
+ stmp = f'typename __combined<{",".join(stypes)}>::type'
sys.setrecursionlimit(current_recursion_limit)
return stmp
+ class IntegralConstant(Type):
+ """
+ A generic type object, to hold scalar types and such
+ """
+
+ def __init__(self, of, index):
+ super(IntegralConstant, self).__init__(of=of, index=index)
+
+ def generate(self, ctx):
+ ty = ctx(self.of)
+ return f"std::integral_constant<{ty}, {str(self.index).lower()}>"
+
class ArgumentType(Type):
"""
A type to hold function arguments
@@ -271,10 +274,7 @@ std::declval<bool>()))
super(ArgumentType, self).__init__(num=num)
def generate(self, _):
- argtype = "argument_type{0}".format(self.num)
- noref = "typename std::remove_reference<{0}>::type".format(
- argtype)
- return "typename std::remove_cv<{0}>::type".format(noref)
+ return f'std::remove_cv_t<std::remove_reference_t<argument_type{self.num}>>'
class DependentType(Type):
"""
@@ -287,6 +287,7 @@ std::declval<bool>()))
def iscombined(self):
return self.of.iscombined()
+
class Assignable(DependentType):
"""
A type which can be assigned
@@ -297,8 +298,7 @@ std::declval<bool>()))
"""
def generate(self, ctx):
- return 'typename pythonic::assignable<{0}>::type'.format(
- ctx(self.of))
+ return f'typename pythonic::assignable<{ctx(self.of)}>::type'
class AssignableNoEscape(DependentType):
"""
@@ -306,8 +306,7 @@ std::declval<bool>()))
"""
def generate(self, ctx):
- return 'typename pythonic::assignable_noescape<{0}>::type'.format(
- ctx(self.of))
+ return f'typename pythonic::assignable_noescape<{ctx(self.of)}>::type'
class Returnable(DependentType):
"""
@@ -321,8 +320,7 @@ std::declval<bool>()))
"""
def generate(self, ctx):
- return 'typename pythonic::returnable<{0}>::type'.format(
- ctx(self.of))
+ return f'typename pythonic::returnable<{ctx(self.of)}>::type'
class Lazy(DependentType):
"""
@@ -333,17 +331,18 @@ std::declval<bool>()))
"""
def generate(self, ctx):
- return 'typename pythonic::lazy<{}>::type'.format(ctx(self.of))
+ return f'typename pythonic::lazy<{ctx(self.of)}>::type'
- class DeclType(NamedType):
+ class FunctionType(Type):
"""
- Gather the type of a variable
+ Gather the type of a function reference
"""
+ def __init__(self, *path):
+ super(FunctionType, self).__init__(path=path)
+
def generate(self, _):
- return ('typename std::remove_cv<'
- 'typename std::remove_reference<'
- 'decltype({0})>::type>::type'.format(self.srepr))
+ return '::'.join(map(cxxid, self.path))
class AddConst(DependentType):
@@ -352,8 +351,7 @@ std::declval<bool>()))
'''
def generate(self, ctx):
of_type = ctx(self.of)
- return ('decltype(pythonic::types::as_const(std::declval<'
- + of_type + '>()))')
+ return f'decltype(pythonic::types::as_const(std::declval<{of_type}>()))'
class IteratorOfType(DependentType):
'''
@@ -362,9 +360,9 @@ std::declval<bool>()))
def generate(self, ctx):
container_type = ctx(self.of)
if container_type.startswith('typename'):
- return container_type + '::iterator'
+ return f'{container_type}::iterator'
else:
- return 'typename ' + container_type + '::iterator'
+ return f'typename {container_type}::iterator'
class IteratorContentType(DependentType):
'''
@@ -373,12 +371,7 @@ std::declval<bool>()))
def generate(self, ctx):
iterator_value_type = ctx(self.of)
- return 'typename std::remove_cv<{0}>::type'.format(
- 'typename std::iterator_traits<{0}>::value_type'.format(
- 'typename std::remove_reference<{0}>::type::iterator'
- .format(iterator_value_type)
- )
- )
+ return f'std::remove_cv_t<typename std::iterator_traits<typename std::remove_reference_t<{iterator_value_type}>::iterator>::value_type>'
class GetAttr(Type):
'''
@@ -388,9 +381,8 @@ std::declval<bool>()))
super(GetAttr, self).__init__(param=param, attr=attr)
def generate(self, ctx):
- return ('decltype(pythonic::builtins::getattr({}{{}}, {}))'
- .format('pythonic::types::attr::' + self.attr.upper(),
- 'std::declval<' + ctx(self.param) + '>()'))
+ attr = f'pythonic::types::attr::{self.attr.upper()}'
+ return f'decltype(pythonic::builtins::getattr({attr}{{}}, std::declval<{ctx(self.param)}>()))'
class ReturnType(Type):
'''
@@ -401,10 +393,9 @@ std::declval<bool>()))
def generate(self, ctx):
# the return type of a constructor is obvious
- cg = 'std::declval<{0}>()'.format(ctx(self.ftype))
- args = ("std::declval<{0}>()".format(ctx(arg))
- for arg in self.args)
- return 'decltype({0}({1}))'.format(cg, ", ".join(args))
+ cg = ctx(self.ftype)
+ args = [ctx(arg) for arg in self.args]
+ return f'std::result_of_t<{cg}({", ".join(args)})>'
class ElementType(Type):
'''
@@ -418,12 +409,16 @@ std::declval<bool>()))
return self.of.iscombined()
def generate(self, ctx):
- return 'typename std::tuple_element<{0},{1}>::type'.format(
- self.index,
- 'typename std::remove_reference<{0}>::type'.format(
- ctx(self.of)
- )
- )
+ return f'std::tuple_element_t<{self.index}, std::remove_reference_t<{ctx(self.of)}>>'
+
+ class TypeType(DependentType):
+ '''
+ Type holding a type
+ '''
+
+ def generate(self, ctx):
+ return f'pythonic::types::type_t<{ctx(self.of)}>'
+
class ListType(DependentType):
'''
@@ -431,9 +426,7 @@ std::declval<bool>()))
'''
def generate(self, ctx):
- return 'pythonic::types::list<{}>'.format(
- 'typename std::remove_reference<{0}>::type'.format(
- ctx(self.of)))
+ return f'pythonic::types::list<std::remove_reference_t<{ctx(self.of)}>>'
class SetType(DependentType):
'''
@@ -441,7 +434,7 @@ std::declval<bool>()))
'''
def generate(self, ctx):
- return 'pythonic::types::set<{0}>'.format(ctx(self.of))
+ return f'pythonic::types::set<{ctx(self.of)}>'
class TupleType(Type):
'''
@@ -455,9 +448,7 @@ std::declval<bool>()))
def generate(self, ctx):
elts = (ctx(of) for of in self.ofs)
- telts = ('std::declval<{0}>()'.format(elt) for elt in elts)
- return 'decltype(pythonic::types::make_tuple({0}))'.format(
- ", ".join(telts))
+ return f'pythonic::types::make_tuple_t<{", ".join(elts)}>'
class DictType(Type):
'''
@@ -472,8 +463,7 @@ std::declval<bool>()))
for of in (self.of_key, self.of_val)))
def generate(self, ctx):
- return 'pythonic::types::dict<{},{}>'.format(ctx(self.of_key),
- ctx(self.of_val))
+ return f'pythonic::types::dict<{ctx(self.of_key)},{ctx(self.of_val)}>'
class NDArrayType(DependentType):
'''
@@ -483,10 +473,7 @@ std::declval<bool>()))
super(DependentType, self).__init__(of=dtype, nbdims=nbdims)
def generate(self, ctx):
- return 'pythonic::types::ndarray<{}, pythonic::types::pshape<{}>>'.format(
- ctx(self.of),
- ", ".join((['long'] * self.nbdims))
- )
+ return f'pythonic::types::ndarray<{ctx(self.of)}, pythonic::types::pshape<{", ".join(["long"] * self.nbdims)}>>'
class ContainerType(DependentType):
@@ -495,8 +482,7 @@ std::declval<bool>()))
'''
def generate(self, ctx):
- return ('container<typename std::remove_reference<{0}>::type>'
- .format(ctx(self.of)))
+ return f'container<std::remove_reference_t<{ctx(self.of)}>>'
class IndexableType(DependentType):
'''
@@ -504,7 +490,7 @@ std::declval<bool>()))
'''
def generate(self, ctx):
- return 'indexable<{0}>'.format(ctx(self.of))
+ return f'indexable<{ctx(self.of)}>'
class IndexableContainerType(Type):
'''
@@ -520,10 +506,7 @@ std::declval<bool>()))
for of in (self.of_key, self.of_val)))
def generate(self, ctx):
- return ('indexable_container<'
- '{0}, typename std::remove_reference<{1}>::type'
- '>'
- .format(ctx(self.of_key), ctx(self.of_val)))
+ return f'indexable_container<{ctx(self.of_key)}, std::remove_reference_t<{ctx(self.of_val)}>>'
class ExpressionType(Type):
@@ -538,9 +521,8 @@ std::declval<bool>()))
return any(expr.iscombined() for expr in self.exprs)
def generate(self, ctx):
- gexprs = ["std::declval<{0}>()".format(ctx(expr))
- for expr in self.exprs]
- return 'decltype({0})'.format(self.op(*gexprs))
+ gexprs = [f"std::declval<{ctx(expr)}>()" for expr in self.exprs]
+ return f'decltype({self.op(*gexprs)})'
builder.UnknownType = Type()
diff --git a/contrib/python/pythran/pythran/dist.py b/contrib/python/pythran/pythran/dist.py
index 45cf299ca0c..c2146c451f2 100644
--- a/contrib/python/pythran/pythran/dist.py
+++ b/contrib/python/pythran/pythran/dist.py
@@ -15,18 +15,11 @@ except ImportError:
import os.path
import os
import re
+import sys
-try:
- from distutils.command.build_ext import build_ext as LegacyBuildExt
-except ImportError:
- from setuptools.command.build_ext import build_ext as LegacyBuildExt
-try:
- # `numpy.distutils` is deprecated, and won't be present on Python >=3.12
- # If it is installed, we need to use it though, so try-import it:
- from numpy.distutils.extension import Extension
-except ImportError:
- from setuptools.extension import Extension
+from setuptools.command.build_ext import build_ext as LegacyBuildExt
+from setuptools.extension import Extension
@@ -64,6 +57,7 @@ class PythranBuildExtMixIn(object):
'compiler': None,
'linker_exe': None,
'linker_so': None,
+ 'linker_so_cxx': None,
# Windows-like
'cc': None,
}
@@ -83,6 +77,8 @@ class PythranBuildExtMixIn(object):
if getattr(ext, 'cc', None) is not None:
try:
import distutils._msvccompiler as msvc
+ if not hasattr(msvc, "_find_exe"):
+ msvc = msvc.msvc
# install hook
find_exe = msvc._find_exe
@@ -92,7 +88,7 @@ class PythranBuildExtMixIn(object):
return find_exe(exe, *args, **kwargs)
msvc._find_exe = _find_exe
- except (AttributeError, ImportError):
+ except (AttributeError, ImportError) as e:
pass
# In general, distutils uses -Wstrict-prototypes, but this option
diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp
index cc566bea029..b46349788b3 100644
--- a/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp
+++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/count.hpp
@@ -11,8 +11,7 @@ namespace __dispatch__
{
template <class Any, class Value>
- auto count(Any &&any,
- Value &&value) -> decltype(any.count(std::forward<Value>(value)))
+ auto count(Any &&any, Value &&value) -> decltype(any.count(std::forward<Value>(value)))
{
return any.count(std::forward<Value>(value));
}
diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp
index 262c82d240c..b257e10d177 100644
--- a/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp
+++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/pop.hpp
@@ -10,8 +10,7 @@ PYTHONIC_NS_BEGIN
namespace __dispatch__
{
template <class Any, class... Arg0>
- auto pop(Any &&any,
- Arg0 &&...arg0) -> decltype(any.pop(std::forward<Arg0>(arg0)...))
+ auto pop(Any &&any, Arg0 &&...arg0) -> decltype(any.pop(std::forward<Arg0>(arg0)...))
{
return any.pop(std::forward<Arg0>(arg0)...);
}
diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp
index 3bdc0cdccb4..a14bf88cf11 100644
--- a/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/sort.hpp
@@ -13,24 +13,20 @@ namespace __dispatch__
template <class T, class... Args>
auto sort(types::list<T> &l, Args &&...args)
- -> decltype(pythonic::builtins::list::sort(l,
- std::forward<Args>(args)...))
+ -> decltype(pythonic::builtins::list::sort(l, std::forward<Args>(args)...))
{
return pythonic::builtins::list::sort(l, std::forward<Args>(args)...);
}
template <class T, class... Args>
auto sort(types::list<T> &&l, Args &&...args)
- -> decltype(pythonic::builtins::list::sort(std::move(l),
- std::forward<Args>(args)...))
+ -> decltype(pythonic::builtins::list::sort(std::move(l), std::forward<Args>(args)...))
{
- return pythonic::builtins::list::sort(std::move(l),
- std::forward<Args>(args)...);
+ return pythonic::builtins::list::sort(std::move(l), std::forward<Args>(args)...);
}
template <class Any, class... Args>
types::none_type sort(Any &&any, Args &&...args)
{
- return pythonic::numpy::ndarray::sort(std::forward<Any>(any),
- std::forward<Args>(args)...);
+ return pythonic::numpy::ndarray::sort(std::forward<Any>(any), std::forward<Args>(args)...);
}
} // namespace __dispatch__
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp b/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp
index 12f1acfbfe0..483302218be 100644
--- a/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/__dispatch__/update.hpp
@@ -11,8 +11,7 @@ namespace __dispatch__
{
template <class Any, class... Arg0>
- auto update(Any &&any, Arg0 &&...arg0)
- -> decltype(any.update(std::forward<Arg0>(arg0)...))
+ auto update(Any &&any, Arg0 &&...arg0) -> decltype(any.update(std::forward<Arg0>(arg0)...))
{
return any.update(std::forward<Arg0>(arg0)...);
}
diff --git a/contrib/python/pythran/pythran/pythonic/array/array.hpp b/contrib/python/pythran/pythran/pythonic/array/array.hpp
index 6edf437706f..41149a2f2e6 100644
--- a/contrib/python/pythran/pythran/pythonic/array/array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/array/array.hpp
@@ -14,15 +14,14 @@ namespace array
{
template <char c>
- types::array<typename details::typecodes<c>::type>
- array(std::integral_constant<char, c>)
+ types::array<typename details::typecodes<c>::type> array(std::integral_constant<char, c>)
{
return {0};
}
template <char c, class E>
- types::array<typename details::typecodes<c>::type>
- array(std::integral_constant<char, c>, E &&elts)
+ types::array<typename details::typecodes<c>::type> array(std::integral_constant<char, c>,
+ E &&elts)
{
return {std::forward<E>(elts)};
}
diff --git a/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp b/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp
index 84258fbe367..935cfd46f31 100644
--- a/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp
+++ b/contrib/python/pythran/pythran/pythonic/bisect/bisect.hpp
@@ -13,8 +13,7 @@ PYTHONIC_NS_BEGIN
namespace bisect
{
template <class X, class A>
- long bisect(X const &x, A const &a, long lo,
- details::bisect_fun<X, A> const &fun)
+ long bisect(X const &x, A const &a, long lo, details::bisect_fun<X, A> const &fun)
{
if (lo < 0)
throw types::ValueError("lo must be non-negative");
@@ -22,8 +21,7 @@ namespace bisect
}
template <class X, class A>
- long bisect(X const &x, A const &a, long lo, long hi,
- details::bisect_fun<X, A> const &fun)
+ long bisect(X const &x, A const &a, long lo, long hi, details::bisect_fun<X, A> const &fun)
{
if (lo < 0)
throw types::ValueError("lo must be non-negative");
diff --git a/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp b/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp
index 00e7cf4ea45..b4b92ad4c80 100644
--- a/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp
+++ b/contrib/python/pythran/pythran/pythonic/bisect/bisect_left.hpp
@@ -21,8 +21,7 @@ namespace bisect
template <class X, class A>
long bisect_left(X const &x, A const &a, long lo, long hi)
{
- return bisect(x, a, lo, hi,
- std::lower_bound<typename X::const_iterator, A>);
+ return bisect(x, a, lo, hi, std::lower_bound<typename X::const_iterator, A>);
}
} // namespace bisect
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp b/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp
index f53fbc46192..83daaf33880 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/bin.hpp
@@ -15,8 +15,7 @@ PYTHONIC_NS_BEGIN
namespace builtins
{
template <class T>
- typename std::enable_if<std::is_scalar<T>::value, types::str>::type
- bin(T const &v)
+ std::enable_if_t<std::is_scalar<T>::value, types::str> bin(T const &v)
{
using UT = typename std::make_unsigned<T>::type;
if (v < T{0})
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp b/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp
index c50889b659d..d2e178d579f 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/bool_.hpp
@@ -39,4 +39,28 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::bool_>::convert(builtins::functor::bool_ const &c)
+{
+ return (PyObject *)&PyBool_Type;
+}
+
+inline bool from_python<builtins::functor::bool_>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyBool_Type;
+}
+
+inline builtins::functor::bool_ from_python<builtins::functor::bool_>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/complex.hpp b/contrib/python/pythran/pythran/pythonic/builtins/complex.hpp
index 9629896d943..9095ee38077 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/complex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/complex.hpp
@@ -21,4 +21,29 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::complex>::convert(builtins::functor::complex const &c)
+{
+ return (PyObject *)&PyComplex_Type;
+}
+
+inline bool from_python<builtins::functor::complex>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyComplex_Type || obj == (PyObject *)&PyCDoubleArrType_Type;
+}
+
+inline builtins::functor::complex from_python<builtins::functor::complex>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp
index 6b54af33289..34a1d4a00c7 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/dict.hpp
@@ -29,13 +29,11 @@ namespace builtins
template <class Iterable>
auto dict(Iterable &&iterable)
- -> types::dict<
- typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type,
- typename std::decay<decltype(std::get<1>(*iterable.begin()))>::type>
+ -> types::dict<std::decay_t<decltype(std::get<0>(*iterable.begin()))>,
+ std::decay_t<decltype(std::get<1>(*iterable.begin()))>>
{
- types::dict<
- typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type,
- typename std::decay<decltype(std::get<1>(*iterable.begin()))>::type>
+ types::dict<std::decay_t<decltype(std::get<0>(*iterable.begin()))>,
+ std::decay_t<decltype(std::get<1>(*iterable.begin()))>>
out = types::empty_dict();
for (auto const &i : iterable)
out[std::get<0>(i)] = std::get<1>(i);
@@ -45,4 +43,35 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::dict>::convert(builtins::functor::dict const &c)
+{
+ return (PyObject *)&PyDict_Type;
+}
+
+inline bool from_python<builtins::functor::dict>::is_convertible(PyObject *obj)
+{
+ if (obj == (PyObject *)&PyDict_Type)
+ return true;
+ PyObject *Origin = PyObject_GetAttrString(obj, "__origin__");
+ if (!Origin)
+ return false;
+ bool res = (Origin == (PyObject *)&PyDict_Type);
+ Py_DECREF(Origin);
+ return res;
+}
+
+inline builtins::functor::dict from_python<builtins::functor::dict>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp
index 3cfbcfb9ce9..6178eb021da 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/fromkeys.hpp
@@ -17,10 +17,10 @@ namespace builtins
{
template <class Iterable, class V>
- types::dict<typename std::remove_reference<Iterable>::type::value_type, V>
- fromkeys(Iterable &&iter, V const &v)
+ types::dict<typename std::remove_reference_t<Iterable>::value_type, V> fromkeys(Iterable &&iter,
+ V const &v)
{
- types::dict<typename std::remove_reference<Iterable>::type::value_type,
+ types::dict<typename std::remove_reference_t<Iterable>::value_type,
V>
D = types::empty_dict(); // Allocate default capacity to dict
for (auto const &i : iter)
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp b/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp
index f88f6f31cc3..42f97898006 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/dict/get.hpp
@@ -15,8 +15,7 @@ namespace builtins
namespace dict
{
template <class K, class V, class W, class X>
- typename __combined<V, X>::type get(types::dict<K, V> const &d, W const &k,
- X const &default_)
+ typename __combined<V, X>::type get(types::dict<K, V> const &d, W const &k, X const &default_)
{
return d.get(k, default_);
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp b/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp
index faab84a4558..47dbc184b91 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/enumerate.hpp
@@ -22,15 +22,13 @@ namespace builtins
}
template <class Iterator>
- enumerate_iterator<Iterator>::enumerate_iterator(Iterator const &iter,
- long first)
+ enumerate_iterator<Iterator>::enumerate_iterator(Iterator const &iter, long first)
: value(first), iter(iter)
{
}
template <class Iterator>
- enumerate_iterator<Iterator> &
- enumerate_iterator<Iterator>::operator+=(long n)
+ enumerate_iterator<Iterator> &enumerate_iterator<Iterator>::operator+=(long n)
{
value += n, iter += n;
return *this;
@@ -42,29 +40,25 @@ namespace builtins
// TODO : We could handle case with && without size if there is a
// performances benefits
template <class Iterator>
- bool enumerate_iterator<Iterator>::operator!=(
- enumerate_iterator<Iterator> const &other) const
+ bool enumerate_iterator<Iterator>::operator!=(enumerate_iterator<Iterator> const &other) const
{
return !(*this == other);
}
template <class Iterator>
- bool enumerate_iterator<Iterator>::operator<(
- enumerate_iterator const &other) const
+ bool enumerate_iterator<Iterator>::operator<(enumerate_iterator const &other) const
{
return iter < other.iter;
}
template <class Iterator>
- bool enumerate_iterator<Iterator>::operator==(
- enumerate_iterator<Iterator> const &other) const
+ bool enumerate_iterator<Iterator>::operator==(enumerate_iterator<Iterator> const &other) const
{
return iter == other.iter;
}
template <class Iterator>
- long enumerate_iterator<Iterator>::operator-(
- enumerate_iterator<Iterator> const &other) const
+ long enumerate_iterator<Iterator>::operator-(enumerate_iterator<Iterator> const &other) const
{
return iter - other.iter;
}
@@ -77,8 +71,7 @@ namespace builtins
template <class Iterable>
enumerate<Iterable>::enumerate(Iterable seq, long first)
- : Iterable(seq), iterator(Iterable::begin(), first),
- end_iter(Iterable::end(), -1)
+ : Iterable(seq), iterator(Iterable::begin(), first), end_iter(Iterable::end(), -1)
{
}
@@ -89,8 +82,7 @@ namespace builtins
}
template <class Iterable>
- typename enumerate<Iterable>::iterator const &
- enumerate<Iterable>::begin() const
+ typename enumerate<Iterable>::iterator const &enumerate<Iterable>::begin() const
{
return *this;
}
@@ -105,9 +97,8 @@ namespace builtins
/// enumerate implementation
template <class Iterable>
- details::enumerate<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>
- enumerate(Iterable &&seq, long first)
+ details::enumerate<std::remove_cv_t<std::remove_reference_t<Iterable>>> enumerate(Iterable &&seq,
+ long first)
{
return {std::forward<Iterable>(seq), first};
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/filter.hpp b/contrib/python/pythran/pythran/pythonic/builtins/filter.hpp
index 8708be72122..00fe3c8b34a 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/filter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/filter.hpp
@@ -29,28 +29,24 @@ namespace builtins
filter_iterator<Operator, List0>::filter_iterator(Operator _op, List0 &_seq)
: op(_op), iter(_seq.begin()), iter_end(_seq.end())
{
- if (iter != iter_end &&
- !test_filter(std::is_same<types::none_type, Operator>()))
+ if (iter != iter_end && !test_filter(std::is_same<types::none_type, Operator>()))
next_value();
}
template <typename Operator, typename List0>
- filter_iterator<Operator, List0>::filter_iterator(itertools::npos,
- Operator _op, List0 &_seq)
+ filter_iterator<Operator, List0>::filter_iterator(itertools::npos, Operator _op, List0 &_seq)
: op(_op), iter(_seq.end()), iter_end(_seq.end())
{
}
template <typename Operator, typename List0>
- typename List0::value_type
- filter_iterator<Operator, List0>::operator*() const
+ typename List0::value_type filter_iterator<Operator, List0>::operator*() const
{
return *iter;
}
template <typename Operator, typename List0>
- filter_iterator<Operator, List0> &
- filter_iterator<Operator, List0>::operator++()
+ filter_iterator<Operator, List0> &filter_iterator<Operator, List0>::operator++()
{
next_value();
return *this;
@@ -66,30 +62,26 @@ namespace builtins
}
template <typename Operator, typename List0>
- bool filter_iterator<Operator, List0>::operator==(
- filter_iterator const &other) const
+ bool filter_iterator<Operator, List0>::operator==(filter_iterator const &other) const
{
return !(iter != other.iter);
}
template <typename Operator, typename List0>
- bool filter_iterator<Operator, List0>::operator!=(
- filter_iterator const &other) const
+ bool filter_iterator<Operator, List0>::operator!=(filter_iterator const &other) const
{
return iter != other.iter;
}
template <typename Operator, typename List0>
- bool filter_iterator<Operator, List0>::operator<(
- filter_iterator const &other) const
+ bool filter_iterator<Operator, List0>::operator<(filter_iterator const &other) const
{
return iter != other.iter;
}
template <typename Operator, typename List0>
filter<Operator, List0>::filter(Operator _op, List0 const &_seq)
- : utils::iterator_reminder<false, List0>(_seq),
- iterator(_op, this->values),
+ : utils::iterator_reminder<false, List0>(_seq), iterator(_op, this->values),
end_iter(itertools::npos(), _op, this->values)
{
}
@@ -101,25 +93,21 @@ namespace builtins
}
template <typename Operator, typename List0>
- typename filter<Operator, List0>::iterator const &
- filter<Operator, List0>::begin() const
+ typename filter<Operator, List0>::iterator const &filter<Operator, List0>::begin() const
{
return *this;
}
template <typename Operator, typename List0>
- typename filter<Operator, List0>::iterator const &
- filter<Operator, List0>::end() const
+ typename filter<Operator, List0>::iterator const &filter<Operator, List0>::end() const
{
return end_iter;
}
} // namespace details
template <typename Operator, typename List0>
- details::filter<typename std::remove_cv<
- typename std::remove_reference<Operator>::type>::type,
- typename std::remove_cv<
- typename std::remove_reference<List0>::type>::type>
+ details::filter<std::remove_cv_t<std::remove_reference_t<Operator>>,
+ std::remove_cv_t<std::remove_reference_t<List0>>>
filter(Operator &&_op, List0 &&_seq)
{
return {std::forward<Operator>(_op), std::forward<List0>(_seq)};
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/float_.hpp b/contrib/python/pythran/pythran/pythonic/builtins/float_.hpp
index 52f324cce64..9f7914b7f39 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/float_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/float_.hpp
@@ -26,4 +26,29 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::float_>::convert(builtins::functor::float_ const &c)
+{
+ return (PyObject *)&PyFloat_Type;
+}
+
+inline bool from_python<builtins::functor::float_>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyFloat_Type || obj == (PyObject *)&PyDoubleArrType_Type;
+}
+
+inline builtins::functor::float_ from_python<builtins::functor::float_>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/in.hpp b/contrib/python/pythran/pythran/pythonic/builtins/in.hpp
index a4f57ee1fa2..38a77829048 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/in.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/in.hpp
@@ -35,8 +35,7 @@ namespace details
template <class T, class V>
bool in(T &&t, V const &v)
{
- using RT =
- typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+ using RT = std::remove_cv_t<std::remove_reference_t<T>>;
static bool constexpr has_contains = types::has_contains<RT, V>::value;
return details::in<has_contains>()(std::forward<T>(t), v);
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp b/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp
index b2c155c136a..3f008df913b 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/iter.hpp
@@ -48,9 +48,7 @@ namespace builtins
/// iter implementation
template <class T>
- details::iter<
- typename std::remove_cv<typename std::remove_reference<T>::type>::type>
- iter(T &&t)
+ details::iter<std::remove_cv_t<std::remove_reference_t<T>>> iter(T &&t)
{
return {std::forward<T>(t)};
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/len.hpp b/contrib/python/pythran/pythran/pythonic/builtins/len.hpp
index 2c4e4f44498..76bf6fcfaed 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/len.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/len.hpp
@@ -20,7 +20,7 @@ namespace builtins
}
template <class T>
- typename std::enable_if<types::has_size<T>::value, long>::type len(T const &t)
+ std::enable_if_t<types::has_size<T>::value, long> len(T const &t)
{
return t.size();
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list.hpp
index 95d065d6f9a..9f426ae33c6 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/list.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/list.hpp
@@ -28,18 +28,46 @@ namespace builtins
}
template <class Iterable>
- types::list<typename std::decay<typename std::iterator_traits<
- typename std::remove_reference<Iterable>::type::iterator>::value_type>::
- type>
+ types::list<std::decay_t<typename std::iterator_traits<
+ typename std::remove_reference_t<Iterable>::iterator>::value_type>>
list(Iterable &&t)
{
- return types::list<typename std::decay<
- typename std::iterator_traits<typename std::remove_reference<
- Iterable>::type::iterator>::value_type>::type>(t.begin(),
- t.end());
+ return types::list<std::decay_t<typename std::iterator_traits<
+ typename std::remove_reference_t<Iterable>::iterator>::value_type>>(t.begin(), t.end());
}
} // namespace anonymous
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::list>::convert(builtins::functor::list const &c)
+{
+ return (PyObject *)&PyList_Type;
+}
+
+inline bool from_python<builtins::functor::list>::is_convertible(PyObject *obj)
+{
+ if (obj == (PyObject *)&PyList_Type)
+ return true;
+ PyObject *Origin = PyObject_GetAttrString(obj, "__origin__");
+ if (!Origin)
+ return false;
+ bool res = (Origin == (PyObject *)&PyList_Type);
+ Py_DECREF(Origin);
+ return res;
+}
+
+inline builtins::functor::list from_python<builtins::functor::list>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp
index e1321d79ff7..bd320f217be 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/list/extend.hpp
@@ -16,9 +16,7 @@ namespace builtins
namespace list
{
template <class T0, class T1>
- typename std::enable_if<
- !std::is_same<typename std::decay<T0>::type, types::empty_list>::value,
- types::none_type>::type
+ std::enable_if_t<!std::is_same<std::decay_t<T0>, types::empty_list>::value, types::none_type>
extend(T0 &&seq, T1 const &add)
{
std::forward<T0>(seq) += add;
@@ -26,9 +24,7 @@ namespace builtins
}
template <class T0, class T1>
- typename std::enable_if<
- std::is_same<typename std::decay<T0>::type, types::empty_list>::value,
- types::none_type>::type
+ std::enable_if_t<std::is_same<std::decay_t<T0>, types::empty_list>::value, types::none_type>
extend(T0 &&seq, T1 const &add)
{
return {};
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp b/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp
index 913b87d4f9f..188cf1a4ab1 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/list/sort.hpp
@@ -27,9 +27,8 @@ namespace builtins
template <class T, class K>
types::none_type sort(types::list<T> &seq, K key)
{
- pdqsort(seq.begin(), seq.end(), [&key](T const &self, T const &other) {
- return key(self) < key(other);
- });
+ pdqsort(seq.begin(), seq.end(),
+ [&key](T const &self, T const &other) { return key(self) < key(other); });
return builtins::None;
}
} // namespace list
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/map.hpp b/contrib/python/pythran/pythran/pythonic/builtins/map.hpp
index ac6eb0354a1..e25bacfd8bc 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/map.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/map.hpp
@@ -24,19 +24,17 @@ namespace builtins
template <typename Operator, typename... Iters>
template <size_t... I>
- map_iterator<Operator, Iters...>::map_iterator(Operator const &op,
- std::tuple<Iters...> &_iters,
- utils::index_sequence<I...>)
+ map_iterator<Operator, Iters...>::map_iterator(Operator const &op, std::tuple<Iters...> &_iters,
+ std::index_sequence<I...>)
: it(std::get<I>(_iters).begin()...), _op(op)
{
}
template <typename Operator, typename... Iters>
template <size_t... I>
- map_iterator<Operator, Iters...>::map_iterator(itertools::npos,
- Operator const &op,
+ map_iterator<Operator, Iters...>::map_iterator(itertools::npos, Operator const &op,
std::tuple<Iters...> &_iters,
- utils::index_sequence<I...>)
+ std::index_sequence<I...>)
: it(std::get<I>(_iters).end()...), _op(op)
{
}
@@ -44,8 +42,7 @@ namespace builtins
template <typename Operator, typename... Iters>
template <size_t... I>
typename map_res<Operator, Iters...>::type
- map_iterator<Operator, Iters...>::get_value(utils::index_sequence<I...>,
- std::false_type) const
+ map_iterator<Operator, Iters...>::get_value(std::index_sequence<I...>, std::false_type) const
{
return _op(*std::get<I>(it)...);
}
@@ -53,32 +50,29 @@ namespace builtins
template <typename Operator, typename... Iters>
template <size_t... I>
typename map_res<Operator, Iters...>::type
- map_iterator<Operator, Iters...>::get_value(utils::index_sequence<I...>,
- std::true_type) const
+ map_iterator<Operator, Iters...>::get_value(std::index_sequence<I...>, std::true_type) const
{
return types::make_tuple(*std::get<I>(it)...);
}
template <typename Operator, typename... Iters>
- typename map_res<Operator, Iters...>::type
- map_iterator<Operator, Iters...>::operator*() const
+ typename map_res<Operator, Iters...>::type map_iterator<Operator, Iters...>::operator*() const
{
- return get_value(utils::make_index_sequence<sizeof...(Iters)>{},
+ return get_value(std::make_index_sequence<sizeof...(Iters)>{},
std::is_same<Operator, types::none_type>());
}
template <typename Operator, typename... Iters>
template <size_t... I>
- void map_iterator<Operator, Iters...>::next(utils::index_sequence<I...>)
+ void map_iterator<Operator, Iters...>::next(std::index_sequence<I...>)
{
utils::fwd(++std::get<I>(it)...);
}
template <typename Operator, typename... Iters>
- map_iterator<Operator, Iters...> &
- map_iterator<Operator, Iters...>::operator++()
+ map_iterator<Operator, Iters...> &map_iterator<Operator, Iters...>::operator++()
{
- next(utils::make_index_sequence<sizeof...(Iters)>{});
+ next(std::make_index_sequence<sizeof...(Iters)>{});
return *this;
}
@@ -97,16 +91,14 @@ namespace builtins
}
template <typename Operator, typename... Iters>
- map_iterator<Operator, Iters...> &
- map_iterator<Operator, Iters...>::operator+=(long i)
+ map_iterator<Operator, Iters...> &map_iterator<Operator, Iters...>::operator+=(long i)
{
advance(i, utils::int_<sizeof...(Iters) - 1>());
return *this;
}
template <typename Operator, typename... Iters>
- map_iterator<Operator, Iters...>
- map_iterator<Operator, Iters...>::operator+(long i) const
+ map_iterator<Operator, Iters...> map_iterator<Operator, Iters...>::operator+(long i) const
{
map_iterator<Operator, Iters...> other(*this);
other += i;
@@ -115,16 +107,15 @@ namespace builtins
template <typename Operator, typename... Iters>
template <size_t N>
- bool map_iterator<Operator, Iters...>::equal(
- map_iterator<Operator, Iters...> const &other, utils::int_<N>) const
+ bool map_iterator<Operator, Iters...>::equal(map_iterator<Operator, Iters...> const &other,
+ utils::int_<N>) const
{
- return std::get<N>(other.it) == std::get<N>(it) ||
- equal(other, utils::int_<N - 1>());
+ return std::get<N>(other.it) == std::get<N>(it) || equal(other, utils::int_<N - 1>());
}
template <typename Operator, typename... Iters>
- bool map_iterator<Operator, Iters...>::equal(
- map_iterator<Operator, Iters...> const &other, utils::int_<0>) const
+ bool map_iterator<Operator, Iters...>::equal(map_iterator<Operator, Iters...> const &other,
+ utils::int_<0>) const
{
return std::get<0>(other.it) == std::get<0>(it);
}
@@ -144,31 +135,54 @@ namespace builtins
}
template <typename Operator, typename... Iters>
- bool map_iterator<Operator, Iters...>::operator<(
+ template <size_t N>
+ bool map_iterator<Operator, Iters...>::lt(map_iterator<Operator, Iters...> const &other,
+ utils::int_<N>) const
+ {
+ return std::get<N>(it) < std::get<N>(other.it) ||
+ ((std::get<N>(it) == std::get<N>(other.it)) && lt(other, utils::int_<N - 1>()));
+ }
+
+ template <typename Operator, typename... Iters>
+ bool map_iterator<Operator, Iters...>::lt(map_iterator<Operator, Iters...> const &other,
+ utils::int_<0>) const
+ {
+ return std::get<0>(it) < std::get<0>(other.it);
+ }
+
+ template <typename Operator, typename... Iters>
+ bool
+ map_iterator<Operator, Iters...>::operator<(map_iterator<Operator, Iters...> const &other) const
+ {
+ return lt(other, utils::int_<sizeof...(Iters) - 1>());
+ }
+
+ template <typename Operator, typename... Iters>
+ bool map_iterator<Operator, Iters...>::operator<=(
map_iterator<Operator, Iters...> const &other) const
{
- return !(*this == other);
+ return (*this == other) || (*this < other);
}
template <typename Operator, typename... Iters>
template <size_t N>
- long map_iterator<Operator, Iters...>::min_len(
- map_iterator<Operator, Iters...> const &other, utils::int_<N>) const
+ long map_iterator<Operator, Iters...>::min_len(map_iterator<Operator, Iters...> const &other,
+ utils::int_<N>) const
{
return std::min((long)(std::get<N>(it) - std::get<N>(other.it)),
min_len(other, utils::int_<N - 1>()));
}
template <typename Operator, typename... Iters>
- long map_iterator<Operator, Iters...>::min_len(
- map_iterator<Operator, Iters...> const &other, utils::int_<0>) const
+ long map_iterator<Operator, Iters...>::min_len(map_iterator<Operator, Iters...> const &other,
+ utils::int_<0>) const
{
return std::get<0>(it) - std::get<0>(other.it);
}
template <typename Operator, typename... Iters>
- long map_iterator<Operator, Iters...>::operator-(
- map_iterator<Operator, Iters...> const &other) const
+ long
+ map_iterator<Operator, Iters...>::operator-(map_iterator<Operator, Iters...> const &other) const
{
return min_len(other, utils::int_<sizeof...(Iters) - 1>());
}
@@ -176,13 +190,11 @@ namespace builtins
template <typename Operator, typename... Iters>
template <class... Types>
map<Operator, Iters...>::map(Operator const &_op, Types &&..._iters)
- : utils::iterator_reminder<true, Iters...>(
- std::forward<Types>(_iters)...),
- map_iterator<Operator, Iters...>(
- _op, this->values,
- utils::make_index_sequence<sizeof...(Iters)>{}),
+ : utils::iterator_reminder<true, Iters...>(std::forward<Types>(_iters)...),
+ map_iterator<Operator, Iters...>(_op, this->values,
+ std::make_index_sequence<sizeof...(Iters)>{}),
end_iter(itertools::npos(), _op, this->values,
- utils::make_index_sequence<sizeof...(Iters)>{})
+ std::make_index_sequence<sizeof...(Iters)>{})
{
}
@@ -193,27 +205,22 @@ namespace builtins
}
template <typename Operator, typename... Iters>
- typename map<Operator, Iters...>::iterator const &
- map<Operator, Iters...>::begin() const
+ typename map<Operator, Iters...>::iterator const &map<Operator, Iters...>::begin() const
{
return *this;
}
template <typename Operator, typename... Iters>
- typename map<Operator, Iters...>::iterator const &
- map<Operator, Iters...>::end() const
+ typename map<Operator, Iters...>::iterator const &map<Operator, Iters...>::end() const
{
return end_iter;
}
} // namespace details
template <typename Operator, typename... Iter>
- auto map(Operator &&_op, Iter &&...iters)
- -> details::map<
- typename std::remove_cv<
- typename std::remove_reference<Operator>::type>::type,
- typename types::iterator<typename std::remove_cv<
- typename std::remove_reference<Iter>::type>::type>::type...>
+ details::map<std::remove_cv_t<std::remove_reference_t<Operator>>,
+ typename types::iterator<std::remove_cv_t<std::remove_reference_t<Iter>>>::type...>
+ map(Operator &&_op, Iter &&...iters)
{
return {std::forward<Operator>(_op), std::forward<Iter>(iters)...};
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/max.hpp b/contrib/python/pythran/pythran/pythonic/builtins/max.hpp
index aeb9eb79701..2f57fbdf2ea 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/max.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/max.hpp
@@ -14,11 +14,9 @@ namespace builtins
template <class... Types>
auto max(Types &&...values)
- -> decltype(details::minmax(operator_::functor::lt{},
- std::forward<Types>(values)...))
+ -> decltype(details::minmax(operator_::functor::lt{}, std::forward<Types>(values)...))
{
- return details::minmax(operator_::functor::lt{},
- std::forward<Types>(values)...);
+ return details::minmax(operator_::functor::lt{}, std::forward<Types>(values)...);
}
} // namespace builtins
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/min.hpp b/contrib/python/pythran/pythran/pythonic/builtins/min.hpp
index 915a711ce81..bad79a1d593 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/min.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/min.hpp
@@ -14,11 +14,9 @@ namespace builtins
template <class... Types>
auto min(Types &&...values)
- -> decltype(details::minmax(operator_::functor::gt{},
- std::forward<Types>(values)...))
+ -> decltype(details::minmax(operator_::functor::gt{}, std::forward<Types>(values)...))
{
- return details::minmax(operator_::functor::gt{},
- std::forward<Types>(values)...);
+ return details::minmax(operator_::functor::gt{}, std::forward<Types>(values)...);
}
} // namespace builtins
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp b/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp
index f74a25cdeb4..f155e3f06b0 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/minmax.hpp
@@ -14,32 +14,29 @@ namespace builtins
namespace details
{
template <typename Op, class T>
- typename std::decay<T>::type::value_type minmax(Op const &op, T &&t)
+ typename std::decay_t<T>::value_type minmax(Op const &op, T &&t)
{
return *std::max_element(t.begin(), t.end(), op);
}
template <typename Op, class T, class F>
- typename std::decay<T>::type::value_type minmax(Op const &op, T &&t,
- types::kwonly, F key)
+ typename std::decay_t<T>::value_type minmax(Op const &op, T &&t, types::kwonly, F key)
{
using value_type = decltype(*t.begin());
- return *std::max_element(
- t.begin(), t.end(),
- [op, key](value_type const &self, value_type const &other) {
- return op(key(self), key(other));
- });
+ return *std::max_element(t.begin(), t.end(),
+ [op, key](value_type const &self, value_type const &other) {
+ return op(key(self), key(other));
+ });
}
template <class Op, class T0, class T1, class... Types>
- typename std::enable_if<!std::is_same<T1, types::kwonly>::value,
- typename __combined<T0, T1, Types...>::type>::type
+ std::enable_if_t<!std::is_same<T1, types::kwonly>::value,
+ typename __combined<T0, T1, Types...>::type>
minmax(Op const &op, T0 const &t0, T1 const &t1, Types const &...ts)
{
using value_type = typename __combined<T0, T1, Types...>::type;
std::initializer_list<value_type> values = {
- static_cast<value_type>(t0), static_cast<value_type>(t1),
- static_cast<value_type>(ts)...};
+ static_cast<value_type>(t0), static_cast<value_type>(t1), static_cast<value_type>(ts)...};
return minmax(op, values);
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp b/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp
index 07f941c7f33..887fd089ebb 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/ord.hpp
@@ -15,9 +15,8 @@ namespace builtins
long ord(types::str const &v)
{
if (v.size() != 1)
- throw types::TypeError(
- "ord() expected a character, but string of length " +
- std::to_string(v.size()) + " found");
+ throw types::TypeError("ord() expected a character, but string of length " +
+ std::to_string(v.size()) + " found");
return (long)v.chars()[0];
}
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pow.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pow.hpp
index 80c2235236e..6cc8d8cc60c 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/pow.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/pow.hpp
@@ -30,8 +30,7 @@ namespace builtins
}
template <class... Types>
- auto pow(Types &&...args)
- -> decltype(numpy::functor::power{}(std::forward<Types>(args)...))
+ auto pow(Types &&...args) -> decltype(numpy::functor::power{}(std::forward<Types>(args)...))
{
return numpy::functor::power{}(std::forward<Types>(args)...);
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp
index 03b9f8fbd8b..40505ddae31 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/len_set.hpp
@@ -18,8 +18,8 @@ namespace builtins
template <class Iterable>
long len_set(Iterable const &s)
{
- return std::set<typename std::iterator_traits<
- typename Iterable::iterator>::value_type>(s.begin(), s.end())
+ return std::set<typename std::iterator_traits<typename Iterable::iterator>::value_type>(
+ s.begin(), s.end())
.size();
}
} // namespace pythran
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp b/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp
index 8e6c975cae8..4c966512bbf 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/pythran/static_if.hpp
@@ -14,8 +14,7 @@ namespace builtins
{
template <class T, class F0, class F1>
- auto static_if(T const &cond, F0 f0,
- F1 f1) -> decltype(details::static_if<T>{cond}(f0, f1))
+ auto static_if(T const &cond, F0 f0, F1 f1) -> decltype(details::static_if<T>{cond}(f0, f1))
{
return details::static_if<T>{cond}(f0, f1);
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/range.hpp b/contrib/python/pythran/pythran/pythonic/builtins/range.hpp
index 2c3f3971d4d..3d7fc54f6de 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/range.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/range.hpp
@@ -18,11 +18,9 @@ namespace builtins
inline long _init_last(long _begin, long _end, long _step)
{
if (_step > 0)
- return _begin +
- std::max(0L, _step * ((_end - _begin + _step - 1) / _step));
+ return _begin + std::max(0L, _step * ((_end - _begin + _step - 1) / _step));
else
- return _begin +
- std::min(0L, _step * ((_end - _begin + _step + 1) / _step));
+ return _begin + std::min(0L, _step * ((_end - _begin + _step + 1) / _step));
}
} // namespace
@@ -89,13 +87,18 @@ namespace builtins
return sign * value_ < sign * other.value_;
}
+ inline bool range_iterator::operator<=(range_iterator const &other) const
+ {
+ const long sign = +1 | (step_ >> (sizeof(long) * CHAR_BIT - 1));
+ return sign * value_ <= sign * other.value_;
+ }
+
inline long range_iterator::operator-(range_iterator const &other) const
{
return (value_ - other.value_) / step_;
}
- inline range::range(long b, long e, long s)
- : begin_(b), end_(_init_last(b, e, s)), step_(s)
+ inline range::range(long b, long e, long s) : begin_(b), end_(_init_last(b, e, s)), step_(s)
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp b/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp
index 068dc42fbc3..14409d8ae66 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/reduce.hpp
@@ -15,11 +15,9 @@ namespace builtins
{
template <class Iterable, class Operator>
- auto reduce(Operator op, Iterable s)
- -> decltype(op(std::declval<typename std::iterator_traits<
- typename Iterable::iterator>::value_type>(),
- std::declval<typename std::iterator_traits<
- typename Iterable::iterator>::value_type>()))
+ auto reduce(Operator op, Iterable s) -> decltype(op(
+ std::declval<typename std::iterator_traits<typename Iterable::iterator>::value_type>(),
+ std::declval<typename std::iterator_traits<typename Iterable::iterator>::value_type>()))
{
auto iter = s.begin();
auto r = *iter;
@@ -32,13 +30,11 @@ namespace builtins
template <class Iterable, class Operator, class T>
auto reduce(Operator op, Iterable s, T const &init)
- -> decltype(std::accumulate(
- s.begin(), s.end(),
- static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op))
+ -> decltype(std::accumulate(s.begin(), s.end(),
+ static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op))
{
- return std::accumulate(
- s.begin(), s.end(),
- static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op);
+ return std::accumulate(s.begin(), s.end(),
+ static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op);
}
} // namespace builtins
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp b/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp
index f765c3ac395..38d96bf9888 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/reversed.hpp
@@ -35,8 +35,7 @@ namespace builtins
}
template <class Iterable>
- typename reversed<Iterable>::const_iterator
- reversed<Iterable>::begin() const
+ typename reversed<Iterable>::const_iterator reversed<Iterable>::begin() const
{
return iterable.rbegin();
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set.hpp
index 736c732aba5..d5f269bf620 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set.hpp
@@ -21,7 +21,7 @@ namespace builtins
template <class Iterable>
inline types::set<typename std::iterator_traits<
- typename std::remove_reference<Iterable>::type::iterator>::value_type>
+ typename std::remove_reference_t<Iterable>::iterator>::value_type>
set(Iterable &&t)
{
return {t.begin(), t.end()};
@@ -29,4 +29,34 @@ namespace builtins
} // namespace anonymous
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::set>::convert(builtins::functor::set const &c)
+{
+ return (PyObject *)&PySet_Type;
+}
+
+inline bool from_python<builtins::functor::set>::is_convertible(PyObject *obj)
+{
+ if (obj == (PyObject *)&PySet_Type)
+ return true;
+ PyObject *Origin = PyObject_GetAttrString(obj, "__origin__");
+ if (!Origin)
+ return false;
+ bool res = (Origin == (PyObject *)&PySet_Type);
+ Py_DECREF(Origin);
+ return res;
+}
+
+inline builtins::functor::set from_python<builtins::functor::set>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/difference.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/difference.hpp
index 4edb510b67a..635ca8547a6 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set/difference.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set/difference.hpp
@@ -28,8 +28,7 @@ namespace builtins
}
template <typename... Types>
- types::empty_set difference(types::empty_set const &set,
- Types const &...others)
+ types::empty_set difference(types::empty_set const &set, Types const &...others)
{
return types::empty_set();
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp
index 9de4f8a14d6..099d1ba86aa 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set/difference_update.hpp
@@ -15,24 +15,21 @@ namespace builtins
{
template <typename T, typename... Types>
- types::none_type difference_update(types::set<T> &set,
- Types const &...others)
+ types::none_type difference_update(types::set<T> &set, Types const &...others)
{
set.difference_update(others...);
return {};
}
template <typename T, typename... Types>
- types::none_type difference_update(types::set<T> &&set,
- Types const &...others)
+ types::none_type difference_update(types::set<T> &&set, Types const &...others)
{
// nothing to be done as we work on rvalue
return {};
}
template <typename... Types>
- types::none_type difference_update(types::empty_set const &set,
- Types const &...others)
+ types::none_type difference_update(types::empty_set const &set, Types const &...others)
{
// nothing can be removed in set
return {};
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp
index 09417a47fb1..58167699532 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection.hpp
@@ -15,8 +15,8 @@ namespace builtins
{
template <typename T, typename... Types>
- typename __combined<types::set<T>, Types...>::type
- intersection(types::set<T> const &set, Types const &...others)
+ typename __combined<types::set<T>, Types...>::type intersection(types::set<T> const &set,
+ Types const &...others)
{
return set.intersection(others...);
}
@@ -28,8 +28,7 @@ namespace builtins
* set([1.0, 2.0, 3.0])
*/
template <typename... Types>
- types::empty_set intersection(types::empty_set const &set,
- Types const &...others)
+ types::empty_set intersection(types::empty_set const &set, Types const &...others)
{
return types::empty_set();
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp
index 847a4d4dd6c..100cd12a9ba 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set/intersection_update.hpp
@@ -15,24 +15,21 @@ namespace builtins
{
template <typename T, typename... Types>
- types::none_type intersection_update(types::set<T> &set,
- Types const &...others)
+ types::none_type intersection_update(types::set<T> &set, Types const &...others)
{
set.intersection_update(others...);
return {};
}
template <typename T, typename... Types>
- types::none_type intersection_update(types::set<T> &&set,
- Types const &...others)
+ types::none_type intersection_update(types::set<T> &&set, Types const &...others)
{
// If it is an rvalue, we don't really want to update
return {};
}
template <typename... Types>
- types::none_type intersection_update(types::empty_set &&set,
- Types const &...others)
+ types::none_type intersection_update(types::empty_set &&set, Types const &...others)
{
// If it is an empty_set, it is ! really updated otherwise we have a
// typing issue
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp
index 14dd6fbbdf8..3b5b753cf95 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference.hpp
@@ -15,8 +15,8 @@ namespace builtins
{
template <typename T, typename U>
- typename __combined<types::set<T>, U>::type
- symmetric_difference(types::set<T> const &set, U const &other)
+ typename __combined<types::set<T>, U>::type symmetric_difference(types::set<T> const &set,
+ U const &other)
{
return set.symmetric_difference(other);
}
@@ -28,8 +28,8 @@ namespace builtins
* set([1.0, 4.0])
*/
template <typename U>
- typename __combined<types::empty_set, U>::type
- symmetric_difference(types::empty_set const &set, U const &other)
+ typename __combined<types::empty_set, U>::type symmetric_difference(types::empty_set const &set,
+ U const &other)
{
return other;
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp
index e9aa1675ceb..36a99635ed5 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set/symmetric_difference_update.hpp
@@ -15,24 +15,21 @@ namespace builtins
{
template <typename T, typename U>
- types::none_type symmetric_difference_update(types::set<T> &set,
- U const &other)
+ types::none_type symmetric_difference_update(types::set<T> &set, U const &other)
{
set.symmetric_difference_update(other);
return {};
}
template <typename T, typename U>
- types::none_type symmetric_difference_update(types::set<T> &&set,
- U const &other)
+ types::none_type symmetric_difference_update(types::set<T> &&set, U const &other)
{
// nothing to be done on rvalue
return {};
}
template <typename U>
- types::none_type symmetric_difference_update(types::empty_set const &set,
- U const &other)
+ types::none_type symmetric_difference_update(types::empty_set const &set, U const &other)
{
// nothing otherwise empty_set have ! its correct type.
return {};
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/set/union_.hpp b/contrib/python/pythran/pythran/pythonic/builtins/set/union_.hpp
index 04bcaea0176..e1436a16ff8 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/set/union_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/set/union_.hpp
@@ -15,15 +15,15 @@ namespace builtins
{
template <typename T, typename... Types>
- typename __combined<types::set<T>, Types...>::type
- union_(types::set<T> const &set, Types const &...others)
+ typename __combined<types::set<T>, Types...>::type union_(types::set<T> const &set,
+ Types const &...others)
{
return set.union_(others...);
}
template <typename... Types>
- typename __combined<types::empty_set, Types...>::type
- union_(types::empty_set const &init, Types const &...others)
+ typename __combined<types::empty_set, Types...>::type union_(types::empty_set const &init,
+ Types const &...others)
{
return union_(others...);
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/slice.hpp b/contrib/python/pythran/pythran/pythonic/builtins/slice.hpp
index 3a96dc79212..491761043a3 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/slice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/slice.hpp
@@ -15,8 +15,7 @@ namespace builtins
{
return {types::none<long>(), stop};
}
- inline types::cstride_slice<1> slice(types::none<long> start,
- types::none<long> stop)
+ inline types::cstride_slice<1> slice(types::none<long> start, types::none<long> stop)
{
return {start, stop};
}
@@ -29,4 +28,28 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::slice>::convert(builtins::functor::slice const &c)
+{
+ return (PyObject *)&PySlice_Type;
+}
+
+inline bool from_python<builtins::functor::slice>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PySlice_Type;
+}
+
+inline builtins::functor::slice from_python<builtins::functor::slice>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp b/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp
index c8e9e2efda2..d1764f78630 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/sorted.hpp
@@ -15,51 +15,47 @@ namespace builtins
{
template <class Iterable>
- types::list<typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type>
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
sorted(Iterable &&seq)
{
- types::list<typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type>
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
out(seq.begin(), seq.end());
pdqsort(out.begin(), out.end());
return out;
}
template <class Iterable, class Key>
- types::list<typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type>
- sorted(Iterable &&seq, Key const &key, bool reverse)
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
+ sorted(Iterable &&seq, types::kwonly, Key const &key, bool reverse)
{
- using value_type = typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type;
+ using value_type = std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>;
types::list<value_type> out(seq.begin(), seq.end());
if (reverse)
- pdqsort(out.begin(), out.end(),
- [&key](value_type const &self, value_type const &other) {
- return key(self) > key(other);
- });
+ pdqsort(out.begin(), out.end(), [&key](value_type const &self, value_type const &other) {
+ return key(self) > key(other);
+ });
else
- pdqsort(out.begin(), out.end(),
- [&key](value_type const &self, value_type const &other) {
- return key(self) < key(other);
- });
+ pdqsort(out.begin(), out.end(), [&key](value_type const &self, value_type const &other) {
+ return key(self) < key(other);
+ });
return out;
}
template <class Iterable>
- types::list<typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type>
- sorted(Iterable &&seq, types::none_type const &key, bool reverse)
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
+ sorted(Iterable &&seq, types::kwonly, types::none_type const &key, bool reverse)
{
- using value_type = typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type;
+ using value_type = std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>;
types::list<value_type> out(seq.begin(), seq.end());
if (reverse)
pdqsort(out.begin(), out.end(),
- [](value_type const &self, value_type const &other) {
- return self > other;
- });
+ [](value_type const &self, value_type const &other) { return self > other; });
else
pdqsort(out.begin(), out.end());
return out;
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str.hpp
index ce0cf778ac7..91be37b3a1f 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str.hpp
@@ -78,4 +78,28 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::str>::convert(builtins::functor::str const &c)
+{
+ return (PyObject *)&PyUnicode_Type;
+}
+
+inline bool from_python<builtins::functor::str>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUnicode_Type;
+}
+
+inline builtins::functor::str from_python<builtins::functor::str>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp
index 2ea185e1f37..a3e4a0e11ff 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/__mod__.hpp
@@ -26,8 +26,7 @@ namespace builtins
template <class Tuple, size_t I>
void fmt(boost::format &f, Tuple const &a, utils::int_<I>)
{
- fmt(f % std::get<std::tuple_size<Tuple>::value - I>(a), a,
- utils::int_<I - 1>());
+ fmt(f % std::get<std::tuple_size<Tuple>::value - I>(a), a, utils::int_<I - 1>());
}
} // namespace details
@@ -46,8 +45,7 @@ namespace builtins
return fmter.str();
}
template <size_t N, class T>
- types::str __mod__(types::str const &s,
- types::array_tuple<T, N> const &args)
+ types::str __mod__(types::str const &s, types::array_tuple<T, N> const &args)
{
boost::format fmter(s.chars());
details::fmt(fmter, args, utils::int_<N>());
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp
index 743bbe8c2f4..e87c5d621ee 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/capitalize.hpp
@@ -21,8 +21,7 @@ namespace builtins
else {
types::str copy = s;
copy.chars()[0] = ::toupper(s.chars()[0]);
- std::transform(s.chars().begin() + 1, s.chars().end(),
- copy.chars().begin() + 1, ::tolower);
+ std::transform(s.chars().begin() + 1, s.chars().end(), copy.chars().begin() + 1, ::tolower);
return copy;
}
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp
index 70fa51f46a0..3466c7def7b 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/endswith.hpp
@@ -14,8 +14,7 @@ namespace builtins
namespace str
{
- bool endswith(types::str const &s, types::str const &suffix, long start,
- long end)
+ bool endswith(types::str const &s, types::str const &suffix, long start, long end)
{
if (end == -1)
end = s.size();
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/find.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/find.hpp
index 20454838f6e..6adffdb83c3 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/find.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/find.hpp
@@ -14,8 +14,7 @@ namespace builtins
namespace str
{
- inline long find(types::str const &s, types::str const &value, long start,
- long end)
+ inline long find(types::str const &s, types::str const &value, long start, long end)
{
if (end < 0)
end += s.size();
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp
index 4fa77567ba2..ae89a8b50fd 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/isalpha.hpp
@@ -16,8 +16,8 @@ namespace builtins
bool isalpha(types::str const &s)
{
- return !s.empty() && std::all_of(s.chars().begin(), s.chars().end(),
- (int (*)(int))std::isalpha);
+ return !s.empty() &&
+ std::all_of(s.chars().begin(), s.chars().end(), (int (*)(int))std::isalpha);
}
} // namespace str
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp
index 43ffe5d5a7b..00384423bec 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/isdigit.hpp
@@ -18,8 +18,8 @@ namespace builtins
bool isdigit(types::str const &s)
{
- return !s.empty() && std::all_of(s.chars().begin(), s.chars().end(),
- (int (*)(int))std::isdigit);
+ return !s.empty() &&
+ std::all_of(s.chars().begin(), s.chars().end(), (int (*)(int))std::isdigit);
}
} // namespace str
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp
index 38cf6fd963a..59923f893cf 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/join.hpp
@@ -18,8 +18,8 @@ namespace builtins
template <class S>
types::str join(S const &s, types::str const &iterable)
{
- long ssize = std::distance(std::begin(s), std::end(s)) -
- (std::is_same<S, types::str>::value ? 0 : 1);
+ long ssize =
+ std::distance(std::begin(s), std::end(s)) - (std::is_same<S, types::str>::value ? 0 : 1);
/* first iterate over iterable to gather sizes */
size_t n = ssize * (iterable.size() - 1) + iterable.size();
@@ -42,15 +42,12 @@ namespace builtins
}
template <class S, class Iterable>
- typename std::enable_if<
- !std::is_same<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type,
- types::str>::value &&
- std::is_same<
- typename std::iterator_traits<typename std::remove_reference<
- Iterable>::type::iterator>::iterator_category,
- std::random_access_iterator_tag>::value,
- types::str>::type
+ std::enable_if_t<
+ !std::is_same<std::remove_cv_t<std::remove_reference_t<Iterable>>, types::str>::value &&
+ std::is_same<typename std::iterator_traits<typename std::remove_reference_t<
+ Iterable>::iterator>::iterator_category,
+ std::random_access_iterator_tag>::value,
+ types::str>
join(S const &s, Iterable &&iterable)
{
long ssize = builtins::functor::len{}(s);
@@ -75,8 +72,7 @@ namespace builtins
if (ssize)
for (; iter != iterable.end(); ++iter) {
auto chars = s.chars();
- oter =
- std::copy(std::begin(chars), std::begin(chars) + ssize, oter);
+ oter = std::copy(std::begin(chars), std::begin(chars) + ssize, oter);
auto tmp = *iter;
auto const &stmp = tmp.chars();
oter = std::copy(stmp.begin(), stmp.end(), oter);
@@ -92,12 +88,10 @@ namespace builtins
}
template <class S, class Iterable>
- typename std::enable_if<
- !std::is_same<
- typename std::iterator_traits<typename std::remove_reference<
- Iterable>::type::iterator>::iterator_category,
- std::random_access_iterator_tag>::value,
- types::str>::type
+ std::enable_if_t<!std::is_same<typename std::iterator_traits<typename std::remove_reference_t<
+ Iterable>::iterator>::iterator_category,
+ std::random_access_iterator_tag>::value,
+ types::str>
join(S const &s, Iterable &&iterable)
{
types::str out;
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp
index 417d01df6b3..ac0d739fda2 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/lower.hpp
@@ -17,8 +17,7 @@ namespace builtins
types::str lower(types::str const &s)
{
types::str copy = s;
- std::transform(s.chars().begin(), s.chars().end(), copy.chars().begin(),
- ::tolower);
+ std::transform(s.chars().begin(), s.chars().end(), copy.chars().begin(), ::tolower);
return copy;
}
} // namespace str
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/replace.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/replace.hpp
index 7bd78647497..0c43ff03ba9 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/replace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/replace.hpp
@@ -27,9 +27,8 @@ namespace builtins
if (!count || !haystack_next) {
return {haystack};
} else {
- size_t n =
- 1 + std::max(self.size(), self.size() * (1 + new_pattern.size()) /
- (1 + old_pattern.size()));
+ size_t n = 1 + std::max(self.size(),
+ self.size() * (1 + new_pattern.size()) / (1 + old_pattern.size()));
char *buffer = utils::allocate<char>(n);
char *iter = buffer;
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/split.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/split.hpp
index c7a20ee8b3a..7c5ac8cf708 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/split.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/split.hpp
@@ -17,8 +17,7 @@ namespace builtins
namespace str
{
- inline types::list<types::str> split(types::str const &in,
- types::str const &sep, long maxsplit)
+ inline types::list<types::str> split(types::str const &in, types::str const &sep, long maxsplit)
{
types::str s = strip(in);
types::list<types::str> res(0);
@@ -28,8 +27,7 @@ namespace builtins
size_t current = 0;
size_t next = 0;
long numsplit = 0;
- while (next != types::str::npos &&
- (numsplit++ < maxsplit || maxsplit == -1)) {
+ while (next != types::str::npos && (numsplit++ < maxsplit || maxsplit == -1)) {
next = s.find_first_of(sep, current);
res.push_back(s.substr(current, next - current));
current = next + 1;
@@ -41,8 +39,8 @@ namespace builtins
return res;
}
- inline types::list<types::str>
- split(types::str const &in, types::none_type const &, long maxsplit)
+ inline types::list<types::str> split(types::str const &in, types::none_type const &,
+ long maxsplit)
{
types::str s = strip(in);
types::list<types::str> res(0);
@@ -52,8 +50,7 @@ namespace builtins
size_t current = 0;
size_t next = 0;
long numsplit = 0;
- while (next != types::str::npos &&
- (numsplit++ < maxsplit || maxsplit == -1)) {
+ while (next != types::str::npos && (numsplit++ < maxsplit || maxsplit == -1)) {
next = s.find_first_of(" \n\r\t", current);
// from the pydoc, we skip any blank list
size_t end = s.find_first_not_of(" \n\r\t", next);
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/splitlines.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/splitlines.hpp
deleted file mode 100644
index 91fa344ada5..00000000000
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/splitlines.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef PYTHONIC_BUILTIN_STR_SPLITLINES_HPP
-#define PYTHONIC_BUILTIN_STR_SPLITLINES_HPP
-
-#include "pythonic/include/builtins/str/splitlines.hpp"
-
-#include "pythonic/types/list.hpp"
-#include "pythonic/types/str.hpp"
-#include "pythonic/utils/functor.hpp"
-
-PYTHONIC_NS_BEGIN
-
-namespace builtins
-{
-
- namespace str
- {
-
- inline types::list<types::str> splitlines(types::str const &in, bool keepends)
- {
- auto const& in_ = in.chars();
- types::list<types::str> res(0);
- size_t current = 0;
- const ssize_t adjust = keepends ? 1 : 0;
- while (current < (size_t)in.size()) {
- size_t next = in_.find("\n", current);
- res.push_back(in_.substr(current, next - current + adjust));
- current = (next == types::str::npos) ? next : (next + 1);
- }
- return res;
- }
-
- } // namespace str
-} // namespace builtins
-PYTHONIC_NS_END
-#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp
index 226388ca5f7..663413294fc 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/startswith.hpp
@@ -14,13 +14,11 @@ namespace builtins
namespace str
{
- bool startswith(types::str const &s, types::str const &prefix, long start,
- long end)
+ bool startswith(types::str const &s, types::str const &prefix, long start, long end)
{
if (end < 0)
end = s.size();
- return (end - start) >= prefix.size() &&
- s.compare(start, prefix.size(), prefix) == 0;
+ return (end - start) >= prefix.size() && s.compare(start, prefix.size(), prefix) == 0;
}
} // namespace str
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp
index e1cab71ee96..7d65a8ad6a9 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/strip.hpp
@@ -22,8 +22,7 @@ namespace builtins
return types::str();
else
return types::str(self.chars().begin() + first,
- self.chars().begin() + self.find_last_not_of(to_del) +
- 1);
+ self.chars().begin() + self.find_last_not_of(to_del) + 1);
}
} // namespace str
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp
index d90d583ec25..69e735aa78d 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/str/upper.hpp
@@ -17,8 +17,7 @@ namespace builtins
types::str upper(types::str const &s)
{
types::str copy = s;
- std::transform(s.chars().begin(), s.chars().end(), copy.chars().begin(),
- ::toupper);
+ std::transform(s.chars().begin(), s.chars().end(), copy.chars().begin(), ::toupper);
return copy;
}
} // namespace str
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp b/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp
index f583b1ae394..7d20143c1fd 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/sum.hpp
@@ -25,24 +25,20 @@ namespace builtins
}
template <class Tuple>
- auto
- tuple_sum<Tuple, 0>::operator()(Tuple const &t) -> decltype(std::get<0>(t))
+ auto tuple_sum<Tuple, 0>::operator()(Tuple const &t) -> decltype(std::get<0>(t))
{
return std::get<0>(t);
}
} // namespace details
template <class Iterable, class T>
- auto sum(Iterable s, T start)
- -> decltype(std::accumulate(
- s.begin(), s.end(),
- static_cast<typename assignable<decltype(start + *s.begin())>::type>(
- start)))
+ auto sum(Iterable s, T start) -> decltype(std::accumulate(
+ s.begin(), s.end(),
+ static_cast<typename assignable<decltype(start + *s.begin())>::type>(start)))
{
return std::accumulate(
s.begin(), s.end(),
- static_cast<typename assignable<decltype(start + *s.begin())>::type>(
- start));
+ static_cast<typename assignable<decltype(start + *s.begin())>::type>(start));
}
} // namespace builtins
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp b/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp
index 7abe56ad8f1..48b02da405d 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/tuple.hpp
@@ -20,14 +20,12 @@ namespace builtins
template <class Iterable>
/* this is far from perfect, but how to cope with the
- difference between python tuples && c++ ones ? */
- typename std::enable_if <
- types::len_of<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>::
- value<0, types::dynamic_tuple<typename std::iterator_traits<
- typename std::remove_cv<typename std::remove_reference<
- Iterable>::type>::type::iterator>::value_type>>::type
- tuple(Iterable &&i)
+ difference between python tuples and c++ ones ? */
+ std::enable_if_t <
+ types::len_of<std::remove_cv_t<std::remove_reference_t<Iterable>>>::value<
+ 0, types::dynamic_tuple<typename std::iterator_traits<typename std::remove_cv_t<
+ std::remove_reference_t<Iterable>>::iterator>::value_type>>
+ tuple(Iterable &&i)
{
return {i.begin(), i.end()};
}
@@ -35,23 +33,18 @@ namespace builtins
template <class StaticIterable>
/* specialization if we are capable to statically compute the size of the
input */
- typename std::enable_if<
- types::len_of<typename std::remove_cv<typename std::remove_reference<
- StaticIterable>::type>::type>::value >= 0,
+ std::enable_if_t<
+ types::len_of<std::remove_cv_t<std::remove_reference_t<StaticIterable>>>::value >= 0,
types::array_tuple<
- typename std::iterator_traits<
- typename std::remove_cv<typename std::remove_reference<
- StaticIterable>::type>::type::iterator>::value_type,
- types::len_of<typename std::remove_cv<typename std::remove_reference<
- StaticIterable>::type>::type>::value>>::type
+ typename std::iterator_traits<typename std::remove_cv_t<
+ std::remove_reference_t<StaticIterable>>::iterator>::value_type,
+ types::len_of<std::remove_cv_t<std::remove_reference_t<StaticIterable>>>::value>>
tuple(StaticIterable &&i)
{
types::array_tuple<
- typename std::iterator_traits<
- typename std::remove_cv<typename std::remove_reference<
- StaticIterable>::type>::type::iterator>::value_type,
- types::len_of<typename std::remove_cv<
- typename std::remove_reference<StaticIterable>::type>::type>::value>
+ typename std::iterator_traits<typename std::remove_cv_t<
+ std::remove_reference_t<StaticIterable>>::iterator>::value_type,
+ types::len_of<std::remove_cv_t<std::remove_reference_t<StaticIterable>>>::value>
res;
std::copy(i.begin(), i.end(), res.begin());
return res;
@@ -59,4 +52,35 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<builtins::functor::tuple>::convert(builtins::functor::tuple const &c)
+{
+ return (PyObject *)&PyTuple_Type;
+}
+
+inline bool from_python<builtins::functor::tuple>::is_convertible(PyObject *obj)
+{
+ if (obj == (PyObject *)&PyTuple_Type)
+ return true;
+ PyObject *Origin = PyObject_GetAttrString(obj, "__origin__");
+ if (!Origin)
+ return false;
+ bool res = (Origin == (PyObject *)&PyTuple_Type);
+ Py_DECREF(Origin);
+ return res;
+}
+
+inline builtins::functor::tuple from_python<builtins::functor::tuple>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/type.hpp b/contrib/python/pythran/pythran/pythonic/builtins/type.hpp
index 401c566845e..6da95c0376f 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/type.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/type.hpp
@@ -2,143 +2,16 @@
#define PYTHONIC_BUILTIN_TYPE_HPP
#include "pythonic/include/builtins/type.hpp"
+#include "pythonic/types/type.hpp"
#include "pythonic/utils/functor.hpp"
-#include "pythonic/builtins/bool_.hpp"
-#include "pythonic/builtins/complex.hpp"
-#include "pythonic/builtins/dict.hpp"
-#include "pythonic/builtins/float_.hpp"
-#include "pythonic/builtins/int_.hpp"
-#include "pythonic/builtins/list.hpp"
-#include "pythonic/builtins/set.hpp"
-#include "pythonic/builtins/str.hpp"
-#include "pythonic/builtins/tuple.hpp"
-#include "pythonic/numpy/array.hpp"
-#include "pythonic/numpy/byte.hpp"
-#include "pythonic/numpy/float128.hpp"
-#include "pythonic/numpy/float32.hpp"
-#include "pythonic/numpy/int_.hpp"
-#include "pythonic/numpy/intc.hpp"
-#include "pythonic/numpy/longlong.hpp"
-#include "pythonic/numpy/short_.hpp"
-#include "pythonic/numpy/ubyte.hpp"
-#include "pythonic/numpy/uint.hpp"
-#include "pythonic/numpy/uintc.hpp"
-#include "pythonic/numpy/ulonglong.hpp"
-#include "pythonic/numpy/ushort.hpp"
-
PYTHONIC_NS_BEGIN
namespace builtins
{
- template <>
- struct type_functor<bool> {
- using type = functor::bool_;
- };
- template <>
- struct type_functor<double> {
- using type = functor::float_;
- };
- template <>
- struct type_functor<types::str> {
- using type = functor::str;
- };
- template <class T>
- struct type_functor<std::complex<T>> {
- using type = functor::complex;
- };
- template <>
- struct type_functor<types::empty_set> {
- using type = functor::set;
- };
- template <class T>
- struct type_functor<types::set<T>> {
- using type = functor::set;
- };
- template <>
- struct type_functor<types::empty_list> {
- using type = functor::list;
- };
- template <class T>
- struct type_functor<types::list<T>> {
- using type = functor::list;
- };
- template <class T, size_t N>
- struct type_functor<types::static_list<T, N>> {
- using type = functor::list;
- };
- template <>
- struct type_functor<types::empty_dict> {
- using type = functor::dict;
- };
- template <class K, class V>
- struct type_functor<types::dict<K, V>> {
- using type = functor::dict;
- };
- template <class... Tys>
- struct type_functor<std::tuple<Tys...>> {
- using type = functor::tuple;
- };
- template <class T, size_t N>
- struct type_functor<types::array_tuple<T, N>> {
- using type = functor::tuple;
- };
- template <class T, class pS>
- struct type_functor<types::ndarray<T, pS>> {
- using type = numpy::functor::array;
- };
- template <>
- struct type_functor<signed char> {
- using type = numpy::functor::byte;
- };
- template <>
- struct type_functor<unsigned char> {
- using type = numpy::functor::ubyte;
- };
- template <>
- struct type_functor<short> {
- using type = numpy::functor::short_;
- };
- template <>
- struct type_functor<unsigned short> {
- using type = numpy::functor::ushort;
- };
- template <>
- struct type_functor<int> {
- using type = numpy::functor::intc;
- };
- template <>
- struct type_functor<unsigned int> {
- using type = numpy::functor::uintc;
- };
- template <>
- struct type_functor<long> {
- using type = numpy::functor::int_;
- };
- template <>
- struct type_functor<unsigned long> {
- using type = numpy::functor::uint;
- };
- template <>
- struct type_functor<long long> {
- using type = numpy::functor::longlong;
- };
- template <>
- struct type_functor<unsigned long long> {
- using type = numpy::functor::ulonglong;
- };
- template <>
- struct type_functor<float> {
- using type = numpy::functor::float32;
- };
- template <>
- struct type_functor<long double> {
- using type = numpy::functor::float128;
- };
-
template <class T>
- typename type_functor<T>::type type(T const &)
+ typename types::type_functor<T>::type type(T const &)
{
return {};
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp b/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp
index 696ac32089f..4cb7fc3cc27 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/xrange.hpp
@@ -18,11 +18,9 @@ namespace builtins
long _init_last(long _begin, long _end, long _step)
{
if (_step > 0)
- return _begin +
- std::max(0L, _step * ((_end - _begin + _step - 1) / _step));
+ return _begin + std::max(0L, _step * ((_end - _begin + _step - 1) / _step));
else
- return _begin +
- std::min(0L, _step * ((_end - _begin + _step + 1) / _step));
+ return _begin + std::min(0L, _step * ((_end - _begin + _step + 1) / _step));
}
} // namespace
@@ -74,8 +72,7 @@ namespace builtins
return (value_ - other.value_) / step_;
}
- xrange::xrange(long b, long e, long s)
- : begin_(b), end_(_init_last(b, e, s)), step_(s)
+ xrange::xrange(long b, long e, long s) : begin_(b), end_(_init_last(b, e, s)), step_(s)
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp b/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp
index 3fb8c045218..1587846698c 100644
--- a/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp
+++ b/contrib/python/pythran/pythran/pythonic/builtins/zip.hpp
@@ -12,8 +12,7 @@ namespace builtins
{
template <typename... Iter>
- auto zip(Iter &&...iters) -> decltype(map(builtins::None,
- std::forward<Iter>(iters)...))
+ auto zip(Iter &&...iters) -> decltype(map(builtins::None, std::forward<Iter>(iters)...))
{
return map(builtins::None, std::forward<Iter>(iters)...);
}
diff --git a/contrib/python/pythran/pythran/pythonic/core.hpp b/contrib/python/pythran/pythran/pythonic/core.hpp
index 844d944cb53..bd989e18c40 100644
--- a/contrib/python/pythran/pythran/pythonic/core.hpp
+++ b/contrib/python/pythran/pythran/pythonic/core.hpp
@@ -2,13 +2,13 @@
#ifndef PYTHONIC_CORE_HPP
#define PYTHONIC_CORE_HPP
-#define PYTHONIC_NS_BEGIN \
- namespace \
- { \
- namespace pythonic \
+#define PYTHONIC_NS_BEGIN \
+ namespace \
+ { \
+ namespace pythonic \
{
-#define PYTHONIC_NS_END \
- } \
+#define PYTHONIC_NS_END \
+ } \
}
// mostly to flag '_' as unused in generated code
@@ -29,6 +29,11 @@
// clang-format on
#ifdef ENABLE_PYTHON_MODULE
+
+#if defined(Py_LIMITED_API) && Py_LIMITED_API < 0x03070000
+#error Pythran only supports Py_LIMITED_API from 0x03070000 upward
+#endif
+
// Define python's visibility macros
#include "pyconfig.h"
diff --git a/contrib/python/pythran/pythran/pythonic/functools/partial.hpp b/contrib/python/pythran/pythran/pythonic/functools/partial.hpp
index e2a2df85e75..b109267686d 100644
--- a/contrib/python/pythran/pythran/pythonic/functools/partial.hpp
+++ b/contrib/python/pythran/pythran/pythonic/functools/partial.hpp
@@ -22,28 +22,24 @@ namespace functools
}
template <typename... ClosureTypes>
- task<ClosureTypes...>::task(ClosureTypes const &...types)
- : closure(types...)
+ task<ClosureTypes...>::task(ClosureTypes const &...types) : closure(types...)
{
}
template <typename... ClosureTypes>
template <typename... Types>
auto task<ClosureTypes...>::operator()(Types &&...types) const
- -> decltype(this->call(
- utils::make_index_sequence<sizeof...(ClosureTypes) - 1>(),
- std::forward<Types>(types)...))
+ -> decltype(this->call(std::make_index_sequence<sizeof...(ClosureTypes) - 1>(),
+ std::forward<Types>(types)...))
{
- return call(utils::make_index_sequence<sizeof...(ClosureTypes) - 1>(),
+ return call(std::make_index_sequence<sizeof...(ClosureTypes) - 1>(),
std::forward<Types>(types)...);
}
} // namespace details
template <typename... Types>
// remove references as closure capture the env by copy
- details::task<typename std::remove_cv<
- typename std::remove_reference<Types>::type>::type...>
- partial(Types &&...types)
+ details::task<std::remove_cv_t<std::remove_reference_t<Types>>...> partial(Types &&...types)
{
return {std::forward<Types>(types)...};
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp
index 8dcc6fcca1a..7d0b16a1015 100644
--- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/count.hpp
@@ -8,8 +8,7 @@ PYTHONIC_NS_BEGIN
namespace __dispatch__
{
template <class Any, class Value>
- auto count(Any &&any,
- Value &&value) -> decltype(any.count(std::forward<Value>(value)));
+ auto count(Any &&any, Value &&value) -> decltype(any.count(std::forward<Value>(value)));
DEFINE_FUNCTOR(pythonic::__dispatch__, count);
} // namespace __dispatch__
diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp
index ac37c2e6533..a488c74c11c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/pop.hpp
@@ -8,8 +8,7 @@ PYTHONIC_NS_BEGIN
namespace __dispatch__
{
template <class Any, class... Arg0>
- auto pop(Any &&any,
- Arg0 &&...arg0) -> decltype(any.pop(std::forward<Arg0>(arg0)...));
+ auto pop(Any &&any, Arg0 &&...arg0) -> decltype(any.pop(std::forward<Arg0>(arg0)...));
DEFINE_FUNCTOR(pythonic::__dispatch__, pop);
} // namespace __dispatch__
diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp
index d57b8c2f38b..2ebd7e1c9b3 100644
--- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/sort.hpp
@@ -11,12 +11,10 @@ namespace __dispatch__
template <class T, class... Args>
auto sort(types::list<T> &l, Args &&...args)
- -> decltype(pythonic::builtins::list::sort(l,
- std::forward<Args>(args)...));
+ -> decltype(pythonic::builtins::list::sort(l, std::forward<Args>(args)...));
template <class T, class... Args>
auto sort(types::list<T> &&l, Args &&...args)
- -> decltype(pythonic::builtins::list::sort(std::move(l),
- std::forward<Args>(args)...));
+ -> decltype(pythonic::builtins::list::sort(std::move(l), std::forward<Args>(args)...));
template <class Any, class... Args>
types::none_type sort(Any &&any, Args &&...args);
diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp
index 199ee3fc9b4..ced21d067d9 100644
--- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/tolist.hpp
@@ -15,32 +15,28 @@ namespace __dispatch__
}
template <class T, class S>
- types::list<
- typename std::conditional<std::is_integral<T>::value, long, double>::type>
+ types::list<std::conditional_t<std::is_integral<T>::value, long, double>>
tolist(types::sliced_array<T, S> &&a)
{
return {a.begin(), a.end()};
}
template <class T, class S>
- types::list<
- typename std::conditional<std::is_integral<T>::value, long, double>::type>
+ types::list<std::conditional_t<std::is_integral<T>::value, long, double>>
tolist(types::sliced_array<T, S> const &a)
{
return {a.begin(), a.end()};
}
template <class T>
- types::list<
- typename std::conditional<std::is_integral<T>::value, long, double>::type>
+ types::list<std::conditional_t<std::is_integral<T>::value, long, double>>
tolist(types::array<T> &&a)
{
return {a.begin(), a.end()};
}
template <class T>
- types::list<
- typename std::conditional<std::is_integral<T>::value, long, double>::type>
+ types::list<std::conditional_t<std::is_integral<T>::value, long, double>>
tolist(types::array<T> const &a)
{
return {a.begin(), a.end()};
diff --git a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp
index 258c9f6b86b..5ab229290f4 100644
--- a/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/__dispatch__/update.hpp
@@ -9,8 +9,7 @@ namespace __dispatch__
{
template <class Any, class... Arg0>
- auto update(Any &&any, Arg0 &&...arg0)
- -> decltype(any.update(std::forward<Arg0>(arg0)...));
+ auto update(Any &&any, Arg0 &&...arg0) -> decltype(any.update(std::forward<Arg0>(arg0)...));
DEFINE_FUNCTOR(pythonic::__dispatch__, update);
} // namespace __dispatch__
diff --git a/contrib/python/pythran/pythran/pythonic/include/array/array.hpp b/contrib/python/pythran/pythran/pythonic/include/array/array.hpp
index 1c076e11dd7..10e78b7b233 100644
--- a/contrib/python/pythran/pythran/pythonic/include/array/array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/array/array.hpp
@@ -66,12 +66,11 @@ namespace array
};
template <char c>
- types::array<typename details::typecodes<c>::type>
- array(std::integral_constant<char, c>);
+ types::array<typename details::typecodes<c>::type> array(std::integral_constant<char, c>);
template <char c, class E>
- types::array<typename details::typecodes<c>::type>
- array(std::integral_constant<char, c>, E &&elts);
+ types::array<typename details::typecodes<c>::type> array(std::integral_constant<char, c>,
+ E &&elts);
} // namespace details
DEFINE_FUNCTOR(pythonic::array::details, array);
diff --git a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp
index 3d54ae8a094..e0c1cb11950 100644
--- a/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/bisect/bisect.hpp
@@ -12,19 +12,18 @@ namespace bisect
namespace details
{
template <class X, class A>
- using bisect_fun =
- decltype(std::upper_bound<typename X::const_iterator, A>);
+ using bisect_fun = decltype(std::upper_bound<typename X::const_iterator, A>);
}
template <class X, class A>
- long bisect(X const &x, A const &a, long lo = 0,
- details::bisect_fun<X, A> const &fun =
- std::upper_bound<typename X::const_iterator, A>);
+ long
+ bisect(X const &x, A const &a, long lo = 0,
+ details::bisect_fun<X, A> const &fun = std::upper_bound<typename X::const_iterator, A>);
template <class X, class A>
- long bisect(X const &x, A const &a, long lo, long hi,
- details::bisect_fun<X, A> const &fun =
- std::upper_bound<typename X::const_iterator, A>);
+ long
+ bisect(X const &x, A const &a, long lo, long hi,
+ details::bisect_fun<X, A> const &fun = std::upper_bound<typename X::const_iterator, A>);
DEFINE_FUNCTOR(pythonic::bisect, bisect);
} // namespace bisect
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp
index f507ec4b55d..a6b178966c0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/bin.hpp
@@ -12,8 +12,7 @@ PYTHONIC_NS_BEGIN
namespace builtins
{
template <class T>
- typename std::enable_if<std::is_scalar<T>::value, types::str>::type
- bin(T const &v);
+ std::enable_if_t<std::is_scalar<T>::value, types::str> bin(T const &v);
DEFINE_FUNCTOR(pythonic::builtins, bin);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp
index f0fdd1b52e5..7b28c833109 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/bool_.hpp
@@ -36,4 +36,22 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::bool_> {
+ static PyObject *convert(builtins::functor::bool_ const &c);
+};
+
+template <>
+struct from_python<builtins::functor::bool_> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::bool_ convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp
index 1ad6bc6dfee..86a1bcbb030 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/complex.hpp
@@ -25,4 +25,23 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::complex> {
+ static PyObject *convert(builtins::functor::complex const &c);
+};
+
+template <>
+struct from_python<builtins::functor::complex> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::complex convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp
index f4fdb169832..60d7ccd9cd2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict.hpp
@@ -21,14 +21,30 @@ namespace builtins
template <class Iterable>
auto dict(Iterable &&iterable)
- -> types::dict<
- typename std::decay<decltype(std::get<0>(*iterable.begin()))>::type,
- typename std::decay<
- decltype(std::get<1>(*iterable.begin()))>::type>;
+ -> types::dict<std::decay_t<decltype(std::get<0>(*iterable.begin()))>,
+ std::decay_t<decltype(std::get<1>(*iterable.begin()))>>;
} // namespace anonymous
DEFINE_FUNCTOR(pythonic::builtins::anonymous, dict);
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::dict> {
+ static PyObject *convert(builtins::functor::dict const &c);
+};
+
+template <>
+struct from_python<builtins::functor::dict> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::dict convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp
index d06ff6ee574..0c84ad4799f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/fromkeys.hpp
@@ -16,7 +16,7 @@ namespace builtins
{
template <class Iterable, class V = types::none_type>
- types::dict<typename std::remove_reference<Iterable>::type::value_type, V>
+ types::dict<typename std::remove_reference_t<Iterable>::value_type, V>
fromkeys(Iterable &&iter, V const &v = builtins::None);
DEFINE_FUNCTOR(pythonic::builtins::dict, fromkeys);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp
index be4e976f4af..ffccb65f462 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/dict/get.hpp
@@ -14,8 +14,7 @@ namespace builtins
{
template <class K, class V, class W, class X>
- typename __combined<V, X>::type get(types::dict<K, V> const &d, W const &k,
- X const &default_);
+ typename __combined<V, X>::type get(types::dict<K, V> const &d, W const &k, X const &default_);
template <class K, class V, class W>
types::none<V> get(types::dict<K, V> const &d, W const &k);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/enumerate.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/enumerate.hpp
index e2e10a8e412..ed989a34c62 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/enumerate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/enumerate.hpp
@@ -17,8 +17,7 @@ namespace builtins
template <class Iterator>
using enumerate_iterator_base = std::iterator<
typename std::iterator_traits<Iterator>::iterator_category,
- types::make_tuple_t<
- long, typename std::iterator_traits<Iterator>::value_type>>;
+ types::make_tuple_t<long, typename std::iterator_traits<Iterator>::value_type>>;
template <class Iterator>
struct enumerate_iterator : public enumerate_iterator_base<Iterator> {
@@ -45,9 +44,8 @@ namespace builtins
template <class Iterable>
struct enumerate
: private Iterable, /* to hold a reference on the iterable */
- public enumerate_iterator<
- typename Iterable::iterator> /* to be compatible with
- builtins.next*/
+ public enumerate_iterator<typename Iterable::iterator> /* to be compatible with
+ builtins.next*/
{
using iterator = enumerate_iterator<typename Iterable::iterator>;
using iterator::operator*;
@@ -64,8 +62,7 @@ namespace builtins
} // namespace details
template <class Iterable>
- details::enumerate<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>
+ details::enumerate<std::remove_cv_t<std::remove_reference_t<Iterable>>>
enumerate(Iterable &&seq, long first = 0L);
DEFINE_FUNCTOR(pythonic::builtins, enumerate);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp
index fbe7b70e4b1..f5618da1693 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/file.hpp
@@ -12,8 +12,7 @@ namespace builtins
namespace anonymous
{
- types::file file(types::str const &filename,
- types::str const &strmode = "r");
+ types::file file(types::str const &filename, types::str const &strmode = "r");
}
DEFINE_FUNCTOR(pythonic::builtins::anonymous, file);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/filter.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/filter.hpp
index 80081481fa7..cfc783dfca5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/filter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/filter.hpp
@@ -14,10 +14,8 @@ namespace builtins
{
template <typename Operator, typename List0>
- struct filter_iterator
- : std::iterator<std::forward_iterator_tag, typename List0::value_type> {
- using sequence_type = typename std::remove_cv<
- typename std::remove_reference<List0>::type>::type;
+ struct filter_iterator : std::iterator<std::forward_iterator_tag, typename List0::value_type> {
+ using sequence_type = std::remove_cv_t<std::remove_reference_t<List0>>;
Operator op;
typename List0::iterator iter;
@@ -47,10 +45,9 @@ namespace builtins
// and avoid a dangling reference
// FIXME: It would be better to have a copy only if needed but Pythran
// typing is not good enough for this as arguments have
- // remove_cv/remove_ref
+ // remove_cv_t/remove_ref_t
template <typename Operator, typename List0>
- struct filter : utils::iterator_reminder<false, List0>,
- filter_iterator<Operator, List0> {
+ struct filter : utils::iterator_reminder<false, List0>, filter_iterator<Operator, List0> {
using value_type = typename List0::value_type;
using iterator = filter_iterator<Operator, List0>;
@@ -67,10 +64,8 @@ namespace builtins
} // namespace details
template <typename Operator, typename List0>
- details::filter<typename std::remove_cv<
- typename std::remove_reference<Operator>::type>::type,
- typename std::remove_cv<
- typename std::remove_reference<List0>::type>::type>
+ details::filter<std::remove_cv_t<std::remove_reference_t<Operator>>,
+ std::remove_cv_t<std::remove_reference_t<List0>>>
filter(Operator &&_op, List0 &&_seq);
DEFINE_FUNCTOR(pythonic::builtins, filter);
@@ -82,9 +77,8 @@ PYTHONIC_NS_END
template <class E, class Op, class T>
struct __combined<E, pythonic::builtins::details::filter<Op, T>> {
- using type =
- typename __combined<E, container<typename pythonic::builtins::details::
- filter<Op, T>::value_type>>::type;
+ using type = typename __combined<
+ E, container<typename pythonic::builtins::details::filter<Op, T>::value_type>>::type;
};
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp
index 15ca376ccf2..e854e29871e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/float_.hpp
@@ -28,4 +28,23 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::float_> {
+ static PyObject *convert(builtins::functor::float_ const &c);
+};
+
+template <>
+struct from_python<builtins::functor::float_> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::float_ convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp
index 806cd0ee29f..288c8482bad 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/isinstance.hpp
@@ -11,8 +11,7 @@ namespace types
class str;
template <class Ty0, class Ty1>
- struct isinstance
- : std::conditional<std::is_same<Ty0, Ty1>::value, true_type, false_type> {
+ struct isinstance : std::conditional<std::is_same<Ty0, Ty1>::value, true_type, false_type> {
};
// some specialization
@@ -33,20 +32,17 @@ namespace builtins
{
template <class Obj, class Cls>
struct isinstance {
- using type = typename types::isinstance<
- Obj,
- typename std::decay<decltype(std::declval<Cls>()())>::type>::type;
+ using type =
+ typename types::isinstance<Obj, std::decay_t<decltype(std::declval<Cls>()())>>::type;
};
template <class Obj, class... Clss>
struct isinstance<Obj, std::tuple<Clss...>> {
- using type = typename std::conditional<
+ using type = std::conditional_t<
utils::any_of<std::is_same<
- typename types::isinstance<
- Obj, typename std::decay<
- decltype(std::declval<Clss>()())>::type>::type,
+ typename types::isinstance<Obj, std::decay_t<decltype(std::declval<Clss>()())>>::type,
types::true_type>::value...>::value,
- types::true_type, types::false_type>::type;
+ types::true_type, types::false_type>;
};
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp
index 7c252347b7a..ec9da68560f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/iter.hpp
@@ -26,9 +26,7 @@ namespace builtins
} // namespace details
template <class T>
- details::iter<
- typename std::remove_cv<typename std::remove_reference<T>::type>::type>
- iter(T &&t);
+ details::iter<std::remove_cv_t<std::remove_reference_t<T>>> iter(T &&t);
DEFINE_FUNCTOR(pythonic::builtins, iter);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp
index d884ee5c382..376d016779c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/len.hpp
@@ -16,8 +16,7 @@ namespace builtins
long len(std::tuple<Types...> const &);
template <class T>
- typename std::enable_if<types::has_size<T>::value, long>::type
- len(T const &t);
+ std::enable_if_t<types::has_size<T>::value, long> len(T const &t);
DEFINE_FUNCTOR(pythonic::builtins, len);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp
index aba29bc9c1f..b710bc5da62 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list.hpp
@@ -19,9 +19,8 @@ namespace builtins
inline types::empty_list list(types::empty_list);
template <class Iterable>
- types::list<typename std::decay<typename std::iterator_traits<
- typename std::remove_reference<Iterable>::type::iterator>::value_type>::
- type>
+ types::list<std::decay_t<typename std::iterator_traits<
+ typename std::remove_reference_t<Iterable>::iterator>::value_type>>
list(Iterable &&t);
} // namespace anonymous
@@ -29,4 +28,23 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::list> {
+ static PyObject *convert(builtins::functor::list const &c);
+};
+
+template <>
+struct from_python<builtins::functor::list> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::list convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp
index bac4c967049..5bc27c30313 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/list/extend.hpp
@@ -14,15 +14,11 @@ namespace builtins
{
template <class T0, class T1>
- typename std::enable_if<
- !std::is_same<typename std::decay<T0>::type, types::empty_list>::value,
- types::none_type>::type
+ std::enable_if_t<!std::is_same<std::decay_t<T0>, types::empty_list>::value, types::none_type>
extend(T0 &&seq, T1 const &add);
template <class T0, class T1>
- typename std::enable_if<
- std::is_same<typename std::decay<T0>::type, types::empty_list>::value,
- types::none_type>::type
+ std::enable_if_t<std::is_same<std::decay_t<T0>, types::empty_list>::value, types::none_type>
extend(T0 &&seq, T1 const &add);
DEFINE_FUNCTOR(pythonic::builtins::list, extend);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp
index 788106712cf..9691775f17f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/map.hpp
@@ -22,32 +22,28 @@ namespace builtins
template <class Operator, class... Iters>
struct map_res {
using type = decltype(std::declval<Operator>()(
- std::declval<typename std::iterator_traits<
- typename Iters::iterator>::value_type>()...));
+ std::declval<typename std::iterator_traits<typename Iters::iterator>::value_type>()...));
};
template <class... Iters>
struct map_res<types::none_type, Iters...> {
using type = decltype(types::make_tuple(
- std::declval<typename std::iterator_traits<
- typename Iters::iterator>::value_type>()...));
+ std::declval<typename std::iterator_traits<typename Iters::iterator>::value_type>()...));
};
template <typename Operator, typename... Iters>
struct map_iterator
- : std::iterator<
- typename utils::iterator_min<typename Iters::iterator...>::type,
- typename map_res<Operator, Iters...>::type> {
+ : std::iterator<typename utils::iterator_min<typename Iters::iterator...>::type,
+ typename map_res<Operator, Iters...>::type> {
std::tuple<typename Iters::iterator...> it;
Operator _op;
map_iterator() = default;
template <size_t... I>
- map_iterator(Operator const &_op, std::tuple<Iters...> &_iters,
- utils::index_sequence<I...>);
+ map_iterator(Operator const &_op, std::tuple<Iters...> &_iters, std::index_sequence<I...>);
template <size_t... I>
- map_iterator(itertools::npos, Operator const &_op,
- std::tuple<Iters...> &_iters, utils::index_sequence<I...>);
+ map_iterator(itertools::npos, Operator const &_op, std::tuple<Iters...> &_iters,
+ std::index_sequence<I...>);
typename map_res<Operator, Iters...>::type operator*() const;
map_iterator &operator++();
@@ -56,42 +52,43 @@ namespace builtins
bool operator==(map_iterator const &other) const;
bool operator!=(map_iterator const &other) const;
bool operator<(map_iterator const &other) const;
+ bool operator<=(map_iterator const &other) const;
long operator-(map_iterator const &other) const;
private:
template <size_t N>
- long min_len(map_iterator<Operator, Iters...> const &other,
- utils::int_<N>) const;
- long min_len(map_iterator<Operator, Iters...> const &other,
- utils::int_<0>) const;
+ long min_len(map_iterator<Operator, Iters...> const &other, utils::int_<N>) const;
+ long min_len(map_iterator<Operator, Iters...> const &other, utils::int_<0>) const;
template <size_t N>
bool equal(map_iterator const &other, utils::int_<N>) const;
bool equal(map_iterator const &other, utils::int_<0>) const;
+ template <size_t N>
+ bool lt(map_iterator const &other, utils::int_<N>) const;
+ bool lt(map_iterator const &other, utils::int_<0>) const;
+
template <size_t I>
void advance(long i, utils::int_<I>);
void advance(long i, utils::int_<0>);
template <size_t... I>
- void next(utils::index_sequence<I...>);
+ void next(std::index_sequence<I...>);
template <size_t... I>
- typename map_res<Operator, Iters...>::type
- get_value(utils::index_sequence<I...>, std::true_type) const;
+ typename map_res<Operator, Iters...>::type get_value(std::index_sequence<I...>,
+ std::true_type) const;
template <size_t... I>
- typename map_res<Operator, Iters...>::type
- get_value(utils::index_sequence<I...>, std::false_type) const;
+ typename map_res<Operator, Iters...>::type get_value(std::index_sequence<I...>,
+ std::false_type) const;
};
template <typename Operator, typename... Iters>
- struct map : utils::iterator_reminder<true, Iters...>,
- map_iterator<Operator, Iters...> {
+ struct map : utils::iterator_reminder<true, Iters...>, map_iterator<Operator, Iters...> {
using iterator = map_iterator<Operator, Iters...>;
using value_type = typename iterator::value_type;
using dtype = typename types::dtype_of<value_type>::type;
- static constexpr long value =
- 1 + utils::nested_container_depth<value_type>::value;
+ static constexpr long value = 1 + utils::nested_container_depth<value_type>::value;
iterator end_iter;
@@ -107,12 +104,9 @@ namespace builtins
} // namespace details
template <typename Operator, typename... Iter>
- auto map(Operator &&_op, Iter &&...iters)
- -> details::map<
- typename std::remove_cv<
- typename std::remove_reference<Operator>::type>::type,
- typename types::iterator<typename std::remove_cv<
- typename std::remove_reference<Iter>::type>::type>::type...>;
+ details::map<std::remove_cv_t<std::remove_reference_t<Operator>>,
+ typename types::iterator<std::remove_cv_t<std::remove_reference_t<Iter>>>::type...>
+ map(Operator &&_op, Iter &&...iters);
DEFINE_FUNCTOR(pythonic::builtins, map);
} // namespace builtins
@@ -122,16 +116,13 @@ namespace types
template <class Op, class Iter>
struct len_of<pythonic::builtins::details::map<Op, Iter>> {
- static constexpr long value = len_of<typename std::remove_cv<
- typename std::remove_reference<Iter>::type>::type>::value;
+ static constexpr long value = len_of<std::remove_cv_t<std::remove_reference_t<Iter>>>::value;
};
template <class Op, class I0, class I1, class... Iter>
struct len_of<pythonic::builtins::details::map<Op, I0, I1, Iter...>> {
- static constexpr long _head = len_of<typename std::remove_cv<
- typename std::remove_reference<I0>::type>::type>::value;
- static constexpr long _tail =
- len_of<pythonic::builtins::details::map<Op, I1, Iter...>>::value;
+ static constexpr long _head = len_of<std::remove_cv_t<std::remove_reference_t<I0>>>::value;
+ static constexpr long _tail = len_of<pythonic::builtins::details::map<Op, I1, Iter...>>::value;
// take the minimal value. If one is negative, it will be automatically
// selected
static constexpr long value = (_head < _tail ? _head : _tail);
@@ -144,9 +135,8 @@ PYTHONIC_NS_END
template <class E, class Op, class... Iter>
struct __combined<E, pythonic::builtins::details::map<Op, Iter...>> {
- using type =
- typename __combined<E, container<typename pythonic::builtins::details::
- map<Op, Iter...>::value_type>>::type;
+ using type = typename __combined<
+ E, container<typename pythonic::builtins::details::map<Op, Iter...>::value_type>>::type;
};
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp
index 6ece9c33542..9092e07f027 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/max.hpp
@@ -12,8 +12,7 @@ namespace builtins
template <class... Types>
auto max(Types &&...values)
- -> decltype(details::minmax(operator_::functor::lt{},
- std::forward<Types>(values)...));
+ -> decltype(details::minmax(operator_::functor::lt{}, std::forward<Types>(values)...));
DEFINE_FUNCTOR(pythonic::builtins, max);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp
index 4aabbaed453..a2676ae4d8c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/min.hpp
@@ -11,8 +11,7 @@ namespace builtins
{
template <class... Types>
auto min(Types &&...values)
- -> decltype(details::minmax(operator_::functor::gt{},
- std::forward<Types>(values)...));
+ -> decltype(details::minmax(operator_::functor::gt{}, std::forward<Types>(values)...));
DEFINE_FUNCTOR(pythonic::builtins, min);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp
index 68f894dc0fc..c248aef4194 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/minmax.hpp
@@ -11,15 +11,14 @@ namespace builtins
namespace details
{
template <class Op, class T>
- typename std::decay<T>::type::value_type minmax(Op const &, T &&t);
+ typename std::decay_t<T>::value_type minmax(Op const &, T &&t);
template <class Op, class T, class F>
- typename std::decay<T>::type::value_type minmax(Op const &, T &&t,
- types::kwonly, F key);
+ typename std::decay_t<T>::value_type minmax(Op const &, T &&t, types::kwonly, F key);
template <class Op, class T0, class T1, class... Types>
- typename std::enable_if<!std::is_same<T1, types::kwonly>::value,
- typename __combined<T0, T1, Types...>::type>::type
+ std::enable_if_t<!std::is_same<T1, types::kwonly>::value,
+ typename __combined<T0, T1, Types...>::type>
minmax(Op const &, T0 const &, T1 const &, Types const &...);
} // namespace details
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp
index c31526d7eb0..e077987e08a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pow.hpp
@@ -16,8 +16,7 @@ namespace builtins
long pow(long, std::integral_constant<long, N>);
template <class... Types>
- auto pow(Types &&...args)
- -> decltype(numpy::functor::power{}(std::forward<Types>(args)...));
+ auto pow(Types &&...args) -> decltype(numpy::functor::power{}(std::forward<Types>(args)...));
DEFINE_FUNCTOR(pythonic::builtins, pow);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp
index bafed1af01a..e9d4b588de1 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_if.hpp
@@ -55,9 +55,8 @@ namespace builtins
}
template <class... Args>
auto operator()(Args &&...args) const ->
- typename __combined<
- decltype(f0(std::forward<Args>(args)...)),
- decltype(f1(std::forward<Args>(args)...))>::type
+ typename __combined<decltype(f0(std::forward<Args>(args)...)),
+ decltype(f1(std::forward<Args>(args)...))>::type
{
if (state_)
return f0(std::forward<Args>(args)...);
@@ -74,8 +73,7 @@ namespace builtins
};
} // namespace details
template <class T, class F0, class F1>
- auto static_if(T const &cond, F0 f0,
- F1 f1) -> decltype(details::static_if<T>{cond}(f0, f1));
+ auto static_if(T const &cond, F0 f0, F1 f1) -> decltype(details::static_if<T>{cond}(f0, f1));
template <class F0, class F1>
auto static_if(int const &cond, F0 f0, F1 f1)
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp
index cc3067bc0ea..6d8e32be351 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/pythran/static_list.hpp
@@ -24,16 +24,14 @@ namespace builtins
types::static_list<T, N> static_list(types::array_tuple<T, N> &&other);
template <class T>
- auto static_list(T &&other) -> decltype(pythonic::builtins::functor::list{}(
- std::forward<T>(other)));
+ auto static_list(T &&other)
+ -> decltype(pythonic::builtins::functor::list{}(std::forward<T>(other)));
template <class T0, class... Tys>
- types::static_list<typename __combined<T0, Tys...>::type,
- 1 + sizeof...(Tys)>
+ types::static_list<typename __combined<T0, Tys...>::type, 1 + sizeof...(Tys)>
static_list(std::tuple<T0, Tys...> const &other)
{
- return static_list(
- types::to_array<typename __combined<T0, Tys...>::type>(other));
+ return static_list(types::to_array<typename __combined<T0, Tys...>::type>(other));
}
DEFINE_FUNCTOR(pythonic::builtins::pythran, static_list);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp
index 7c40b6dcd6e..65abe9a7d9f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/range.hpp
@@ -10,9 +10,8 @@ namespace builtins
{
namespace
{
- struct range_iterator
- : std::iterator<std::random_access_iterator_tag, long, ptrdiff_t,
- long *, long /*no ref here*/> {
+ struct range_iterator : std::iterator<std::random_access_iterator_tag, long, ptrdiff_t, long *,
+ long /*no ref here*/> {
long value_;
long step_;
@@ -28,6 +27,7 @@ namespace builtins
bool operator!=(range_iterator const &other) const;
bool operator==(range_iterator const &other) const;
bool operator<(range_iterator const &other) const;
+ bool operator<=(range_iterator const &other) const;
long operator-(range_iterator const &other) const;
};
} // namespace
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp
index 75791102f44..2226a10b132 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/reduce.hpp
@@ -12,28 +12,25 @@ namespace builtins
{
template <class Iterable, class Operator>
- auto reduce(Operator op, Iterable s)
- -> decltype(op(std::declval<typename std::iterator_traits<
- typename Iterable::iterator>::value_type>(),
- std::declval<typename std::iterator_traits<
- typename Iterable::iterator>::value_type>()));
+ auto reduce(Operator op, Iterable s) -> decltype(op(
+ std::declval<typename std::iterator_traits<typename Iterable::iterator>::value_type>(),
+ std::declval<typename std::iterator_traits<typename Iterable::iterator>::value_type>()));
// this convoluted expression computes the fixed-point type of the output
// it's required because, e.g. static_list<long, 1> + static_list<long, 1>
// returns array_tuple<long, 2>
// and this widens to list
template <class Iterable, class Operator, class T>
- using reduce_helper_t = typename __combined<
- T, decltype(std::declval<Operator>()(
- std::declval<T const &>(),
- std::declval<typename std::iterator_traits<
- typename Iterable::iterator>::value_type>()))>::type;
+ using reduce_helper_t =
+ typename __combined<T, decltype(std::declval<Operator>()(
+ std::declval<T const &>(),
+ std::declval<typename std::iterator_traits<
+ typename Iterable::iterator>::value_type>()))>::type;
template <class Iterable, class Operator, class T>
auto reduce(Operator op, Iterable s, T const &init)
- -> decltype(std::accumulate(
- s.begin(), s.end(),
- static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op));
+ -> decltype(std::accumulate(s.begin(), s.end(),
+ static_cast<reduce_helper_t<Iterable, Operator, T>>(init), op));
DEFINE_FUNCTOR(pythonic::builtins, reduce);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp
index 6bff4e9b7a1..c7366fa2276 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set.hpp
@@ -15,11 +15,29 @@ namespace builtins
template <class Iterable>
inline types::set<typename std::iterator_traits<
- typename std::remove_reference<Iterable>::type::iterator>::value_type>
+ typename std::remove_reference_t<Iterable>::iterator>::value_type>
set(Iterable &&t);
} // namespace anonymous
DEFINE_FUNCTOR(pythonic::builtins::anonymous, set);
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::set> {
+ static PyObject *convert(builtins::functor::set const &c);
+};
+
+template <>
+struct from_python<builtins::functor::set> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::set convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp
index bdc34bc830a..fbb308bfc5e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference.hpp
@@ -19,8 +19,7 @@ namespace builtins
types::set<T> difference(types::set<T> &&set, Types const &...others);
template <typename... Types>
- types::empty_set difference(types::empty_set const &set,
- Types const &...others);
+ types::empty_set difference(types::empty_set const &set, Types const &...others);
template <typename T>
types::set<T> difference(types::set<T> const &set);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp
index 7514ad93b06..836cd626d93 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/difference_update.hpp
@@ -13,16 +13,13 @@ namespace builtins
{
template <typename T, typename... Types>
- types::none_type difference_update(types::set<T> &set,
- Types const &...others);
+ types::none_type difference_update(types::set<T> &set, Types const &...others);
template <typename T, typename... Types>
- types::none_type difference_update(types::set<T> &&set,
- Types const &...others);
+ types::none_type difference_update(types::set<T> &&set, Types const &...others);
template <typename... Types>
- types::none_type difference_update(types::empty_set const &set,
- Types const &...others);
+ types::none_type difference_update(types::empty_set const &set, Types const &...others);
DEFINE_FUNCTOR(pythonic::builtins::set, difference_update);
} // namespace set
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp
index 3a33b6bca59..7a2479d8066 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection.hpp
@@ -13,8 +13,8 @@ namespace builtins
{
template <typename T, typename... Types>
- typename __combined<types::set<T>, Types...>::type
- intersection(types::set<T> const &set, Types const &...others);
+ typename __combined<types::set<T>, Types...>::type intersection(types::set<T> const &set,
+ Types const &...others);
/* No rvalue overload possible because of return type modification.:
* >>> a = set([1,2,3])
@@ -23,8 +23,7 @@ namespace builtins
* set([1.0, 2.0, 3.0])
*/
template <typename... Types>
- types::empty_set intersection(types::empty_set const &set,
- Types const &...others);
+ types::empty_set intersection(types::empty_set const &set, Types const &...others);
DEFINE_FUNCTOR(pythonic::builtins::set, intersection);
} // namespace set
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp
index a9fd1bdfc5c..2f1cb320258 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/intersection_update.hpp
@@ -13,16 +13,13 @@ namespace builtins
{
template <typename T, typename... Types>
- types::none_type intersection_update(types::set<T> &set,
- Types const &...others);
+ types::none_type intersection_update(types::set<T> &set, Types const &...others);
template <typename T, typename... Types>
- types::none_type intersection_update(types::set<T> &&set,
- Types const &...others);
+ types::none_type intersection_update(types::set<T> &&set, Types const &...others);
template <typename... Types>
- types::none_type intersection_update(types::empty_set &&set,
- Types const &...others);
+ types::none_type intersection_update(types::empty_set &&set, Types const &...others);
DEFINE_FUNCTOR(pythonic::builtins::set, intersection_update);
} // namespace set
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp
index a58e3635ccc..584dacfecb5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference.hpp
@@ -13,8 +13,8 @@ namespace builtins
{
template <typename T, typename U>
- typename __combined<types::set<T>, U>::type
- symmetric_difference(types::set<T> const &set, U const &other);
+ typename __combined<types::set<T>, U>::type symmetric_difference(types::set<T> const &set,
+ U const &other);
/* No rvalue overload possible because of return type modification.:
* >>> a = set([1, 2, 3])
@@ -25,8 +25,8 @@ namespace builtins
// combiner is used as other may be list but return is a set
template <typename U>
- typename __combined<types::empty_set, U>::type
- symmetric_difference(types::empty_set const &set, U const &other);
+ typename __combined<types::empty_set, U>::type symmetric_difference(types::empty_set const &set,
+ U const &other);
DEFINE_FUNCTOR(pythonic::builtins::set, symmetric_difference);
} // namespace set
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp
index 71b68679fa9..f0b32416662 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/symmetric_difference_update.hpp
@@ -13,16 +13,13 @@ namespace builtins
{
template <typename T, typename U>
- types::none_type symmetric_difference_update(types::set<T> &set,
- U const &other);
+ types::none_type symmetric_difference_update(types::set<T> &set, U const &other);
template <typename T, typename U>
- types::none_type symmetric_difference_update(types::set<T> &&set,
- U const &other);
+ types::none_type symmetric_difference_update(types::set<T> &&set, U const &other);
template <typename U>
- types::none_type symmetric_difference_update(types::empty_set const &set,
- U const &other);
+ types::none_type symmetric_difference_update(types::empty_set const &set, U const &other);
DEFINE_FUNCTOR(pythonic::builtins::set, symmetric_difference_update);
} // namespace set
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp
index 2e561dd825b..284d6dda7f8 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/set/union_.hpp
@@ -13,12 +13,12 @@ namespace builtins
{
template <typename T, typename... Types>
- typename __combined<types::set<T>, Types...>::type
- union_(types::set<T> const &set, Types const &...others);
+ typename __combined<types::set<T>, Types...>::type union_(types::set<T> const &set,
+ Types const &...others);
template <typename... Types>
- typename __combined<types::empty_set, Types...>::type
- union_(types::empty_set const &init, Types const &...others);
+ typename __combined<types::empty_set, Types...>::type union_(types::empty_set const &init,
+ Types const &...others);
template <typename T>
types::set<T> union_(types::set<T> const &set);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/slice.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/slice.hpp
index e8437d11a5f..f18d1c35bc5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/slice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/slice.hpp
@@ -12,14 +12,31 @@ namespace builtins
namespace anonymous
{
types::cstride_slice<1> slice(types::none<long> stop);
- types::cstride_slice<1> slice(types::none<long> start,
- types::none<long> stop);
- types::slice slice(types::none<long> start, types::none<long> stop,
- types::none<long> step);
+ types::cstride_slice<1> slice(types::none<long> start, types::none<long> stop);
+ types::slice slice(types::none<long> start, types::none<long> stop, types::none<long> step);
} // namespace anonymous
DEFINE_FUNCTOR(pythonic::builtins::anonymous, slice);
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::slice> {
+ static PyObject *convert(builtins::functor::slice const &c);
+};
+
+template <>
+struct from_python<builtins::functor::slice> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::slice convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp
index 61553dbdde5..2d89595adc5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/sorted.hpp
@@ -1,6 +1,7 @@
#ifndef PYTHONIC_INCLUDE_BUILTIN_SORTED_HPP
#define PYTHONIC_INCLUDE_BUILTIN_SORTED_HPP
+#include "pythonic/include/builtins/pythran/kwonly.hpp"
#include "pythonic/include/types/list.hpp"
#include "pythonic/include/utils/functor.hpp"
@@ -10,19 +11,35 @@ namespace builtins
{
template <class Iterable>
- types::list<typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type>
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
sorted(Iterable &&seq);
template <class Iterable, class Key>
- types::list<typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type>
- sorted(Iterable &&seq, Key const &key, bool reverse = false);
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
+ sorted(Iterable &&seq, types::kwonly, Key const &key, bool reverse = false);
template <class Iterable>
- types::list<typename std::remove_cv<typename std::iterator_traits<
- typename std::decay<Iterable>::type::iterator>::value_type>::type>
- sorted(Iterable &&seq, types::none_type const &key, bool reverse = false);
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
+ sorted(Iterable &&seq, types::kwonly, types::none_type const &key, bool reverse = false);
+
+ template <class Iterable, class Key>
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
+ sorted(Iterable &&seq, Key const &key, bool reverse = false)
+ {
+ return sorted(std::forward<Iterable>(seq), types::kwonly{}, key, reverse);
+ }
+
+ template <class Iterable>
+ types::list<std::remove_cv_t<
+ typename std::iterator_traits<typename std::decay_t<Iterable>::iterator>::value_type>>
+ sorted(Iterable &&seq, types::kwonly, bool reverse)
+ {
+ return sorted(std::forward<Iterable>(seq), types::kwonly{}, types::none_type{}, reverse);
+ }
DEFINE_FUNCTOR(pythonic::builtins, sorted);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp
index 4adf0379b6b..6430128ee98 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str.hpp
@@ -24,4 +24,23 @@ namespace builtins
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::str> {
+ static PyObject *convert(builtins::functor::str const &c);
+};
+
+template <>
+struct from_python<builtins::functor::str> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::str convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp
index 5a687fd6f72..45b28b2e84b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/__mod__.hpp
@@ -16,8 +16,7 @@ namespace builtins
template <class... Ts>
types::str __mod__(types::str const &, std::tuple<Ts...> const &args);
template <size_t N, class T>
- types::str __mod__(types::str const &,
- types::array_tuple<T, N> const &args);
+ types::str __mod__(types::str const &, types::array_tuple<T, N> const &args);
DEFINE_FUNCTOR(pythonic::builtins::str, __mod__);
} // namespace str
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp
index 4772df1d17f..c4d4b207ad6 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/endswith.hpp
@@ -13,8 +13,7 @@ namespace builtins
{
// TODO : Add implementation for tuple as first argument.
- bool endswith(types::str const &s, types::str const &suffix, long start = 0,
- long end = -1);
+ bool endswith(types::str const &s, types::str const &suffix, long start = 0, long end = -1);
DEFINE_FUNCTOR(pythonic::builtins::str, endswith);
} // namespace str
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp
index f7563e670b2..ba6dcf5fdd8 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/find.hpp
@@ -12,8 +12,7 @@ namespace builtins
namespace str
{
- long find(types::str const &s, types::str const &value, long start,
- long end);
+ long find(types::str const &s, types::str const &value, long start, long end);
long find(types::str const &s, types::str const &value, long start);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp
index cac5684f615..5bef5d694ce 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/join.hpp
@@ -18,25 +18,20 @@ namespace builtins
/* Join for string.join(random acces iter but ! on string) */
template <class S, class Iterable>
- typename std::enable_if<
- !std::is_same<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type,
- types::str>::value &&
- std::is_same<
- typename std::iterator_traits<typename std::remove_reference<
- Iterable>::type::iterator>::iterator_category,
- std::random_access_iterator_tag>::value,
- types::str>::type
+ std::enable_if_t<
+ !std::is_same<std::remove_cv_t<std::remove_reference_t<Iterable>>, types::str>::value &&
+ std::is_same<typename std::iterator_traits<typename std::remove_reference_t<
+ Iterable>::iterator>::iterator_category,
+ std::random_access_iterator_tag>::value,
+ types::str>
join(S const &s, Iterable &&iterable);
/* Join for string.join(forward iterator) */
template <class S, class Iterable>
- typename std::enable_if<
- !std::is_same<
- typename std::iterator_traits<typename std::remove_reference<
- Iterable>::type::iterator>::iterator_category,
- std::random_access_iterator_tag>::value,
- types::str>::type
+ std::enable_if_t<!std::is_same<typename std::iterator_traits<typename std::remove_reference_t<
+ Iterable>::iterator>::iterator_category,
+ std::random_access_iterator_tag>::value,
+ types::str>
join(S const &s, Iterable &&iterable);
DEFINE_FUNCTOR(pythonic::builtins::str, join);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp
index 43304c4b3e6..aa6ac1bb9d8 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/split.hpp
@@ -14,11 +14,9 @@ namespace builtins
namespace str
{
- types::list<types::str> split(types::str const &in, types::str const &sep,
- long maxsplit = -1);
+ types::list<types::str> split(types::str const &in, types::str const &sep, long maxsplit = -1);
- types::list<types::str> split(types::str const &s,
- types::none_type const & = {},
+ types::list<types::str> split(types::str const &s, types::none_type const & = {},
long maxsplit = -1);
DEFINE_FUNCTOR(pythonic::builtins::str, split);
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/splitlines.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/splitlines.hpp
deleted file mode 100644
index 8bc7a3c45c0..00000000000
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/splitlines.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef PYTHONIC_INCLUDE_BUILTIN_STR_SPLITLINES_HPP
-#define PYTHONIC_INCLUDE_BUILTIN_STR_SPLITLINES_HPP
-
-#include "pythonic/include/types/list.hpp"
-#include "pythonic/include/types/str.hpp"
-#include "pythonic/include/utils/functor.hpp"
-
-PYTHONIC_NS_BEGIN
-
-namespace builtins
-{
-
- namespace str
- {
-
- types::list<types::str> splitlines(types::str const &in, bool keepends = false);
-
- DEFINE_FUNCTOR(pythonic::builtins::str, splitlines);
- }
-}
-PYTHONIC_NS_END
-#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp
index 41fe3878271..79a1d93423b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/str/startswith.hpp
@@ -12,8 +12,7 @@ namespace builtins
namespace str
{
- bool startswith(types::str const &s, types::str const &prefix,
- long start = 0, long end = -1);
+ bool startswith(types::str const &s, types::str const &prefix, long start = 0, long end = -1);
DEFINE_FUNCTOR(pythonic::builtins::str, startswith);
} // namespace str
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp
index dd5adfce71a..d6f23419af7 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/sum.hpp
@@ -17,8 +17,7 @@ namespace builtins
{
template <class Tuple, size_t N>
struct tuple_sum {
- auto operator()(Tuple const &t) -> decltype(std::get<N>(t) +
- tuple_sum<Tuple, N - 1>()(t));
+ auto operator()(Tuple const &t) -> decltype(std::get<N>(t) + tuple_sum<Tuple, N - 1>()(t));
};
template <class Tuple>
@@ -28,11 +27,9 @@ namespace builtins
} // namespace details
template <class Iterable, class T>
- auto sum(Iterable s, T start)
- -> decltype(std::accumulate(
- s.begin(), s.end(),
- static_cast<typename assignable<decltype(start + *s.begin())>::type>(
- start)));
+ auto sum(Iterable s, T start) -> decltype(std::accumulate(
+ s.begin(), s.end(),
+ static_cast<typename assignable<decltype(start + *s.begin())>::type>(start)));
template <class Iterable>
auto sum(Iterable s) -> decltype(sum(s, 0L))
@@ -42,8 +39,7 @@ namespace builtins
template <class... Types>
auto sum(std::tuple<Types...> const &t)
- -> decltype(details::tuple_sum<std::tuple<Types...>,
- sizeof...(Types) - 1>()(t))
+ -> decltype(details::tuple_sum<std::tuple<Types...>, sizeof...(Types) - 1>()(t))
{
return details::tuple_sum<std::tuple<Types...>, sizeof...(Types) - 1>()(t);
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp
index 1dcdcfa40df..5034178e5f0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/tuple.hpp
@@ -13,33 +13,50 @@ namespace builtins
template <class... Types>
std::tuple<Types...> tuple(std::tuple<Types...> const &t);
+ inline std::tuple<> tuple()
+ {
+ return {};
+ }
+
template <class Iterable> /* this is far from perfect, but how to cope with
the
difference between python tuples && c++ ones ? */
- typename std::enable_if <
- types::len_of<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>::
- value<0, types::dynamic_tuple<typename std::iterator_traits<
- typename std::remove_cv<typename std::remove_reference<
- Iterable>::type>::type::iterator>::value_type>>::type
- tuple(Iterable &&i);
+ std::enable_if_t <
+ types::len_of<std::remove_cv_t<std::remove_reference_t<Iterable>>>::value<
+ 0, types::dynamic_tuple<typename std::iterator_traits<typename std::remove_cv_t<
+ std::remove_reference_t<Iterable>>::iterator>::value_type>>
+ tuple(Iterable &&i);
- template <
- class StaticIterable> /* specialization if we are capable to statically
- compute the size of the input */
- typename std::enable_if<
- types::len_of<typename std::remove_cv<typename std::remove_reference<
- StaticIterable>::type>::type>::value >= 0,
+ template <class StaticIterable> /* specialization if we are capable to statically
+ compute the size of the input */
+ std::enable_if_t<
+ types::len_of<std::remove_cv_t<std::remove_reference_t<StaticIterable>>>::value >= 0,
types::array_tuple<
- typename std::iterator_traits<
- typename std::remove_cv<typename std::remove_reference<
- StaticIterable>::type>::type::iterator>::value_type,
- types::len_of<typename std::remove_cv<typename std::remove_reference<
- StaticIterable>::type>::type>::value>>::type
+ typename std::iterator_traits<typename std::remove_cv_t<
+ std::remove_reference_t<StaticIterable>>::iterator>::value_type,
+ types::len_of<std::remove_cv_t<std::remove_reference_t<StaticIterable>>>::value>>
tuple(StaticIterable &&i);
DEFINE_FUNCTOR(pythonic::builtins, tuple);
} // namespace builtins
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<builtins::functor::tuple> {
+ static PyObject *convert(builtins::functor::tuple const &c);
+};
+
+template <>
+struct from_python<builtins::functor::tuple> {
+ static bool is_convertible(PyObject *obj);
+ static builtins::functor::tuple convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp
index bd50e722b84..40ba8418a05 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/type.hpp
@@ -1,15 +1,14 @@
#ifndef PYTHONIC_INCLUDE_BUILTIN_TYPE_HPP
#define PYTHONIC_INCLUDE_BUILTIN_TYPE_HPP
+#include "pythonic/include/types/type.hpp"
+
PYTHONIC_NS_BEGIN
namespace builtins
{
template <class T>
- struct type_functor;
-
- template <class T>
- typename type_functor<T>::type type(T const &t);
+ typename types::type_functor<T>::type type(T const &t);
DEFINE_FUNCTOR(pythonic::builtins, type);
} // namespace builtins
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp
index 9b2d17d0d46..fb2dd1a6ed6 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/xrange.hpp
@@ -11,9 +11,8 @@ namespace builtins
namespace
{
- struct xrange_iterator
- : std::iterator<std::random_access_iterator_tag, long, ptrdiff_t,
- long *, long /*no ref here*/> {
+ struct xrange_iterator : std::iterator<std::random_access_iterator_tag, long, ptrdiff_t, long *,
+ long /*no ref here*/> {
long value_;
long step_;
diff --git a/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp b/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp
index 731f91eecdd..47c214f7067 100644
--- a/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/builtins/zip.hpp
@@ -10,8 +10,7 @@ namespace builtins
{
template <typename... Iter>
- auto zip(Iter &&...iters) -> decltype(map(builtins::None,
- std::forward<Iter>(iters)...));
+ auto zip(Iter &&...iters) -> decltype(map(builtins::None, std::forward<Iter>(iters)...));
DEFINE_FUNCTOR(pythonic::builtins, zip);
} // namespace builtins
diff --git a/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp b/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp
index 9fdf30ee90b..2fe16636959 100644
--- a/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/functools/partial.hpp
@@ -36,27 +36,23 @@ namespace functools
task(ClosureTypes const &...types);
template <std::size_t... S, typename... Types>
- auto call(utils::index_sequence<S...>, Types &&...types) const
+ auto call(std::index_sequence<S...>, Types &&...types) const
-> decltype(std::get<0>(closure)(std::get<S + 1>(closure)...,
std::forward<Types>(types)...))
{
- return std::get<0>(closure)(std::get<S + 1>(closure)...,
- std::forward<Types>(types)...);
+ return std::get<0>(closure)(std::get<S + 1>(closure)..., std::forward<Types>(types)...);
}
template <typename... Types>
auto operator()(Types &&...types) const
- -> decltype(this->call(
- utils::make_index_sequence<sizeof...(ClosureTypes) - 1>(),
- std::forward<Types>(types)...));
+ -> decltype(this->call(std::make_index_sequence<sizeof...(ClosureTypes) - 1>(),
+ std::forward<Types>(types)...));
};
} // namespace details
template <typename... Types>
// remove references as closure capture the env by copy
- details::task<typename std::remove_cv<
- typename std::remove_reference<Types>::type>::type...>
- partial(Types &&...types);
+ details::task<std::remove_cv_t<std::remove_reference_t<Types>>...> partial(Types &&...types);
DEFINE_FUNCTOR(pythonic::functools, partial);
} // namespace functools
diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/combinations.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/combinations.hpp
index 9b7894033b8..8ba9375426d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/itertools/combinations.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/itertools/combinations.hpp
@@ -16,20 +16,15 @@ namespace itertools
{
template <class T>
struct combination_iterator
- : std::iterator<std::forward_iterator_tag,
- types::dynamic_tuple<typename T::value_type>, ptrdiff_t,
- types::dynamic_tuple<typename T::value_type> *,
+ : std::iterator<std::forward_iterator_tag, types::dynamic_tuple<typename T::value_type>,
+ ptrdiff_t, types::dynamic_tuple<typename T::value_type> *,
types::dynamic_tuple<typename T::value_type> /*no ref*/
> {
- std::vector<typename T::value_type,
- utils::allocator<typename T::value_type>>
- pool;
+ std::vector<typename T::value_type, utils::allocator<typename T::value_type>> pool;
std::vector<long, utils::allocator<long>> indices;
long r;
bool stopped;
- std::vector<typename T::value_type,
- utils::allocator<typename T::value_type>>
- result;
+ std::vector<typename T::value_type, utils::allocator<typename T::value_type>> result;
combination_iterator() = default;
combination_iterator(bool);
@@ -62,9 +57,8 @@ namespace itertools
} // namespace details
template <typename T0>
- details::combination<
- typename std::remove_cv<typename std::remove_reference<T0>::type>::type>
- combinations(T0 &&iter, long num_elts);
+ details::combination<std::remove_cv_t<std::remove_reference_t<T0>>> combinations(T0 &&iter,
+ long num_elts);
DEFINE_FUNCTOR(pythonic::itertools, combinations);
} // namespace itertools
@@ -75,9 +69,8 @@ PYTHONIC_NS_END
template <class E, class T>
struct __combined<E, pythonic::itertools::details::combination<T>> {
- using type =
- typename __combined<E, container<typename pythonic::itertools::details::
- combination<T>::value_type>>::type;
+ using type = typename __combined<
+ E, container<typename pythonic::itertools::details::combination<T>::value_type>>::type;
};
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp
index 06e93d9658a..90316b47ea1 100644
--- a/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/itertools/count.hpp
@@ -41,8 +41,7 @@ namespace itertools
} // namespace details
template <typename T0, typename T1 = T0>
- details::count<typename __combined<T0, T1>::type> count(T0 start,
- T1 step = 1);
+ details::count<typename __combined<T0, T1>::type> count(T0 start, T1 step = 1);
details::count<long> count();
@@ -55,9 +54,8 @@ PYTHONIC_NS_END
template <class E, class T>
struct __combined<E, pythonic::itertools::details::count<T>> {
- using type =
- typename __combined<E, container<typename pythonic::itertools::details::
- count<T>::value_type>>::type;
+ using type = typename __combined<
+ E, container<typename pythonic::itertools::details::count<T>::value_type>>::type;
};
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/ifilter.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/ifilter.hpp
index bc5c33dcf4e..692bced42af 100644
--- a/contrib/python/pythran/pythran/pythonic/include/itertools/ifilter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/itertools/ifilter.hpp
@@ -15,10 +15,8 @@ namespace itertools
{
template <typename Operator, typename List0>
- details::filter<typename std::remove_cv<
- typename std::remove_reference<Operator>::type>::type,
- typename std::remove_cv<
- typename std::remove_reference<List0>::type>::type>
+ details::filter<std::remove_cv_t<std::remove_reference_t<Operator>>,
+ std::remove_cv_t<std::remove_reference_t<List0>>>
ifilter(Operator &&_op, List0 &&_seq);
DEFINE_FUNCTOR(pythonic::itertools, ifilter);
diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp
index b6545a0a02b..e4075e4ac19 100644
--- a/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/itertools/islice.hpp
@@ -13,12 +13,9 @@ namespace itertools
template <typename Iterable>
struct islice_iterator
: std::iterator<typename Iterable::iterator::iterator_category,
- typename std::iterator_traits<
- typename Iterable::iterator>::value_type> {
- typename std::remove_reference<
- typename std::remove_cv<Iterable>::type>::type iterable_ref;
- typename std::remove_reference<
- typename std::remove_cv<Iterable>::type>::type::iterator iterable;
+ typename std::iterator_traits<typename Iterable::iterator>::value_type> {
+ std::remove_reference_t<std::remove_cv_t<Iterable>> iterable_ref;
+ typename std::remove_reference_t<std::remove_cv_t<Iterable>>::iterator iterable;
builtins::range xr_ref;
builtins::range_iterator state;
@@ -26,8 +23,7 @@ namespace itertools
islice_iterator();
islice_iterator(Iterable const &iterable, builtins::range const &xr);
- islice_iterator(npos const &n, Iterable const &iterable,
- builtins::range const &xr);
+ islice_iterator(npos const &n, Iterable const &iterable, builtins::range const &xr);
typename Iterable::value_type operator*() const;
islice_iterator &operator++();
@@ -54,14 +50,12 @@ namespace itertools
};
template <typename Iterable>
- _islice<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>
+ _islice<std::remove_cv_t<std::remove_reference_t<Iterable>>>
islice(Iterable &&iterable, long start, long stop, long step = 1);
template <typename Iterable>
- _islice<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>
- islice(Iterable &&iterable, long stop);
+ _islice<std::remove_cv_t<std::remove_reference_t<Iterable>>> islice(Iterable &&iterable,
+ long stop);
DEFINE_FUNCTOR(pythonic::itertools, islice);
} // namespace itertools
@@ -72,8 +66,8 @@ PYTHONIC_NS_END
template <class E, class T>
struct __combined<E, pythonic::itertools::_islice<T>> {
- using type = typename __combined<
- E, container<typename pythonic::itertools::_islice<T>::value_type>>::type;
+ using type =
+ typename __combined<E, container<typename pythonic::itertools::_islice<T>::value_type>>::type;
};
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp
index 7b0630622ca..bc780083d66 100644
--- a/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/itertools/permutations.hpp
@@ -30,13 +30,12 @@ namespace itertools
*
*/
template <class T, class H>
- struct permutations_iterator : std::iterator<std::forward_iterator_tag, H,
- ptrdiff_t, H *, H /* no ref*/
- > {
+ struct permutations_iterator
+ : std::iterator<std::forward_iterator_tag, H, ptrdiff_t, H *, H /* no ref*/
+ > {
// Vector of inputs, contains elements to permute
- using pool_type = std::vector<typename T::value_type,
- utils::allocator<typename T::value_type>>;
+ using pool_type = std::vector<typename T::value_type, utils::allocator<typename T::value_type>>;
pool_type pool;
// The current permutation as a dynamic_tuple of index in the pool
@@ -80,12 +79,11 @@ namespace itertools
};
template <typename T0>
- _permutations<T0, types::dynamic_tuple<typename T0::value_type>>
- permutations(T0 iter, long num_elts);
+ _permutations<T0, types::dynamic_tuple<typename T0::value_type>> permutations(T0 iter,
+ long num_elts);
template <typename T0>
- _permutations<T0, types::dynamic_tuple<typename T0::value_type>>
- permutations(T0 iter);
+ _permutations<T0, types::dynamic_tuple<typename T0::value_type>> permutations(T0 iter);
template <typename T0, long N0>
_permutations<T0, types::array_tuple<typename T0::value_type, (size_t)N0>>
@@ -100,10 +98,8 @@ PYTHONIC_NS_END
template <class E, class T, class H>
struct __combined<E, pythonic::itertools::_permutations<T, H>> {
- using type =
- typename __combined<E,
- container<typename pythonic::itertools::_permutations<
- T, H>::value_type>>::type;
+ using type = typename __combined<
+ E, container<typename pythonic::itertools::_permutations<T, H>::value_type>>::type;
};
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp
index 070726c630d..e0cbdfde20b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/itertools/product.hpp
@@ -19,9 +19,8 @@ namespace itertools
// FIXME : should be a combined_iterator_tag
template <typename... Iters>
- struct product_iterator
- : std::iterator<std::forward_iterator_tag,
- types::make_tuple_t<typename Iters::value_type...>> {
+ struct product_iterator : std::iterator<std::forward_iterator_tag,
+ types::make_tuple_t<typename Iters::value_type...>> {
std::tuple<typename Iters::iterator...> const it_begin;
std::tuple<typename Iters::iterator...> const it_end;
@@ -30,11 +29,9 @@ namespace itertools
product_iterator() = default;
template <size_t... I>
- product_iterator(std::tuple<Iters...> &_iters,
- utils::index_sequence<I...> const &);
+ product_iterator(std::tuple<Iters...> &_iters, std::index_sequence<I...> const &);
template <size_t... I>
- product_iterator(npos, std::tuple<Iters...> &_iters,
- utils::index_sequence<I...> const &);
+ product_iterator(npos, std::tuple<Iters...> &_iters, std::index_sequence<I...> const &);
types::make_tuple_t<typename Iters::value_type...> operator*() const;
product_iterator &operator++();
bool operator==(product_iterator const &other) const;
@@ -47,12 +44,11 @@ namespace itertools
void advance(utils::int_<0>);
template <size_t... I>
types::make_tuple_t<typename Iters::value_type...>
- get_value(utils::index_sequence<I...> const &) const;
+ get_value(std::index_sequence<I...> const &) const;
};
template <typename... Iters>
- struct product : utils::iterator_reminder<true, Iters...>,
- product_iterator<Iters...> {
+ struct product : utils::iterator_reminder<true, Iters...>, product_iterator<Iters...> {
using value_type = types::make_tuple_t<typename Iters::value_type...>;
using iterator = product_iterator<Iters...>;
@@ -69,9 +65,7 @@ namespace itertools
} // namespace details
template <typename... Iter>
- details::product<typename std::remove_cv<
- typename std::remove_reference<Iter>::type>::type...>
- product(Iter &&...iters);
+ details::product<std::remove_cv_t<std::remove_reference_t<Iter>>...> product(Iter &&...iters);
DEFINE_FUNCTOR(pythonic::itertools, product);
} // namespace itertools
@@ -82,9 +76,8 @@ PYTHONIC_NS_END
template <class E, class... Iter>
struct __combined<E, pythonic::itertools::details::product<Iter...>> {
- using type =
- typename __combined<E, container<typename pythonic::itertools::details::
- product<Iter...>::value_type>>::type;
+ using type = typename __combined<
+ E, container<typename pythonic::itertools::details::product<Iter...>::value_type>>::type;
};
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp b/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp
index 477a789af5b..9c48d91c582 100644
--- a/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/itertools/repeat.hpp
@@ -10,8 +10,7 @@ PYTHONIC_NS_BEGIN
namespace itertools
{
template <class T, bool Endless>
- struct repeat_iterator : std::iterator<std::forward_iterator_tag, T,
- ptrdiff_t, T *, T /* no ref*/
+ struct repeat_iterator : std::iterator<std::forward_iterator_tag, T, ptrdiff_t, T *, T /* no ref*/
> {
T value_;
long count_;
@@ -51,9 +50,9 @@ PYTHONIC_NS_END
template <class E, class T, bool C>
struct __combined<E, pythonic::itertools::_repeat<T, C>> {
- using type = typename __combined<
- E,
- container<typename pythonic::itertools::_repeat<T, C>::value_type>>::type;
+ using type =
+ typename __combined<E,
+ container<typename pythonic::itertools::_repeat<T, C>::value_type>>::type;
};
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp
index cfe8caf1bed..877b2c55e8f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/all.hpp
@@ -10,29 +10,24 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- typename std::enable_if<types::is_numexpr_arg<E>::value, bool>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value, bool>
all(E const &expr, types::none_type _ = types::none_type());
template <class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, bool>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, bool>
all(E const &expr, types::none_type _ = types::none_type());
template <class E>
- auto all(E const &array, long axis) ->
- typename std::enable_if<std::is_scalar<E>::value ||
- types::is_complex<E>::value,
- decltype(all(array))>::type;
+ auto all(E const &array, long axis)
+ -> std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value,
+ decltype(all(array))>;
template <class E>
- auto all(E const &array, long axis) ->
- typename std::enable_if<E::value == 1, decltype(all(array))>::type;
+ auto all(E const &array, long axis) -> std::enable_if_t<E::value == 1, decltype(all(array))>;
template <class E>
- typename std::enable_if<
- E::value != 1,
- types::ndarray<typename E::dtype,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<E::value != 1,
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value - 1>>>
all(E const &array, long axis);
DEFINE_FUNCTOR(pythonic::numpy, all);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp
index e73ff3660ab..5e96ce5851a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/alltrue.hpp
@@ -8,8 +8,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class... Types>
- auto
- alltrue(Types &&...types) -> decltype(all(std::forward<Types>(types)...));
+ auto alltrue(Types &&...types) -> decltype(all(std::forward<Types>(types)...));
DEFINE_FUNCTOR(pythonic::numpy, alltrue);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp
index a0d032753a2..a292a56fe3f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/angle_in_rad.hpp
@@ -17,8 +17,7 @@ namespace numpy
namespace wrapper
{
template <class T>
- auto angle_in_rad(T const &t) -> decltype(std::atan2(std::imag(t),
- std::real(t)));
+ auto angle_in_rad(T const &t) -> decltype(std::atan2(std::imag(t), std::real(t)));
}
#define NUMPY_NARY_FUNC_NAME angle_in_rad
#define NUMPY_NARY_FUNC_SYM wrapper::angle_in_rad
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp
index 044005a66a9..0c0e7c896db 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/any.hpp
@@ -10,29 +10,24 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- typename std::enable_if<types::is_numexpr_arg<E>::value, bool>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value, bool>
any(E const &expr, types::none_type _ = types::none_type());
template <class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, bool>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, bool>
any(E const &expr, types::none_type _ = types::none_type());
template <class E>
- auto any(E const &array, long axis) ->
- typename std::enable_if<std::is_scalar<E>::value ||
- types::is_complex<E>::value,
- decltype(any(array))>::type;
+ auto any(E const &array, long axis)
+ -> std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value,
+ decltype(any(array))>;
template <class E>
- auto any(E const &array, long axis) ->
- typename std::enable_if<E::value == 1, decltype(any(array))>::type;
+ auto any(E const &array, long axis) -> std::enable_if_t<E::value == 1, decltype(any(array))>;
template <class E>
- typename std::enable_if<
- E::value != 1,
- types::ndarray<typename E::dtype,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<E::value != 1,
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value - 1>>>
any(E const &array, long axis);
DEFINE_FUNCTOR(pythonic::numpy, any);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp
index c78901598c4..f3ae8800d98 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/append.hpp
@@ -9,19 +9,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS, class F>
- typename std::enable_if<
- !types::is_dtype<F>::value,
- types::ndarray<
- typename __combined<T, typename types::dtype_of<F>::type>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<!types::is_dtype<F>::value,
+ types::ndarray<typename __combined<T, typename types::dtype_of<F>::type>::type,
+ types::pshape<long>>>
append(types::ndarray<T, pS> const &nto, F const &data);
template <class T, class pS, class F>
- typename std::enable_if<
- types::is_dtype<F>::value,
- types::ndarray<
- typename __combined<T, typename types::dtype_of<F>::type>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<types::is_dtype<F>::value,
+ types::ndarray<typename __combined<T, typename types::dtype_of<F>::type>::type,
+ types::pshape<long>>>
append(types::ndarray<T, pS> const &nto, F const &data);
template <class T, class F>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp
index 7148c517313..14e06ec3c81 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/arange.hpp
@@ -70,8 +70,7 @@ namespace numpy
{
return index_ < other.index_;
}
- arange_simd_iterator &
- operator=(arange_simd_iterator const &other) = default;
+ arange_simd_iterator &operator=(arange_simd_iterator const &other) = default;
};
#endif
template <class T>
@@ -120,9 +119,7 @@ namespace numpy
{
auto ns = s.normalize(size);
arange_index r{start + s.lower * step, step * ns.step, ns.size()};
- return {
- types::numpy_expr<pythonic::operator_::functor::pos, arange_index>{
- r}};
+ return {types::numpy_expr<pythonic::operator_::functor::pos, arange_index>{r}};
}
types::ndarray<dtype, shape_t> operator()(types::slice s) const
{
@@ -130,33 +127,26 @@ namespace numpy
}
template <long stride>
- types::ndarray<dtype, shape_t>
- operator[](types::cstride_slice<stride> s) const
+ types::ndarray<dtype, shape_t> operator[](types::cstride_slice<stride> s) const
{
auto ns = s.normalize(size);
arange_index r{start + s.lower * step, step * stride, ns.size()};
- return {
- types::numpy_expr<pythonic::operator_::functor::pos, arange_index>{
- r}};
+ return {types::numpy_expr<pythonic::operator_::functor::pos, arange_index>{r}};
}
template <long stride>
- types::ndarray<dtype, shape_t>
- operator()(types::cstride_slice<stride> s) const
+ types::ndarray<dtype, shape_t> operator()(types::cstride_slice<stride> s) const
{
return operator[](s);
}
template <class... S>
- auto operator()(S const &...s) const ->
- typename std::enable_if<
- (sizeof...(S) > 1),
- decltype(std::declval<types::ndarray<dtype, shape_t>>()(
- s...))>::type
+ auto operator()(S const &...s) const
+ -> std::enable_if_t<(sizeof...(S) > 1),
+ decltype(std::declval<types::ndarray<dtype, shape_t>>()(s...))>
{
return types::ndarray<dtype, shape_t>{
- types::numpy_expr<pythonic::operator_::functor::pos, arange_index>{
- *this}}(s...);
+ types::numpy_expr<pythonic::operator_::functor::pos, arange_index>{*this}}(s...);
}
const_iterator begin() const
{
@@ -180,8 +170,7 @@ namespace numpy
template <class T, class U, class S = long,
class dtype = types::dtype_t<typename __combined<T, U, S>::type>>
- types::numpy_expr<pythonic::operator_::functor::pos,
- details::arange_index<typename dtype::type>>
+ types::numpy_expr<pythonic::operator_::functor::pos, details::arange_index<typename dtype::type>>
arange(T begin, U end, S step = S(1), dtype d = dtype());
template <class T>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp
index bc8de17e626..091fec0e07e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argmax.hpp
@@ -13,8 +13,7 @@ namespace numpy
long argmax(E const &expr);
template <class E>
- types::ndarray<long, types::array_tuple<long, E::value - 1>>
- argmax(E const &expr, long axis);
+ types::ndarray<long, types::array_tuple<long, E::value - 1>> argmax(E const &expr, long axis);
DEFINE_FUNCTOR(pythonic::numpy, argmax);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp
index 126ac3bb8c0..deb9ee0552a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argmin.hpp
@@ -12,8 +12,7 @@ namespace numpy
long argmin(E const &expr);
template <class E>
- types::ndarray<long, types::array_tuple<long, E::value - 1>>
- argmin(E const &expr, long axis);
+ types::ndarray<long, types::array_tuple<long, E::value - 1>> argmin(E const &expr, long axis);
DEFINE_FUNCTOR(pythonic::numpy, argmin);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp
index 6926de372e5..9240e39dc62 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argsort.hpp
@@ -9,12 +9,12 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::ndarray<long, types::array_tuple<long, 1>>
- argsort(E const &expr, types::none_type, types::none_type = {});
+ types::ndarray<long, types::array_tuple<long, 1>> argsort(E const &expr, types::none_type,
+ types::none_type = {});
template <class T, class pS>
- types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a,
- long axis = -1, types::none_type kind = {});
+ types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis = -1,
+ types::none_type kind = {});
template <class T, class pS>
types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis,
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp
index 90107d2f584..6d9d30acb00 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/argwhere.hpp
@@ -9,8 +9,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- typename types::ndarray<long, types::array_tuple<long, 2>>
- argwhere(E const &expr);
+ typename types::ndarray<long, types::array_tuple<long, 2>> argwhere(E const &expr);
DEFINE_FUNCTOR(pythonic::numpy, argwhere);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp
index 4e9ae04c522..42ebb913395 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/around.hpp
@@ -17,29 +17,21 @@ namespace numpy
// generic floating point version, pure numpy_expr
template <class E>
- auto around(E &&a, long decimals) ->
- typename std::enable_if<
- !std::is_integral<typename types::dtype_of<
- typename std::decay<E>::type>::type>::value,
- decltype(functor::rint{}(functor::multiply{}(
- std::forward<E>(a),
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>())) /
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>())>::type;
+ auto around(E &&a, long decimals) -> std::enable_if_t<
+ !std::is_integral<typename types::dtype_of<std::decay_t<E>>::type>::value,
+ decltype(functor::rint{}(functor::multiply{}(
+ std::forward<E>(a),
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>())) /
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>())>;
// the integer version is only relevant when decimals < 0
template <class E>
- auto around(E &&a, long decimals) ->
- typename std::enable_if<
- std::is_integral<typename types::dtype_of<
- typename std::decay<E>::type>::type>::value,
- decltype(numpy::functor::floor_divide{}(
- functor::float64{}(std::forward<E>(a)),
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>()) *
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>())>::type;
+ auto around(E &&a, long decimals) -> std::enable_if_t<
+ std::is_integral<typename types::dtype_of<std::decay_t<E>>::type>::value,
+ decltype(numpy::functor::floor_divide{}(
+ functor::float64{}(std::forward<E>(a)),
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>()) *
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>())>;
DEFINE_FUNCTOR(pythonic::numpy, around);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp
index d64ec19f4cc..9b58cdcdef5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/array.hpp
@@ -9,48 +9,36 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
- template <class T,
- class dtype = types::dtype_t<typename std::decay<T>::type::dtype>>
- typename std::enable_if<
- types::has_size<typename std::decay<T>::type>::value,
- types::ndarray<typename dtype::type,
- types::array_tuple<long, std::decay<T>::type::value>>>::
- type
- array(T &&iterable, dtype d = dtype());
- template <class T,
- class dtype = types::dtype_t<typename std::decay<T>::type::dtype>>
- typename std::enable_if<
- !types::has_size<typename std::decay<T>::type>::value &&
- !types::is_dtype<typename std::decay<T>::type>::value,
- types::ndarray<typename dtype::type,
- types::array_tuple<long, std::decay<T>::type::value>>>::
- type
- array(T &&iterable, dtype d = dtype());
+ template <class T, class dtype = types::dtype_t<typename std::decay_t<T>::dtype>>
+ std::enable_if_t<
+ types::has_size<std::decay_t<T>>::value,
+ types::ndarray<typename dtype::type, types::array_tuple<long, std::decay_t<T>::value>>>
+ array(T &&iterable, dtype d = dtype());
+ template <class T, class dtype = types::dtype_t<typename std::decay_t<T>::dtype>>
+ std::enable_if_t<
+ !types::has_size<std::decay_t<T>>::value && !types::is_dtype<std::decay_t<T>>::value,
+ types::ndarray<typename dtype::type, types::array_tuple<long, std::decay_t<T>::value>>>
+ array(T &&iterable, dtype d = dtype());
- template <class T, class dtype = types::dtype_t<typename types::dtype_of<
- typename std::decay<T>::type>::type>>
- typename std::enable_if<
- !types::has_size<typename std::decay<T>::type>::value &&
- types::is_dtype<typename std::decay<T>::type>::value,
- typename dtype::type>::type
+ template <class T, class dtype = types::dtype_t<typename types::dtype_of<std::decay_t<T>>::type>>
+ std::enable_if_t<!types::has_size<std::decay_t<T>>::value &&
+ types::is_dtype<std::decay_t<T>>::value,
+ typename dtype::type>
array(T &&non_iterable, dtype d = dtype());
template <class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, 0>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, 0>>>
array(std::tuple<>, dtype);
template <class T, class pS>
types::ndarray<T, pS> array(types::ndarray<T, pS> const &arr);
template <class T, size_t N, class V, class dtype = types::dtype_of<T>>
- types::ndarray<typename dtype::type,
- typename types::array_base<T, N, V>::shape_t>
+ types::ndarray<typename dtype::type, typename types::array_base<T, N, V>::shape_t>
array(types::array_base<T, N, V> const &, dtype d = dtype());
template <class T, size_t N, class V, class dtype = types::dtype_of<T>>
- types::ndarray<typename dtype::type,
- typename types::array_base<T, N, V>::shape_t>
+ types::ndarray<typename dtype::type, typename types::array_base<T, N, V>::shape_t>
array(types::array_base<T, N, V> &&, dtype d = dtype());
template <class... Ts>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp
index d79c84c6a56..c0e2c053053 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/array_equiv.hpp
@@ -10,16 +10,13 @@ namespace numpy
{
template <class U, class V>
- typename std::enable_if<U::value == V::value, bool>::type
- array_equiv(U const &u, V const &v);
+ std::enable_if_t<U::value == V::value, bool> array_equiv(U const &u, V const &v);
template <class U, class V>
- typename std::enable_if <
- U::value<V::value, bool>::type array_equiv(U const &u, V const &v);
+ std::enable_if_t < U::value<V::value, bool> array_equiv(U const &u, V const &v);
template <class U, class V>
- typename std::enable_if<(U::value > V::value), bool>::type
- array_equiv(U const &u, V const &v);
+ std::enable_if_t<(U::value > V::value), bool> array_equiv(U const &u, V const &v);
DEFINE_FUNCTOR(pythonic::numpy, array_equiv);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/array_split.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/array_split.hpp
index d425c02e2e0..4ccbd69358d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/array_split.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/array_split.hpp
@@ -9,17 +9,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::list<typename assignable<
- decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
+ types::list<
+ typename assignable<decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
array_split(E const &a, long nb_split);
template <class E, class I>
- typename std::enable_if<
- types::is_iterable<I>::value,
- types::list<typename assignable<
- decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>>::
- type
- array_split(E const &a, I const &split_mask);
+ std::enable_if_t<types::is_iterable<I>::value,
+ types::list<typename assignable<
+ decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>>
+ array_split(E const &a, I const &split_mask);
NUMPY_EXPR_TO_NDARRAY0_DECL(array_split);
DEFINE_FUNCTOR(pythonic::numpy, array_split);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp
index 40377c3ea2f..1d3552a459f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/asarray.hpp
@@ -12,8 +12,7 @@ namespace numpy
template <class E, class dtype>
struct _asarray {
template <class... Types>
- auto operator()(Types &&...args)
- -> decltype(array(std::forward<Types>(args)...));
+ auto operator()(Types &&...args) -> decltype(array(std::forward<Types>(args)...));
};
template <class T, class pS>
@@ -24,15 +23,12 @@ namespace numpy
template <class E>
auto asarray(E &&e, types::none_type d = types::none_type())
- -> decltype(_asarray<typename std::decay<E>::type,
- typename types::dtype_of<
- typename std::decay<E>::type>::type>{}(
+ -> decltype(_asarray<std::decay_t<E>, typename types::dtype_of<std::decay_t<E>>::type>{}(
std::forward<E>(e)));
template <class E, class dtype>
auto asarray(E &&e, dtype d)
- -> decltype(_asarray<typename std::decay<E>::type,
- typename dtype::type>{}(std::forward<E>(e), d));
+ -> decltype(_asarray<std::decay_t<E>, typename dtype::type>{}(std::forward<E>(e), d));
DEFINE_FUNCTOR(pythonic::numpy, asarray);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp
index 114543d279b..eb14f4a1698 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/asfarray.hpp
@@ -9,8 +9,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class dtype = functor::float64>
- auto asfarray(E &&e,
- dtype d = dtype()) -> decltype(asarray(std::forward<E>(e), d));
+ auto asfarray(E &&e, dtype d = dtype()) -> decltype(asarray(std::forward<E>(e), d));
DEFINE_FUNCTOR(pythonic::numpy, asfarray);
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp
index ef2c5f6cba2..8ef3a758362 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/asscalar.hpp
@@ -10,10 +10,9 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- using asscalar_result_type = typename std::conditional<
+ using asscalar_result_type = std::conditional_t<
std::is_integral<T>::value, long,
- typename std::conditional<std::is_floating_point<T>::value, double,
- std::complex<double>>::type>::type;
+ std::conditional_t<std::is_floating_point<T>::value, double, std::complex<double>>>;
template <class E>
asscalar_result_type<typename E::dtype> asscalar(E const &expr);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp
index f6a43e51281..19ccb5643b2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_1d.hpp
@@ -8,15 +8,12 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<
- types::is_dtype<T>::value,
- types::ndarray<T, types::pshape<std::integral_constant<long, 1>>>>::type
+ std::enable_if_t<types::is_dtype<T>::value,
+ types::ndarray<T, types::pshape<std::integral_constant<long, 1>>>>
atleast_1d(T t);
template <class T>
- auto atleast_1d(T const &t) ->
- typename std::enable_if<!(types::is_dtype<T>::value),
- decltype(asarray(t))>::type;
+ auto atleast_1d(T const &t) -> std::enable_if_t<!types::is_dtype<T>::value, decltype(asarray(t))>;
DEFINE_FUNCTOR(pythonic::numpy, atleast_1d);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp
index b882ae747a0..d48675a4729 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_2d.hpp
@@ -8,29 +8,22 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<
- types::is_dtype<T>::value,
- types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
- std::integral_constant<long, 1>>>>::type
+ std::enable_if_t<types::is_dtype<T>::value,
+ types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
+ std::integral_constant<long, 1>>>>
atleast_2d(T t);
template <class T>
- auto atleast_2d(T const &t) ->
- typename std::enable_if < (!types::is_dtype<T>::value) &&
- T::value<2,
- types::ndarray<
- typename T::dtype,
- types::pshape<std::integral_constant<long, 1>,
- typename std::tuple_element<
- 0, typename T::shape_t>::type>>>::type;
+ auto atleast_2d(T const &t) -> std::enable_if_t < (!types::is_dtype<T>::value) &&
+ T::value<2, types::ndarray<typename T::dtype,
+ types::pshape<std::integral_constant<long, 1>,
+ std::tuple_element_t<0, typename T::shape_t>>>>;
template <class T>
- auto atleast_2d(T &&t) ->
- typename std::enable_if<
- (!types::is_dtype<typename std::remove_cv<
- typename std::remove_reference<T>::type>::type>::value) &&
- std::decay<T>::type::value >= 2,
- decltype(std::forward<T>(t))>::type;
+ auto atleast_2d(T &&t)
+ -> std::enable_if_t<(!types::is_dtype<std::remove_cv_t<std::remove_reference_t<T>>>::value) &&
+ std::decay_t<T>::value >= 2,
+ decltype(std::forward<T>(t))>;
DEFINE_FUNCTOR(pythonic::numpy, atleast_2d);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp
index b7720c10228..fae16ec7a80 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/atleast_3d.hpp
@@ -8,37 +8,28 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<
- types::is_dtype<T>::value,
- types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
- std::integral_constant<long, 1>,
- std::integral_constant<long, 1>>>>::type
+ std::enable_if_t<types::is_dtype<T>::value,
+ types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
+ std::integral_constant<long, 1>,
+ std::integral_constant<long, 1>>>>
atleast_3d(T t);
template <class T>
- auto atleast_3d(T const &t) ->
- typename std::enable_if<
- (!types::is_dtype<T>::value) && (T::value == 1),
- types::ndarray<typename T::dtype,
- types::pshape<std::integral_constant<long, 1>,
- typename std::tuple_element<
- 0, typename T::shape_t>::type,
- std::integral_constant<long, 1>>>>::type;
+ auto atleast_3d(T const &t) -> std::enable_if_t<
+ (!types::is_dtype<T>::value) && (T::value == 1),
+ types::ndarray<typename T::dtype, types::pshape<std::integral_constant<long, 1>,
+ std::tuple_element_t<0, typename T::shape_t>,
+ std::integral_constant<long, 1>>>>;
template <class T>
- auto atleast_3d(T const &t) ->
- typename std::enable_if<
- (!types::is_dtype<T>::value) && (T::value == 2),
- types::ndarray<
- typename T::dtype,
- types::pshape<
- typename std::tuple_element<0, typename T::shape_t>::type,
- typename std::tuple_element<1, typename T::shape_t>::type,
- std::integral_constant<long, 1>>>>::type;
+ auto atleast_3d(T const &t) -> std::enable_if_t<
+ (!types::is_dtype<T>::value) && (T::value == 2),
+ types::ndarray<typename T::dtype, types::pshape<std::tuple_element_t<0, typename T::shape_t>,
+ std::tuple_element_t<1, typename T::shape_t>,
+ std::integral_constant<long, 1>>>>;
template <class T>
- auto atleast_3d(T const &t) ->
- typename std::enable_if<(!types::is_dtype<T>::value) && T::value >= 3,
- decltype(asarray(t))>::type;
+ auto atleast_3d(T const &t)
+ -> std::enable_if_t<(!types::is_dtype<T>::value) && T::value >= 3, decltype(asarray(t))>;
DEFINE_FUNCTOR(pythonic::numpy, atleast_3d);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp
index 087b41f5503..774dd8b4c0f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/bincount.hpp
@@ -9,18 +9,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- types::ndarray<long, types::pshape<long>>>::type
- bincount(types::ndarray<T, pS> const &expr,
- types::none_type weights = builtins::None,
+ std::enable_if_t<std::tuple_size<pS>::value == 1, types::ndarray<long, types::pshape<long>>>
+ bincount(types::ndarray<T, pS> const &expr, types::none_type weights = builtins::None,
types::none<long> minlength = builtins::None);
template <class T, class E, class pS>
- typename std::enable_if<
+ std::enable_if_t<
std::tuple_size<pS>::value == 1,
- types::ndarray<decltype(std::declval<long>() *
- std::declval<typename E::dtype>()),
- types::pshape<long>>>::type
+ types::ndarray<decltype(std::declval<long>() * std::declval<typename E::dtype>()),
+ types::pshape<long>>>
bincount(types::ndarray<T, pS> const &expr, E const &weights,
types::none<long> minlength = builtins::None);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp
index cc3f14b825c..623633651c4 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/broadcast_to.hpp
@@ -10,9 +10,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class pS>
- auto broadcast_to(E const &expr, pS shape)
- -> decltype(numpy::functor::empty{}(
- shape, typename types::dtype_t<typename types::dtype_of<E>::type>{}));
+ auto broadcast_to(E const &expr, pS shape) -> decltype(numpy::functor::empty{}(
+ shape, typename types::dtype_t<typename types::dtype_of<E>::type>{}));
DEFINE_FUNCTOR(pythonic::numpy, broadcast_to);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp
index c7478f393f7..c17ad8dd038 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/byte.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::byte> {
+ static PyObject *convert(numpy::functor::byte const &c);
+};
+
+template <>
+struct from_python<numpy::functor::byte> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::byte convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp
index 3d5e11ab6e3..8f4988667e0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/clip.hpp
@@ -30,18 +30,18 @@ namespace numpy
#define NUMPY_NARY_FUNC_NAME clip
#define NUMPY_NARY_FUNC_SYM wrapper::clip
-#define NUMPY_NARY_EXTRA_METHOD \
- template <typename T, class Mi> \
- auto operator()(T &&v, Mi &&a_min, types::none_type) \
- ->decltype((*this)(std::forward<T>(v), std::forward<Mi>(a_min))) \
- { \
- return (*this)(std::forward<T>(v), std::forward<Mi>(a_min)); \
- } \
- template <typename T, class Ma> \
- auto operator()(T &&v, types::none_type, Ma &&a_max) \
- ->decltype(_clip_max{}(std::forward<T>(v), std::forward<Ma>(a_max))) \
- { \
- return _clip_max{}(std::forward<T>(v), std::forward<Ma>(a_max)); \
+#define NUMPY_NARY_EXTRA_METHOD \
+ template <typename T, class Mi> \
+ auto operator()(T &&v, Mi &&a_min, types::none_type) \
+ ->decltype((*this)(std::forward<T>(v), std::forward<Mi>(a_min))) \
+ { \
+ return (*this)(std::forward<T>(v), std::forward<Mi>(a_min)); \
+ } \
+ template <typename T, class Ma> \
+ auto operator()(T &&v, types::none_type, Ma &&a_max) \
+ ->decltype(_clip_max{}(std::forward<T>(v), std::forward<Ma>(a_max))) \
+ { \
+ return _clip_max{}(std::forward<T>(v), std::forward<Ma>(a_max)); \
}
#include "pythonic/include/types/numpy_nary_expr.hpp"
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp
index cc7a4730131..b45cf434824 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/complex128.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::complex128> {
+ static PyObject *convert(numpy::functor::complex128 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::complex128> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::complex128 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp
index caed53d6376..4fc49a5e803 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/complex256.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::complex256> {
+ static PyObject *convert(numpy::functor::complex256 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::complex256> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::complex256 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp
index f09026f40d7..a4f46f2f6da 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/complex64.hpp
@@ -26,5 +26,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::complex64> {
+ static PyObject *convert(numpy::functor::complex64 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::complex64> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::complex64 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp
index a5033900ecf..c4e1d6b9a30 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/concatenate.hpp
@@ -13,11 +13,9 @@ namespace numpy
concatenate(types::array_base<E, M, V> const &args, long axis = 0);
template <class... Types>
- auto concatenate(std::tuple<Types...> const &args, long axis = 0)
- -> types::ndarray<
- typename __combined<typename std::decay<Types>::type::dtype...>::type,
- types::array_tuple<
- long, std::tuple_element<0, std::tuple<Types...>>::type::value>>;
+ auto concatenate(std::tuple<Types...> const &args, long axis = 0) -> types::ndarray<
+ typename __combined<typename std::decay_t<Types>::dtype...>::type,
+ types::array_tuple<long, std::tuple_element_t<0, std::tuple<Types...>>::value>>;
template <class E>
types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp
index 442d2ccb08d..28399d6da8e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/conjugate.hpp
@@ -8,9 +8,8 @@
#include <xsimd/xsimd.hpp>
// Inject some extra symbol in xsimd namespace, until that's fixed upstream
-#if XSIMD_VERSION_MAJOR < 8 || \
- (XSIMD_VERSION_MAJOR == 8 && XSIMD_VERSION_MINOR == 0 && \
- XSIMD_VERSION_PATCH <= 5)
+#if XSIMD_VERSION_MAJOR < 8 || \
+ (XSIMD_VERSION_MAJOR == 8 && XSIMD_VERSION_MINOR == 0 && XSIMD_VERSION_PATCH <= 5)
namespace xsimd
{
using std::conj;
@@ -29,8 +28,7 @@ namespace numpy
return std::conj(v);
}
template <class T, class A>
- xsimd::batch<std::complex<T>, A>
- conjugate(xsimd::batch<std::complex<T>, A> const &v)
+ xsimd::batch<std::complex<T>, A> conjugate(xsimd::batch<std::complex<T>, A> const &v)
{
return xsimd::conj(v);
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp
index dd63f4ec2d9..09859ad40a1 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/convolve.hpp
@@ -9,12 +9,11 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class A, class B, typename U>
- types::ndarray<typename A::dtype, types::pshape<long>>
- convolve(A const &inA, B const &inB, U renorm = types::str("full"));
+ types::ndarray<typename A::dtype, types::pshape<long>> convolve(A const &inA, B const &inB,
+ U renorm = types::str("full"));
template <class A, class B>
- types::ndarray<typename A::dtype, types::pshape<long>> convolve(A const &inA,
- B const &inB);
+ types::ndarray<typename A::dtype, types::pshape<long>> convolve(A const &inA, B const &inB);
NUMPY_EXPR_TO_NDARRAY0_DECL(convolve)
DEFINE_FUNCTOR(pythonic::numpy, convolve)
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp
index 952f0407354..c53a836f63b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/copy.hpp
@@ -11,22 +11,17 @@ namespace numpy
{
// list case
template <class E>
- typename std::enable_if<
- !types::is_array<E>::value && !types::is_dtype<E>::value,
- types::ndarray<typename E::dtype,
- types::array_tuple<long, E::value>>>::type
+ std::enable_if_t<!types::is_array<E>::value && !types::is_dtype<E>::value,
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>>
copy(E const &v);
// scalar / complex case
template <class E>
- auto copy(E const &v) ->
- typename std::enable_if<types::is_dtype<E>::value, E>::type;
+ auto copy(E const &v) -> std::enable_if_t<types::is_dtype<E>::value, E>;
// No copy is required for numpy_expr
template <class E>
- auto copy(E &&v) ->
- typename std::enable_if<types::is_array<E>::value,
- decltype(std::forward<E>(v))>::type;
+ auto copy(E &&v) -> std::enable_if_t<types::is_array<E>::value, decltype(std::forward<E>(v))>;
// ndarray case
template <class T, class pS>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp
index 07854fec2e5..e15d9bbb9b5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/copyto.hpp
@@ -14,12 +14,10 @@ namespace numpy
types::none_type copyto(types::ndarray<T, pS> &&out, E const &expr);
template <class T, class pS, class E>
- types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out,
- E const &expr);
+ types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out, E const &expr);
template <class T, class pS, class E>
- types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out,
- E const &expr);
+ types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out, E const &expr);
// pythran extensions
template <class E, class F>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp
index 6e6216b78a4..69c10b6c789 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/correlate.hpp
@@ -10,8 +10,7 @@ namespace numpy
{
template <class A, class B>
types::ndarray<typename A::dtype, types::pshape<long>>
- correlate(A const &inA, B const &inB,
- types::str const &renorm = types::str("valid"));
+ correlate(A const &inA, B const &inB, types::str const &renorm = types::str("valid"));
NUMPY_EXPR_TO_NDARRAY0_DECL(correlate)
DEFINE_FUNCTOR(pythonic::numpy, correlate)
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp
index 3a140881bf2..5b915814dac 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/count_nonzero.hpp
@@ -10,12 +10,12 @@ namespace numpy
{
template <class dtype, class E>
- auto _count_nonzero(E begin, E end, long &count, utils::int_<1>) ->
- typename std::enable_if<std::is_same<dtype, bool>::value>::type;
+ auto _count_nonzero(E begin, E end, long &count, utils::int_<1>)
+ -> std::enable_if_t<std::is_same<dtype, bool>::value>;
template <class dtype, class E>
- auto _count_nonzero(E begin, E end, long &count, utils::int_<1>) ->
- typename std::enable_if<!std::is_same<dtype, bool>::value>::type;
+ auto _count_nonzero(E begin, E end, long &count, utils::int_<1>)
+ -> std::enable_if_t<!std::is_same<dtype, bool>::value>;
template <class dtype, class E, size_t N>
void _count_nonzero(E begin, E end, long &count, utils::int_<N>);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp
index 139d0874a65..40fb48b7386 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cross.hpp
@@ -9,9 +9,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class F>
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, E::value>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, E::value>>
cross(E const &e, F const &f);
DEFINE_FUNCTOR(pythonic::numpy, cross);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp
index c6184dc998a..737205b1963 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ctypeslib/as_array.hpp
@@ -10,8 +10,7 @@ namespace numpy
namespace ctypeslib
{
template <class T, class pS>
- typename std::enable_if<!std::is_integral<pS>::value,
- types::ndarray<T, pS>>::type
+ std::enable_if_t<!std::is_integral<pS>::value, types::ndarray<T, pS>>
as_array(types::pointer<T>, pS);
template <class T>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp
index b2e3b583547..a963cafb62b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cumprod.hpp
@@ -12,8 +12,8 @@ namespace numpy
template <class E, class... Opts>
auto cumprod(E &&e, Opts &&...opts)
- -> decltype(partial_sum<operator_::functor::imul>(
- std::forward<E>(e), std::forward<Opts>(opts)...));
+ -> decltype(partial_sum<operator_::functor::imul>(std::forward<E>(e),
+ std::forward<Opts>(opts)...));
NUMPY_EXPR_TO_NDARRAY0_DECL(cumprod);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp
index cd37a1e657b..2b38a317c4a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/cumsum.hpp
@@ -12,8 +12,8 @@ namespace numpy
template <class E, class... Opts>
auto cumsum(E &&e, Opts &&...opts)
- -> decltype(partial_sum<operator_::functor::add>(
- std::forward<E>(e), std::forward<Opts>(opts)...));
+ -> decltype(partial_sum<operator_::functor::add>(std::forward<E>(e),
+ std::forward<Opts>(opts)...));
DEFINE_FUNCTOR(pythonic::numpy, cumsum);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp
index d8cc67c48d8..656bb3b5e3f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/delete_.hpp
@@ -9,13 +9,11 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- delete_(types::ndarray<T, pS> const &a, long index,
- types::none_type axis = builtins::None);
+ types::ndarray<T, types::pshape<long>> delete_(types::ndarray<T, pS> const &a, long index,
+ types::none_type axis = builtins::None);
template <class T, class pS, class I>
- typename std::enable_if<!std::is_scalar<I>::value,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<!std::is_scalar<I>::value, types::ndarray<T, types::pshape<long>>>
delete_(types::ndarray<T, pS> const &in, I const &indices,
types::none_type axis = builtins::None);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp
index c0813ccc99c..f4778d00a73 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/diag.hpp
@@ -11,18 +11,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 2,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 2, types::ndarray<T, types::pshape<long>>>
diag(types::ndarray<T, pS> const &a, long k = 0);
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- types::ndarray<T, types::array_tuple<long, 2>>>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 1, types::ndarray<T, types::array_tuple<long, 2>>>
diag(types::ndarray<T, pS> const &a, long k = 0);
template <class T>
- auto diag(types::list<T> const &a,
- long k = 0) -> decltype(diag(asarray(a), k));
+ auto diag(types::list<T> const &a, long k = 0) -> decltype(diag(asarray(a), k));
NUMPY_EXPR_TO_NDARRAY0_DECL(diag);
DEFINE_FUNCTOR(pythonic::numpy, diag);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp
index 41aab6226c4..47f5ffc52aa 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/dot.hpp
@@ -28,17 +28,15 @@ struct is_strided {
template <class E>
struct is_blas_array {
- static constexpr bool value =
- pythonic::types::has_buffer<E>::value &&
- is_blas_type<typename pythonic::types::dtype_of<E>::type>::value &&
- !is_strided<E>::value;
+ static constexpr bool value = pythonic::types::has_buffer<E>::value &&
+ is_blas_type<typename pythonic::types::dtype_of<E>::type>::value &&
+ !is_strided<E>::value;
};
template <class E>
struct is_blas_view {
- static constexpr bool value =
- pythonic::types::has_buffer<E>::value &&
- is_blas_type<typename pythonic::types::dtype_of<E>::type>::value;
+ static constexpr bool value = pythonic::types::has_buffer<E>::value &&
+ is_blas_type<typename pythonic::types::dtype_of<E>::type>::value;
};
PYTHONIC_NS_BEGIN
@@ -46,187 +44,163 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class F>
- typename std::enable_if<types::is_dtype<E>::value &&
- types::is_dtype<F>::value,
- decltype(std::declval<E>() * std::declval<F>())>::type
+ std::enable_if_t<types::is_dtype<E>::value && types::is_dtype<F>::value,
+ decltype(std::declval<E>() * std::declval<F>())>
dot(E const &e, F const &f);
/// Vector / Vector multiplication
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value && types::is_numexpr_arg<F>::value &&
- E::value == 1 && F::value == 1 &&
- (!is_blas_view<E>::value || !is_blas_view<F>::value ||
- !std::is_same<typename E::dtype, typename F::dtype>::value),
- typename __combined<typename E::dtype, typename F::dtype>::type>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value && types::is_numexpr_arg<F>::value &&
+ E::value == 1 && F::value == 1 &&
+ (!is_blas_view<E>::value || !is_blas_view<F>::value ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value),
+ typename __combined<typename E::dtype, typename F::dtype>::type>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, float>::value &&
- std::is_same<typename F::dtype, float>::value &&
- is_blas_array<E>::value &&
- is_blas_array<F>::value,
- float>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, float>::value &&
+ std::is_same<typename F::dtype, float>::value && is_blas_array<E>::value &&
+ is_blas_array<F>::value,
+ float>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, double>::value &&
- std::is_same<typename F::dtype, double>::value &&
- is_blas_array<E>::value &&
- is_blas_array<F>::value,
- double>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, double>::value &&
+ std::is_same<typename F::dtype, double>::value && is_blas_array<E>::value &&
+ is_blas_array<F>::value,
+ double>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<float>>::value &&
- std::is_same<typename F::dtype, std::complex<float>>::value &&
- is_blas_array<E>::value && is_blas_array<F>::value,
- std::complex<float>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<float>>::value &&
+ std::is_same<typename F::dtype, std::complex<float>>::value &&
+ is_blas_array<E>::value && is_blas_array<F>::value,
+ std::complex<float>>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<double>>::value &&
- std::is_same<typename F::dtype, std::complex<double>>::value &&
- is_blas_array<E>::value && is_blas_array<F>::value,
- std::complex<double>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<double>>::value &&
+ std::is_same<typename F::dtype, std::complex<double>>::value &&
+ is_blas_array<E>::value && is_blas_array<F>::value,
+ std::complex<double>>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, float>::value &&
- std::is_same<typename F::dtype, float>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- float>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, float>::value &&
+ std::is_same<typename F::dtype, float>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ float>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, double>::value &&
- std::is_same<typename F::dtype, double>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- double>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, double>::value &&
+ std::is_same<typename F::dtype, double>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ double>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<float>>::value &&
- std::is_same<typename F::dtype, std::complex<float>>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- std::complex<float>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<float>>::value &&
+ std::is_same<typename F::dtype, std::complex<float>>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ std::complex<float>>
dot(E const &e, F const &f);
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<double>>::value &&
- std::is_same<typename F::dtype, std::complex<double>>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- std::complex<double>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<double>>::value &&
+ std::is_same<typename F::dtype, std::complex<double>>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ std::complex<double>>
dot(E const &e, F const &f);
/// Matrix / Vector multiplication
// We transpose the matrix to reflect our C order
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 1,
- types::ndarray<E, types::pshape<long>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 1,
+ types::ndarray<E, types::pshape<long>>>
dot(types::ndarray<E, pS0> const &f, types::ndarray<E, pS1> const &e);
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 1,
- types::ndarray<E, types::pshape<long>>>::type
- dot(types::numpy_texpr<types::ndarray<E, pS0>> const &f,
- types::ndarray<E, pS1> const &e);
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 1,
+ types::ndarray<E, types::pshape<long>>>
+ dot(types::numpy_texpr<types::ndarray<E, pS0>> const &f, types::ndarray<E, pS1> const &e);
// The trick is to not transpose the matrix so that MV become VM
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 1 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::pshape<long>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 1 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::pshape<long>>>
dot(types::ndarray<E, pS0> const &e, types::ndarray<E, pS1> const &f);
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 1 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::pshape<long>>>::type
- dot(types::ndarray<E, pS0> const &e,
- types::numpy_texpr<types::ndarray<E, pS1>> const &f);
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 1 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::pshape<long>>>
+ dot(types::ndarray<E, pS0> const &e, types::numpy_texpr<types::ndarray<E, pS1>> const &f);
// If arguments could be use with blas, we evaluate them as we need pointer
// on array for blas
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value &&
- types::is_numexpr_arg<F>::value // It is an array_like
- && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
- !std::is_same<typename E::dtype, typename F::dtype>::value) &&
- is_blas_type<typename E::dtype>::value &&
- is_blas_type<typename F::dtype>::value // With dtype compatible with
- // blas
- && E::value == 2 && F::value == 1, // And it is matrix / vect
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value &&
+ types::is_numexpr_arg<F>::value // It is an array_like
+ && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value) &&
+ is_blas_type<typename E::dtype>::value &&
+ is_blas_type<typename F::dtype>::value // With dtype compatible with
+ // blas
+ && E::value == 2 && F::value == 1, // And it is matrix / vect
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f);
// If arguments could be use with blas, we evaluate them as we need pointer
// on array for blas
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value &&
- types::is_numexpr_arg<F>::value // It is an array_like
- && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
- !std::is_same<typename E::dtype, typename F::dtype>::value) &&
- is_blas_type<typename E::dtype>::value &&
- is_blas_type<typename F::dtype>::value // With dtype compatible with
- // blas
- && E::value == 1 && F::value == 2, // And it is vect / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value &&
+ types::is_numexpr_arg<F>::value // It is an array_like
+ && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value) &&
+ is_blas_type<typename E::dtype>::value &&
+ is_blas_type<typename F::dtype>::value // With dtype compatible with
+ // blas
+ && E::value == 1 && F::value == 2, // And it is vect / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f);
// If one of the arg doesn't have a "blas compatible type", we use a slow
// matrix vector multiplication.
template <class E, class F>
- typename std::enable_if<
- (!is_blas_type<typename E::dtype>::value ||
- !is_blas_type<typename F::dtype>::value) &&
- E::value == 1 && F::value == 2, // And it is vect / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<(!is_blas_type<typename E::dtype>::value ||
+ !is_blas_type<typename F::dtype>::value) &&
+ E::value == 1 && F::value == 2, // And it is vect / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f);
// If one of the arg doesn't have a "blas compatible type", we use a slow
// matrix vector multiplication.
template <class E, class F>
- typename std::enable_if<
- (!is_blas_type<typename E::dtype>::value ||
- !is_blas_type<typename F::dtype>::value) &&
- E::value == 2 && F::value == 1, // And it is vect / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<(!is_blas_type<typename E::dtype>::value ||
+ !is_blas_type<typename F::dtype>::value) &&
+ E::value == 2 && F::value == 1, // And it is vect / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f);
/// Matrix / Matrix multiplication
@@ -236,88 +210,72 @@ namespace numpy
// So we compute B'A' == (AB)'. As this equality is perform with F order
// We doesn't have to return a texpr because we want a C order matrice!!
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b);
template <class E, class pS0, class pS1, class pS2>
- typename std::enable_if<
- is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2 && std::tuple_size<pS2>::value == 2,
- types::ndarray<E, pS2>>::type &
- dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b,
- types::ndarray<E, pS2> &c);
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2 && std::tuple_size<pS2>::value == 2,
+ types::ndarray<E, pS2>> &
+ dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b, types::ndarray<E, pS2> &c);
// texpr variants: MT, TM, TT
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
- dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a,
- types::ndarray<E, pS1> const &b);
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
+ dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a, types::ndarray<E, pS1> const &b);
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
- dot(types::ndarray<E, pS0> const &a,
- types::numpy_texpr<types::ndarray<E, pS1>> const &b);
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
+ dot(types::ndarray<E, pS0> const &a, types::numpy_texpr<types::ndarray<E, pS1>> const &b);
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a,
types::numpy_texpr<types::ndarray<E, pS1>> const &b);
// If arguments could be use with blas, we evaluate them as we need pointer
// on array for blas
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value &&
- types::is_numexpr_arg<F>::value // It is an array_like
- && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
- !std::is_same<typename E::dtype, typename F::dtype>::value) &&
- is_blas_type<typename E::dtype>::value &&
- is_blas_type<typename F::dtype>::value // With dtype compatible with
- // blas
- && E::value == 2 && F::value == 2, // And both are matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, 2>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value &&
+ types::is_numexpr_arg<F>::value // It is an array_like
+ && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value) &&
+ is_blas_type<typename E::dtype>::value &&
+ is_blas_type<typename F::dtype>::value // With dtype compatible with
+ // blas
+ && E::value == 2 && F::value == 2, // And both are matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, 2>>>
dot(E const &e, F const &f);
// If one of the arg doesn't have a "blas compatible type", we use a slow
// matrix multiplication.
template <class E, class F>
- typename std::enable_if<
- (!is_blas_type<typename E::dtype>::value ||
- !is_blas_type<typename F::dtype>::value) &&
- E::value == 2 && F::value == 2, // And it is matrix / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, 2>>>::type
+ std::enable_if_t<(!is_blas_type<typename E::dtype>::value ||
+ !is_blas_type<typename F::dtype>::value) &&
+ E::value == 2 && F::value == 2, // And it is matrix / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, 2>>>
dot(E const &e, F const &f);
// N x M where N >= 3 and M == 1
template <class E, class F>
- typename std::enable_if<
- (E::value >= 3 && F::value == 1),
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<(E::value >= 3 && F::value == 1),
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, E::value - 1>>>
dot(E const &e, F const &f);
// N x M where N >= 3 and M >= 2
template <class E, class F>
- typename std::enable_if<
- (E::value >= 3 && F::value >= 2),
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<(E::value >= 3 && F::value >= 2),
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, E::value - 1>>>
dot(E const &e, F const &f);
DEFINE_FUNCTOR(pythonic::numpy, dot);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp
index 77047e4c998..568baed4e77 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/empty.hpp
@@ -13,16 +13,14 @@ namespace numpy
typename dtype::type empty(types::pshape<> const &shape, dtype d = dtype());
template <class pS, class dtype = functor::float64>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- empty(pS const &shape, dtype d = dtype());
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> empty(pS const &shape,
+ dtype d = dtype());
template <class dtype = functor::float64>
- types::ndarray<typename dtype::type, types::pshape<long>>
- empty(long size, dtype d = dtype());
+ types::ndarray<typename dtype::type, types::pshape<long>> empty(long size, dtype d = dtype());
template <long N, class dtype = functor::float64>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
empty(std::integral_constant<long, N>, dtype d = dtype());
DEFINE_FUNCTOR(pythonic::numpy, empty);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp
index 28baea1b086..54e11908449 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/empty_like.hpp
@@ -9,13 +9,11 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class dtype>
- auto empty_like(E const &expr, dtype d = dtype())
- -> decltype(empty(sutils::getshape(expr), d));
+ auto empty_like(E const &expr, dtype d = dtype()) -> decltype(empty(sutils::getshape(expr), d));
template <class E>
auto empty_like(E const &expr, types::none_type d = builtins::None)
- -> decltype(empty(sutils::getshape(expr),
- types::dtype_t<typename E::dtype>()));
+ -> decltype(empty(sutils::getshape(expr), types::dtype_t<typename E::dtype>()));
DEFINE_FUNCTOR(pythonic::numpy, empty_like)
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp
index 62033463c1c..806cd65016f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/eye.hpp
@@ -11,13 +11,12 @@ namespace numpy
{
template <class dtype = functor::float64>
- types::ndarray<typename dtype::type, types::array_tuple<long, 2>>
- eye(long N, long M, long k = 0, dtype d = dtype());
+ types::ndarray<typename dtype::type, types::array_tuple<long, 2>> eye(long N, long M, long k = 0,
+ dtype d = dtype());
template <class dtype = functor::float64>
types::ndarray<typename dtype::type, types::array_tuple<long, 2>>
- eye(long N, types::none_type M = builtins::None, long k = 0,
- dtype d = dtype());
+ eye(long N, types::none_type M = builtins::None, long k = 0, dtype d = dtype());
DEFINE_FUNCTOR(pythonic::numpy, eye);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp
index 9ea27559aee..a7b63bbf1cf 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/c2c.hpp
@@ -12,10 +12,9 @@ namespace numpy
{
template <class T, class pS>
- types::ndarray<std::complex<T>,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- c2c(types::ndarray<std::complex<T>, pS> const &a, long n = -1,
- long axis = -1, types::str const &norm = {}, bool const forward = true);
+ types::ndarray<std::complex<T>, types::array_tuple<long, std::tuple_size<pS>::value>>
+ c2c(types::ndarray<std::complex<T>, pS> const &a, long n = -1, long axis = -1,
+ types::str const &norm = {}, bool const forward = true);
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp
index 512ac55d8e7..3d470d46f8a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fft.hpp
@@ -25,29 +25,20 @@ namespace numpy
namespace fft
{
- template <class T, class pS, class N = types::none_type,
- class Norm = types::none_type>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1,
- Norm const &norm = {});
+ template <class T, class pS, class N = types::none_type, class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1, Norm const &norm = {});
- template <class T, class pS, class N = types::none_type,
- class Norm = types::none_type>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ template <class T, class pS, class N = types::none_type, class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1,
- Norm const &norm = {});
+ fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1, Norm const &norm = {});
- template <class T, class pS, class N = types::none_type,
- class Norm = types::none_type>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ template <class T, class pS, class N = types::none_type, class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1,
- Norm const &norm = {});
+ fft(types::ndarray<T, pS> const &a, N const &n = {}, long axis = -1, Norm const &norm = {});
NUMPY_EXPR_TO_NDARRAY0_DECL(fft);
DEFINE_FUNCTOR(pythonic::numpy::fft, fft);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp
index 8f7d78b17bc..91eb793b4ac 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/fftn.hpp
@@ -11,54 +11,45 @@ namespace numpy
namespace fft
{
// without shape
- template <class T, class pS, class Axes = types::none_type,
- class Norm = types::none_type>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ template <class T, class pS, class Axes = types::none_type, class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::none_type s = {},
- Axes const &axes = {}, Norm const &norm = {});
+ fftn(types::ndarray<T, pS> const &a, types::none_type s = {}, Axes const &axes = {},
+ Norm const &norm = {});
- template <class T, class pS, class Axes = types::none_type,
- class Norm = types::none_type>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ template <class T, class pS, class Axes = types::none_type, class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::none_type s = {},
- Axes const &axes = {}, Norm const &norm = {});
+ fftn(types::ndarray<T, pS> const &a, types::none_type s = {}, Axes const &axes = {},
+ Norm const &norm = {});
- template <class T, class pS, class Axes = types::none_type,
- class Norm = types::none_type>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::none_type s = {},
- Axes const &axes = {}, Norm const &norm = {});
+ template <class T, class pS, class Axes = types::none_type, class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ fftn(types::ndarray<T, pS> const &a, types::none_type s = {}, Axes const &axes = {},
+ Norm const &norm = {});
// with shape
- template <class T, class pS, class I, size_t N, class V,
- class Axes = types::none_type, class Norm = types::none_type>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ template <class T, class pS, class I, size_t N, class V, class Axes = types::none_type,
+ class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s,
- Axes const &axes = {}, Norm const &norm = {});
+ fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes = {},
+ Norm const &norm = {});
- template <class T, class pS, class I, size_t N, class V,
- class Axes = types::none_type, class Norm = types::none_type>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ template <class T, class pS, class I, size_t N, class V, class Axes = types::none_type,
+ class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s,
- Axes const &axes = {}, Norm const &norm = {});
+ fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes = {},
+ Norm const &norm = {});
- template <class T, class pS, class I, size_t N, class V,
- class Axes = types::none_type, class Norm = types::none_type>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s,
- Axes const &axes = {}, Norm const &norm = {});
+ template <class T, class pS, class I, size_t N, class V, class Axes = types::none_type,
+ class Norm = types::none_type>
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes = {},
+ Norm const &norm = {});
NUMPY_EXPR_TO_NDARRAY0_DECL(fftn);
DEFINE_FUNCTOR(pythonic::numpy::fft, fftn);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp
index 6337bd991f5..1177f0549db 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/hfft.hpp
@@ -27,56 +27,44 @@ namespace numpy
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<std::complex<T>, pS> const &a, long n = -1,
- long axis = -1, types::str const &norm = {});
+ hfft(types::ndarray<std::complex<T>, pS> const &a, long n = -1, long axis = -1,
+ types::str const &norm = {});
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n,
- long axis, types::str const &norm);
+ hfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis,
+ types::str const &norm);
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<std::complex<T>, pS> const &a, long n, long axis,
- types::none_type norm);
+ hfft(types::ndarray<std::complex<T>, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n,
- long axis = -1, types::none_type norm = types::none_type{});
+ hfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis = -1,
+ types::none_type norm = types::none_type{});
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ hfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ hfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ hfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
hfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp
index cb15442fd77..384dcbef765 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ifft.hpp
@@ -26,85 +26,64 @@ namespace numpy
{
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ ifft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ ifft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ ifft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ ifft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp
index e1e2af123da..803c8ca89c4 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/ihfft.hpp
@@ -26,57 +26,43 @@ namespace numpy
{
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ ihfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ ihfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ ihfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ ihfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ihfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp
index b10c977bdee..5e3f83d5ac0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/irfft.hpp
@@ -27,56 +27,44 @@ namespace numpy
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &a, long n = -1,
- long axis = -1, types::str const &norm = {});
+ irfft(types::ndarray<std::complex<T>, pS> const &a, long n = -1, long axis = -1,
+ types::str const &norm = {});
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n,
- long axis, types::str const &norm);
+ irfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis,
+ types::str const &norm);
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &a, long n, long axis,
- types::none_type norm);
+ irfft(types::ndarray<std::complex<T>, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n,
- long axis = -1, types::none_type norm = types::none_type{});
+ irfft(types::ndarray<std::complex<T>, pS> const &a, types::none_type n, long axis = -1,
+ types::none_type norm = types::none_type{});
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ irfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ irfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ irfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
irfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp
index e8b410ff425..680ad84cc7f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fft/rfft.hpp
@@ -26,57 +26,43 @@ namespace numpy
{
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ rfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ rfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1,
- types::str const &norm = {});
+ rfft(types::ndarray<T, pS> const &a, long n = -1, long axis = -1, types::str const &norm = {});
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis,
- types::str const &norm);
+ rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis, types::str const &norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &a, long n, long axis,
- types::none_type norm);
+ rfft(types::ndarray<T, pS> const &a, long n, long axis, types::none_type norm);
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
rfft(types::ndarray<T, pS> const &a, types::none_type n, long axis = -1,
types::none_type norm = types::none_type{});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp
index ef8a05cf98b..3bc658a4f91 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fill_diagonal.hpp
@@ -9,7 +9,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::none_type fill_diagonal(E &&, typename std::decay<E>::type::dtype);
+ types::none_type fill_diagonal(E &&, typename std::decay_t<E>::dtype);
DEFINE_FUNCTOR(pythonic::numpy, fill_diagonal)
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp
index ab2705cf0d6..94764eb1587 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/flip.hpp
@@ -12,14 +12,14 @@ namespace numpy
namespace details
{
template <class E, class S, size_t... I>
- auto flip(E const &expr, S const &slices,
- utils::index_sequence<I...>) -> decltype(expr(slices[I]...));
+ auto flip(E const &expr, S const &slices, std::index_sequence<I...>)
+ -> decltype(expr(slices[I]...));
}
template <class E>
auto flip(E const &expr, long axis)
-> decltype(details::flip(expr, std::array<types::slice, E::value>{},
- utils::make_index_sequence<E::value>{}));
+ std::make_index_sequence<E::value>{}));
DEFINE_FUNCTOR(pythonic::numpy, flip);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp
index 605d2677ac0..a9e365e478d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fliplr.hpp
@@ -9,10 +9,9 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto
- fliplr(E &&expr) -> decltype(std::forward<E>(expr)(
- types::cstride_slice<1>{builtins::None, builtins::None},
- types::slice{builtins::None, builtins::None, -1}));
+ auto fliplr(E &&expr)
+ -> decltype(std::forward<E>(expr)(types::cstride_slice<1>{builtins::None, builtins::None},
+ types::slice{builtins::None, builtins::None, -1}));
DEFINE_FUNCTOR(pythonic::numpy, fliplr);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp
index a4b5f241a6a..2a8daf252ff 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/flipud.hpp
@@ -9,9 +9,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto
- flipud(E &&expr) -> decltype(std::forward<E>(
- expr)[types::slice{builtins::None, builtins::None, -1}]);
+ auto flipud(E &&expr)
+ -> decltype(std::forward<E>(expr)[types::slice{builtins::None, builtins::None, -1}]);
DEFINE_FUNCTOR(pythonic::numpy, flipud);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp
index 8f4819e2b10..f8155857272 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float128.hpp
@@ -28,4 +28,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::float128> {
+ static PyObject *convert(numpy::functor::float128 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::float128> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::float128 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp
index a88b5b3d883..32981a18395 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float32.hpp
@@ -26,4 +26,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::float32> {
+ static PyObject *convert(numpy::functor::float32 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::float32> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::float32 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp
index 0494e3303e3..dae2a3505cc 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float64.hpp
@@ -24,4 +24,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::float64> {
+ static PyObject *convert(numpy::functor::float64 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::float64> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::float64 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp
index b4e25d97ad5..5c3491eb17d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/float_.hpp
@@ -14,4 +14,22 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::float_> {
+ static PyObject *convert(numpy::functor::float_ const &c);
+};
+
+template <>
+struct from_python<numpy::functor::float_> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::float_ convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp
index 85de7c53122..2228b24cca6 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/floor_divide.hpp
@@ -14,27 +14,25 @@ namespace numpy
namespace wrapper
{
template <class Arg0, class Arg1>
- std::complex<typename std::common_type<Arg0, Arg1>::type>
- divfloor(std::complex<Arg0> const &arg0, std::complex<Arg1> const &arg1)
+ std::complex<std::common_type_t<Arg0, Arg1>> divfloor(std::complex<Arg0> const &arg0,
+ std::complex<Arg1> const &arg1)
{
return {functor::floor{}(std::real(arg0 / arg1)), 0};
}
template <class Arg0, class Arg1>
- auto divfloor(Arg0 const &arg0, Arg1 const &arg1) ->
- typename std::enable_if<(std::is_integral<Arg0>::value &&
- std::is_integral<Arg1>::value),
- decltype(arg0 / arg1)>::type
+ auto divfloor(Arg0 const &arg0, Arg1 const &arg1)
+ -> std::enable_if_t<(std::is_integral<Arg0>::value && std::is_integral<Arg1>::value),
+ decltype(arg0 / arg1)>
{
bool opposite_sign = (arg0 >= 0 && arg1 < 0) || (arg0 < 0 && arg1 >= 0);
return (arg0 + opposite_sign * (-arg1 + 1)) / arg1;
}
template <class Arg0, class Arg1>
- auto divfloor(Arg0 const &arg0, Arg1 const &arg1) ->
- typename std::enable_if<!std::is_integral<Arg0>::value ||
- !std::is_integral<Arg1>::value,
- decltype(functor::floor{}(arg0 / arg1))>::type
+ auto divfloor(Arg0 const &arg0, Arg1 const &arg1)
+ -> std::enable_if_t<!std::is_integral<Arg0>::value || !std::is_integral<Arg1>::value,
+ decltype(functor::floor{}(arg0 / arg1))>
{
return functor::floor{}(arg0 / arg1);
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp
index e9a2b202afc..fb80f1ae119 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/frexp.hpp
@@ -11,14 +11,12 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<std::is_scalar<T>::value, std::tuple<T, int>>::type
- frexp(T val);
+ std::enable_if_t<std::is_scalar<T>::value, std::tuple<T, int>> frexp(T val);
template <class E>
- typename std::enable_if<
- !types::is_dtype<E>::value,
- std::tuple<types::ndarray<typename E::dtype, typename E::shape_t>,
- types::ndarray<int, typename E::shape_t>>>::type
+ std::enable_if_t<!types::is_dtype<E>::value,
+ std::tuple<types::ndarray<typename E::dtype, typename E::shape_t>,
+ types::ndarray<int, typename E::shape_t>>>
frexp(E const &arr);
DEFINE_FUNCTOR(pythonic::numpy, frexp);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/frombuffer.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/frombuffer.hpp
new file mode 100644
index 00000000000..5868e9a73d7
--- /dev/null
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/frombuffer.hpp
@@ -0,0 +1,25 @@
+#ifndef PYTHONIC_INCLUDE_NUMPY_FROMBUFFER_HPP
+#define PYTHONIC_INCLUDE_NUMPY_FROMBUFFER_HPP
+
+#include "pythonic/include/numpy/float64.hpp"
+#include "pythonic/include/types/list.hpp"
+#include "pythonic/include/types/ndarray.hpp"
+#include "pythonic/include/types/str.hpp"
+#include "pythonic/include/utils/functor.hpp"
+
+#include <limits>
+#include <sstream>
+
+PYTHONIC_NS_BEGIN
+
+namespace numpy
+{
+ template <class dtype = functor::float64>
+ types::ndarray<typename dtype::type, types::pshape<long>>
+ frombuffer(types::str const &string, dtype d = dtype(), long count = -1, long offset = 0);
+
+ DEFINE_FUNCTOR(pythonic::numpy, frombuffer);
+} // namespace numpy
+PYTHONIC_NS_END
+
+#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp
index ade065d1469..a17be5a8c06 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fromfunction.hpp
@@ -17,27 +17,22 @@ namespace numpy
template <class F, class dtype, class purity_tag>
struct fromfunction_helper<F, 1, dtype, purity_tag> {
template <class pS>
- types::ndarray<typename std::remove_cv<typename std::remove_reference<
- typename std::result_of<F(dtype)>::type>::type>::type,
- pS>
+ types::ndarray<std::remove_cv_t<std::remove_reference_t<std::result_of_t<F(dtype)>>>, pS>
operator()(F &&f, pS const &shape, dtype d = dtype());
};
template <class F, class dtype, class purity_tag>
struct fromfunction_helper<F, 2, dtype, purity_tag> {
template <class pS>
- types::ndarray<
- typename std::remove_cv<typename std::remove_reference<
- typename std::result_of<F(dtype, dtype)>::type>::type>::type,
- pS>
+ types::ndarray<std::remove_cv_t<std::remove_reference_t<std::result_of_t<F(dtype, dtype)>>>, pS>
operator()(F &&f, pS const &shape, dtype d = dtype());
};
template <class F, class pS, class dtype = double>
auto fromfunction(F &&f, pS const &shape, dtype d = dtype())
-> decltype(fromfunction_helper<F, std::tuple_size<pS>::value, dtype,
- typename pythonic::purity_of<F>::type>()(
- std::forward<F>(f), shape));
+ typename pythonic::purity_of<F>::type>()(std::forward<F>(f),
+ shape));
/* TODO: must specialize for higher order */
DEFINE_FUNCTOR(pythonic::numpy, fromfunction);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp
index 077c4de534c..efc8e293e8f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fromiter.hpp
@@ -10,8 +10,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class Iterable, class dtype = functor::float64>
- types::ndarray<typename std::remove_cv<typename std::remove_reference<
- Iterable>::type>::type::value_type,
+ types::ndarray<typename std::remove_cv_t<std::remove_reference_t<Iterable>>::value_type,
types::pshape<long>>
fromiter(Iterable &&iterable, dtype d = dtype(), long count = -1);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp
index 545a053b170..8c68dc13b3f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/fromstring.hpp
@@ -1,6 +1,7 @@
#ifndef PYTHONIC_INCLUDE_NUMPY_FROMSTRING_HPP
#define PYTHONIC_INCLUDE_NUMPY_FROMSTRING_HPP
+#include "pythonic/include/builtins/pythran/kwonly.hpp"
#include "pythonic/include/numpy/float64.hpp"
#include "pythonic/include/types/list.hpp"
#include "pythonic/include/types/ndarray.hpp"
@@ -16,9 +17,30 @@ namespace numpy
{
template <class dtype = functor::float64>
types::ndarray<typename dtype::type, types::pshape<long>>
- fromstring(types::str const &string, dtype d = dtype(), long count = -1,
+ fromstring(types::str const &string, dtype d = dtype(), long count = -1, types::kwonly = {},
types::str const &sep = {});
+ template <class dtype = functor::float64>
+ types::ndarray<typename dtype::type, types::pshape<long>>
+ fromstring(types::str const &string, dtype d = dtype(), long count = -1,
+ types::str const &sep = {})
+ {
+ return fromstring(string, d, count, types::kwonly{}, sep);
+ }
+
+ types::ndarray<typename functor::float64::type, types::pshape<long>> inline fromstring(
+ types::str const &string, types::kwonly, types::str const &sep = {})
+ {
+ return fromstring(string, functor::float64{}, -1, types::kwonly{}, sep);
+ }
+
+ template <class dtype>
+ types::ndarray<typename dtype::type, types::pshape<long>>
+ fromstring(types::str const &string, dtype d, types::kwonly, types::str const &sep)
+ {
+ return fromstring(string, d, -1, types::kwonly{}, sep);
+ }
+
DEFINE_FUNCTOR(pythonic::numpy, fromstring);
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp
index 4c945f6dfb0..663a6199d07 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/full.hpp
@@ -11,16 +11,14 @@ namespace numpy
{
template <class pS, class F, class dtype>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- full(pS const &shape, F fill_value, dtype d);
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> full(pS const &shape, F fill_value,
+ dtype d);
template <class F, class dtype>
- types::ndarray<typename dtype::type, types::pshape<long>>
- full(long size, F fill_value, dtype d);
+ types::ndarray<typename dtype::type, types::pshape<long>> full(long size, F fill_value, dtype d);
template <long N, class F, class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
full(std::integral_constant<long, N>, F fill_value, dtype d);
template <class pS, class F>
@@ -28,8 +26,7 @@ namespace numpy
types::none_type _ = {});
template <class F>
- types::ndarray<F, types::pshape<long>> full(long size, F fill_value,
- types::none_type _ = {});
+ types::ndarray<F, types::pshape<long>> full(long size, F fill_value, types::none_type _ = {});
template <long N, class F>
types::ndarray<F, types::pshape<std::integral_constant<long, N>>>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp
index 61cac42cf13..68f43d0d85d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/full_like.hpp
@@ -14,10 +14,8 @@ namespace numpy
-> decltype(full(sutils::getshape(expr), fill_value, d));
template <class E, class F>
- auto full_like(E const &expr, F fill_value,
- types::none_type d = builtins::None)
- -> decltype(full(sutils::getshape(expr), fill_value,
- types::dtype_t<typename E::dtype>()));
+ auto full_like(E const &expr, F fill_value, types::none_type d = builtins::None)
+ -> decltype(full(sutils::getshape(expr), fill_value, types::dtype_t<typename E::dtype>()));
DEFINE_FUNCTOR(pythonic::numpy, full_like)
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp
index 13caae7529b..9a1559ce315 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/hstack.hpp
@@ -9,8 +9,7 @@ namespace numpy
{
template <class ArraySequence>
- auto hstack(ArraySequence &&seq)
- -> decltype(concatenate(std::forward<ArraySequence>(seq), 1));
+ auto hstack(ArraySequence &&seq) -> decltype(concatenate(std::forward<ArraySequence>(seq), 1));
DEFINE_FUNCTOR(pythonic::numpy, hstack);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp
index 086b3b6f802..20ae73cbbc8 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/imag.hpp
@@ -11,12 +11,10 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto imag(E &&expr) -> decltype(builtins::getattr(types::attr::IMAG{},
- std::forward<E>(expr)));
+ auto imag(E &&expr) -> decltype(builtins::getattr(types::attr::IMAG{}, std::forward<E>(expr)));
template <class T>
- auto imag(types::list<T> const &expr)
- -> decltype(imag(numpy::functor::asarray{}(expr)));
+ auto imag(types::list<T> const &expr) -> decltype(imag(numpy::functor::asarray{}(expr)));
DEFINE_FUNCTOR(pythonic::numpy, imag);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp
index 544d96760ee..5ec3699355b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/indices.hpp
@@ -10,10 +10,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class pS, class dtype = functor::int64>
- types::ndarray<
- typename dtype::type,
- sutils::push_front_t<
- pS, std::integral_constant<long, std::tuple_size<pS>::value>>>
+ types::ndarray<typename dtype::type,
+ sutils::push_front_t<pS, std::integral_constant<long, std::tuple_size<pS>::value>>>
indices(pS const &shape, dtype d = dtype());
DEFINE_FUNCTOR(pythonic::numpy, indices);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp
index 5b8b94363fa..d91d57c4fab 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/insert.hpp
@@ -14,30 +14,26 @@ namespace numpy
{
template <class T, class pS, class I, class F>
- typename std::enable_if<types::is_iterable<I>::value &&
- types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<types::is_iterable<I>::value && types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
insert(types::ndarray<T, pS> in, I const &indices, F const &data,
types::none_type axis = builtins::None);
template <class T, class pS, class I, class F>
- typename std::enable_if<types::is_iterable<I>::value &&
- !types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<types::is_iterable<I>::value && !types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
insert(types::ndarray<T, pS> in, I const &indices, F const &data,
types::none_type axis = builtins::None);
template <class T, class pS, class I, class F>
- typename std::enable_if<!types::is_iterable<I>::value &&
- types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<!types::is_iterable<I>::value && types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
insert(types::ndarray<T, pS> in, I const &indices, F const &data,
types::none_type axis = builtins::None);
template <class T, class pS, class I, class F>
- typename std::enable_if<!types::is_iterable<I>::value &&
- !types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<!types::is_iterable<I>::value && !types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
insert(types::ndarray<T, pS> in, I const &indices, F const &data,
types::none_type axis = builtins::None);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp
index fa3e9f34bb0..ecbc2113d60 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int16.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::int16> {
+ static PyObject *convert(numpy::functor::int16 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::int16> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::int16 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp
index 5bc35e04d6d..24bf809a9df 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int32.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::int32> {
+ static PyObject *convert(numpy::functor::int32 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::int32> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::int32 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp
index 5e0bca6ed55..97615e34a01 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int64.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::int64> {
+ static PyObject *convert(numpy::functor::int64 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::int64> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::int64 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp
index 9021c0972ad..083704595b8 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int8.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::int8> {
+ static PyObject *convert(numpy::functor::int8 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::int8> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::int8 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp
index efc448dc794..fb5edc97623 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/int_.hpp
@@ -25,4 +25,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::int_> {
+ static PyObject *convert(numpy::functor::int_ const &c);
+};
+
+template <>
+struct from_python<numpy::functor::int_> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::int_ convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp
index a340dee7e69..5f753150c68 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/intc.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::intc> {
+ static PyObject *convert(numpy::functor::intc const &c);
+};
+
+template <>
+struct from_python<numpy::functor::intc> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::intc convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/interp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/interp.hpp
index 320bff15c2c..f87ed543f58 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/interp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/interp.hpp
@@ -11,86 +11,67 @@ namespace numpy
{
template <class T>
using interp_out_type =
- typename std::conditional<types::is_complex<typename T::dtype>::value,
- std::complex<double>, double>::type;
+ std::conditional_t<types::is_complex<typename T::dtype>::value, std::complex<double>, double>;
// None,None,None
template <class T1, class T2, class T3>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
interp(T1 x, T2 xp, T3 fp, types::none_type left = types::none_type{},
- types::none_type right = types::none_type{},
- types::none_type period = types::none_type{});
+ types::none_type right = types::none_type{}, types::none_type period = types::none_type{});
// left None None
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
- interp(T1 x, T2 xp, T3 fp, t1 left,
- types::none_type right = types::none_type{},
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
+ interp(T1 x, T2 xp, T3 fp, t1 left, types::none_type right = types::none_type{},
types::none_type period = types::none_type{});
// None right None
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
interp(T1 x, T2 xp, T3 fp, types::none_type left, t1 right,
types::none_type period = types::none_type{});
// None None period
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right,
- t1 period);
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right, t1 period);
// left right None
template <class T1, class T2, class T3, typename t1, typename t2>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
- interp(T1 x, T2 xp, T3 fp, t1 left, t2 right,
- types::none_type period = types::none_type{});
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
+ interp(T1 x, T2 xp, T3 fp, t1 left, t2 right, types::none_type period = types::none_type{});
////////////////////////// NUMERIC TYPES for x.
template <class T1, class T2, class T3>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
interp(T1 x, T2 xp, T3 fp, types::none_type left = types::none_type{},
- types::none_type right = types::none_type{},
- types::none_type period = types::none_type{});
+ types::none_type right = types::none_type{}, types::none_type period = types::none_type{});
// left None None
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
- interp(T1 x, T2 xp, T3 fp, t1 left,
- types::none_type right = types::none_type{},
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
+ interp(T1 x, T2 xp, T3 fp, t1 left, types::none_type right = types::none_type{},
types::none_type period = types::none_type{});
// None right None
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
interp(T1 x, T2 xp, T3 fp, types::none_type left, t1 right,
types::none_type period = types::none_type{});
// None None period
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right,
- t1 period);
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right, t1 period);
// left right None
template <class T1, class T2, class T3, typename t1, typename t2>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
- interp(T1 x, T2 xp, T3 fp, t1 left, t2 right,
- types::none_type period = types::none_type{});
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
+ interp(T1 x, T2 xp, T3 fp, t1 left, t2 right, types::none_type period = types::none_type{});
NUMPY_EXPR_TO_NDARRAY0_DECL(interp);
DEFINE_FUNCTOR(pythonic::numpy, interp);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp
index e07cb2c91bd..e899a3cea8c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/intersect1d.hpp
@@ -13,9 +13,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class F>
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>
intersect1d(E const &e, F const &f);
DEFINE_FUNCTOR(pythonic::numpy, intersect1d);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp
index 922f1c64591..680c23a0fd2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isclose.hpp
@@ -14,8 +14,8 @@ namespace numpy
namespace wrapper
{
template <class T0, class T1>
- bool isclose(T0 const &u, T1 const &v, double rtol = 1e-5,
- double atol = 1e-8, bool equal_nan = false);
+ bool isclose(T0 const &u, T1 const &v, double rtol = 1e-5, double atol = 1e-8,
+ bool equal_nan = false);
}
#define NUMPY_NARY_FUNC_NAME isclose
#define NUMPY_NARY_FUNC_SYM wrapper::isclose
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp
index c64d8170dc9..9fbb15c2578 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/iscomplex.hpp
@@ -14,12 +14,10 @@ namespace numpy
namespace wrapper
{
template <class I>
- typename std::enable_if<types::is_complex<I>::value, bool>::type
- iscomplex(I const &a);
+ std::enable_if_t<types::is_complex<I>::value, bool> iscomplex(I const &a);
template <class I>
- constexpr typename std::enable_if<!types::is_complex<I>::value, bool>::type
- iscomplex(I const &a);
+ constexpr std::enable_if_t<!types::is_complex<I>::value, bool> iscomplex(I const &a);
} // namespace wrapper
#define NUMPY_NARY_FUNC_NAME iscomplex
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp
index d471777df7d..98fe289aebe 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isnan.hpp
@@ -14,15 +14,11 @@ namespace numpy
template <class T>
bool isnan(std::complex<T> const &v);
template <class T>
- auto isnan(T const &v) ->
- typename std::enable_if<
- std::is_floating_point<typename std::decay<T>::type>::value,
- bool>::type;
+ auto isnan(T const &v)
+ -> std::enable_if_t<std::is_floating_point<std::decay_t<T>>::value, bool>;
template <class T>
- auto isnan(T const &v) ->
- typename std::enable_if<
- !std::is_floating_point<typename std::decay<T>::type>::value,
- bool>::type;
+ auto isnan(T const &v)
+ -> std::enable_if_t<!std::is_floating_point<std::decay_t<T>>::value, bool>;
} // namespace wrapper
#define NUMPY_NARY_FUNC_NAME isnan
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp
index a43a129b4c2..eb6bc23a650 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/isreal.hpp
@@ -14,12 +14,10 @@ namespace numpy
namespace wrapper
{
template <class I>
- typename std::enable_if<types::is_complex<I>::value, bool>::type
- isreal(I const &a);
+ std::enable_if_t<types::is_complex<I>::value, bool> isreal(I const &a);
template <class I>
- typename std::enable_if<!types::is_complex<I>::value, bool>::type
- isreal(I const &a);
+ std::enable_if_t<!types::is_complex<I>::value, bool> isreal(I const &a);
} // namespace wrapper
#define NUMPY_NARY_FUNC_NAME isreal
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp
index e38e2647534..e8e4d6e23b2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/issctype.hpp
@@ -12,16 +12,12 @@ namespace types
namespace numpy
{
template <class E>
- constexpr auto issctype(E const &expr) ->
- typename std::enable_if<!types::is_dtype<E>::value &&
- !std::is_same<E, types::str>::value,
- bool>::type;
+ constexpr auto issctype(E const &expr)
+ -> std::enable_if_t<!types::is_dtype<E>::value && !std::is_same<E, types::str>::value, bool>;
template <class E>
- constexpr auto issctype(E const &expr) ->
- typename std::enable_if<types::is_dtype<E>::value ||
- std::is_same<E, types::str>::value,
- bool>::type;
+ constexpr auto issctype(E const &expr)
+ -> std::enable_if_t<types::is_dtype<E>::value || std::is_same<E, types::str>::value, bool>;
DEFINE_FUNCTOR(pythonic::numpy, issctype);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp
index adb1af5d9c7..c5bb0fe3914 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/matrix_power.hpp
@@ -9,8 +9,7 @@ namespace numpy
namespace linalg
{
template <class E>
- auto matrix_power(E const &expr,
- long n) -> decltype(numpy::functor::array{}(expr));
+ auto matrix_power(E const &expr, long n) -> decltype(numpy::functor::array{}(expr));
DEFINE_FUNCTOR(pythonic::numpy::linalg, matrix_power);
} // namespace linalg
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp
index 42ab8dcaa01..8023c603c7f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/linalg/norm.hpp
@@ -12,25 +12,20 @@ namespace numpy
namespace linalg
{
template <class Array>
- auto norm(Array &&array, types::none_type ord = {},
- types::none_type axis = {})
- -> decltype(pythonic::numpy::functor::sqrt{}(
- pythonic::numpy::functor::sum{}(
- pythonic::builtins::pythran::functor::abssqr{}(
- std::forward<Array>(array)))));
+ auto norm(Array &&array, types::none_type ord = {}, types::none_type axis = {})
+ -> decltype(pythonic::numpy::functor::sqrt{}(pythonic::numpy::functor::sum{}(
+ pythonic::builtins::pythran::functor::abssqr{}(std::forward<Array>(array)))));
template <class Array>
- using norm_dtype_t = typename std::conditional<
- std::is_floating_point<
- typename std::decay<Array>::type::dtype()>::value,
- typename std::decay<Array>::type::dtype(), double>::type;
+ using norm_dtype_t =
+ std::conditional_t<std::is_floating_point<typename std::decay_t<Array>::dtype()>::value,
+ typename std::decay_t<Array>::dtype(), double>;
template <class Array>
- using norm_t = typename std::conditional<
- std::decay<Array>::type::value == 1, norm_dtype_t<Array>,
+ using norm_t = std::conditional_t<
+ std::decay_t<Array>::value == 1, norm_dtype_t<Array>,
types::ndarray<norm_dtype_t<Array>,
- types::array_tuple<long, std::decay<Array>::type::value -
- 1>>>::type;
+ types::array_tuple<long, std::decay_t<Array>::value - 1>>>;
template <class Array>
norm_t<Array> norm(Array &&array, double ord, types::none_type axis = {});
@@ -42,12 +37,10 @@ namespace numpy
norm_t<Array> norm(Array &&array, double ord, long axis);
template <class Array>
- norm_t<Array> norm(Array &&array, double ord,
- types::array_tuple<long, 1> axis);
+ norm_t<Array> norm(Array &&array, double ord, types::array_tuple<long, 1> axis);
template <class Array>
- norm_t<Array> norm(Array &&array, double ord,
- types::array_tuple<long, 2> axis);
+ norm_t<Array> norm(Array &&array, double ord, types::array_tuple<long, 2> axis);
DEFINE_FUNCTOR(pythonic::numpy::linalg, norm);
} // namespace linalg
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp
index 71d009c457d..dc0d6b31361 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/linspace.hpp
@@ -10,8 +10,8 @@ namespace numpy
template <class dtype = types::dtype_t<double>>
types::ndarray<typename dtype::type, types::pshape<long>>
- linspace(double start, double stop, long num = 50, bool endpoint = true,
- bool retstep = false, dtype d = dtype());
+ linspace(double start, double stop, long num = 50, bool endpoint = true, bool retstep = false,
+ dtype d = dtype());
DEFINE_FUNCTOR(pythonic::numpy, linspace);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp
index 9fafebe1c72..a6e1bc8e36c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logaddexp2.hpp
@@ -17,8 +17,7 @@ namespace numpy
{
template <class T0, class T1>
auto logaddexp2(T0 const &t0, T1 const &t1)
- -> decltype(functor::log2{}(functor::power{}(T0(2), t0) +
- functor::power{}(T1(2), t1)));
+ -> decltype(functor::log2{}(functor::power{}(T0(2), t0) + functor::power{}(T1(2), t1)));
}
#define NUMPY_NARY_FUNC_NAME logaddexp2
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp
index 1075eaef8b4..ccee551d095 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logical_xor.hpp
@@ -13,8 +13,7 @@ namespace numpy
namespace wrapper
{
template <class T0, class T1>
- auto logical_xor(T0 const &t0,
- T1 const &t1) -> decltype((t0 && !t1) || (t1 && !t0));
+ auto logical_xor(T0 const &t0, T1 const &t1) -> decltype((t0 && !t1) || (t1 && !t0));
template <class T0, class T1>
bool logical_xor(std::complex<T0> const &t0, std::complex<T1> const &t1)
{
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp
index 478e497a92d..f29c16695c7 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/logspace.hpp
@@ -8,10 +8,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
- auto logspace(double start, double stop, long num = 50, bool endpoint = true,
- double base = 10.0)
- -> decltype(functor::power()(base, functor::linspace()(start, stop, num,
- endpoint)));
+ auto logspace(double start, double stop, long num = 50, bool endpoint = true, double base = 10.0)
+ -> decltype(functor::power()(base, functor::linspace()(start, stop, num, endpoint)));
DEFINE_FUNCTOR(pythonic::numpy, logspace);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp
index 3120f92c94a..6861265d063 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/max.hpp
@@ -10,8 +10,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class... Args>
- auto max(Args &&...args) -> decltype(reduce<operator_::functor::imax>(
- std::forward<Args>(args)...));
+ auto max(Args &&...args)
+ -> decltype(reduce<operator_::functor::imax>(std::forward<Args>(args)...));
DEFINE_FUNCTOR(pythonic::numpy, max);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp
index 0aa0e9a5b9e..757d7dcce4b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/mean.hpp
@@ -13,9 +13,8 @@ namespace numpy
namespace details
{
template <size_t N>
- struct make_scalar_pshape
- : sutils::concat<types::pshape<std::integral_constant<long, 1>>,
- typename make_scalar_pshape<N - 1>::type> {
+ struct make_scalar_pshape : sutils::concat<types::pshape<std::integral_constant<long, 1>>,
+ typename make_scalar_pshape<N - 1>::type> {
};
template <>
@@ -36,15 +35,13 @@ namespace numpy
} // namespace details
template <class E, class dtype = types::none_type>
- auto mean(E const &expr, types::none_type axis = {}, dtype d = {},
- types::none_type out = {}, types::false_immediate keep_dims = {})
- -> decltype(sum(expr, axis, d) /
- details::dtype_or_double<dtype>(expr.flat_size()));
+ auto mean(E const &expr, types::none_type axis = {}, dtype d = {}, types::none_type out = {},
+ types::false_immediate keep_dims = {})
+ -> decltype(sum(expr, axis, d) / details::dtype_or_double<dtype>(expr.flat_size()));
template <class E, class dtype = types::none_type>
auto mean(E const &expr, long axis, dtype d = {}, types::none_type out = {},
- types::false_immediate keep_dims = {}) -> decltype(sum(expr, axis,
- d));
+ types::false_immediate keep_dims = {}) -> decltype(sum(expr, axis, d));
template <class E, class dtype>
types::ndarray<details::dtype_or_double<dtype>,
@@ -54,8 +51,7 @@ namespace numpy
template <class E, class dtype>
auto mean(E const &expr, long axis, dtype d, types::none_type out,
- types::true_immediate keep_dims)
- -> decltype(expand_dims(mean(expr, axis, d), axis));
+ types::true_immediate keep_dims) -> decltype(expand_dims(mean(expr, axis, d), axis));
DEFINE_FUNCTOR(pythonic::numpy, mean);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp
index af1f229a871..550d193e81c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/median.hpp
@@ -11,20 +11,16 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- decltype(std::declval<T>() + 1.) median(types::ndarray<T, pS> const &arr,
- types::none_type = {});
+ decltype(std::declval<T>() + 1.) median(types::ndarray<T, pS> const &arr, types::none_type = {});
template <class T, class pS>
- typename std::enable_if<
- std::tuple_size<pS>::value != 1,
- types::ndarray<
- decltype(std::declval<T>() + 1.),
- types::array_tuple<long, std::tuple_size<pS>::value - 1>>>::type
+ std::enable_if_t<std::tuple_size<pS>::value != 1,
+ types::ndarray<decltype(std::declval<T>() + 1.),
+ types::array_tuple<long, std::tuple_size<pS>::value - 1>>>
median(types::ndarray<T, pS> const &arr, long axis);
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- decltype(std::declval<T>() + 1.)>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 1, decltype(std::declval<T>() + 1.)>
median(types::ndarray<T, pS> const &arr, long axis);
NUMPY_EXPR_TO_NDARRAY0_DECL(median);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp
index 4e5137d9f19..c639da029d2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/min.hpp
@@ -11,8 +11,8 @@ namespace numpy
{
template <class... Args>
- auto min(Args &&...args) -> decltype(reduce<operator_::functor::imin>(
- std::forward<Args>(args)...));
+ auto min(Args &&...args)
+ -> decltype(reduce<operator_::functor::imin>(std::forward<Args>(args)...));
DEFINE_FUNCTOR(pythonic::numpy, min);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp
index 293b0467a24..0339564367e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray.hpp
@@ -10,20 +10,23 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
- template <class pS, class dtype = functor::float64>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- ndarray(pS const &shape, dtype d = dtype());
+ namespace anonymous
+ {
- template <class dtype = functor::float64>
- types::ndarray<typename dtype::type, types::pshape<long>>
- ndarray(long size, dtype d = dtype());
+ template <class pS, class dtype = functor::float64>
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> ndarray(pS const &shape,
+ dtype d = dtype());
- template <long N, class dtype = functor::float64>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
- ndarray(std::integral_constant<long, N>, dtype d = dtype());
+ template <class dtype = functor::float64>
+ types::ndarray<typename dtype::type, types::pshape<long>> ndarray(long size, dtype d = dtype());
- DEFINE_FUNCTOR(pythonic::numpy, ndarray);
+ template <long N, class dtype = functor::float64>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
+ ndarray(std::integral_constant<long, N>, dtype d = dtype());
+
+ } // namespace anonymous
+
+ DEFINE_FUNCTOR(pythonic::numpy::anonymous, ndarray);
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp
index ab81081b71d..55cc2e32aee 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/flatten.hpp
@@ -12,8 +12,7 @@ namespace numpy
namespace ndarray
{
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- flatten(types::ndarray<T, pS> const &a);
+ types::ndarray<T, types::pshape<long>> flatten(types::ndarray<T, pS> const &a);
NUMPY_EXPR_TO_NDARRAY0_DECL(flatten);
DEFINE_FUNCTOR(pythonic::numpy::ndarray, flatten);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp
index 2391263fb60..988cdf1ddd2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/item.hpp
@@ -16,12 +16,11 @@ namespace numpy
T item(types::ndarray<T, pS> const &expr, long i);
template <class E, size_t N>
- auto item(E &&expr,
- types::array_tuple<long, N> const &i) -> decltype(expr[i]);
+ auto item(E &&expr, types::array_tuple<long, N> const &i) -> decltype(expr[i]);
// only for compatibility purpose, very bad impl
template <class E>
- typename std::decay<E>::type::dtype item(E &&expr, long i);
+ typename std::decay_t<E>::dtype item(E &&expr, long i);
DEFINE_FUNCTOR(pythonic::numpy::ndarray, item);
} // namespace ndarray
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp
index db3aad1d217..87bcb0722ae 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/reshape.hpp
@@ -12,19 +12,15 @@ namespace numpy
namespace ndarray
{
template <class T, class pS, class NpS>
- typename std::enable_if<!std::is_integral<NpS>::value,
- types::ndarray<T, NpS>>::type
+ std::enable_if_t<!std::is_integral<NpS>::value, types::ndarray<T, NpS>>
reshape(types::ndarray<T, pS> const &expr, NpS const &new_shape);
template <class T, class pS, class NpS>
- typename std::enable_if<std::is_integral<NpS>::value,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<std::is_integral<NpS>::value, types::ndarray<T, types::pshape<long>>>
reshape(types::ndarray<T, pS> const &expr, NpS const &new_shape);
template <class T, class pS, class S0, class S1, class... S>
- auto reshape(types::ndarray<T, pS> const &expr, S0 i0, S1 i1,
- S const &...indices)
- -> decltype(reshape(expr,
- types::pshape<S0, S1, S...>{i0, i1, indices...}));
+ auto reshape(types::ndarray<T, pS> const &expr, S0 i0, S1 i1, S const &...indices)
+ -> decltype(reshape(expr, types::pshape<S0, S1, S...>{i0, i1, indices...}));
NUMPY_EXPR_TO_NDARRAY0_DECL(reshape);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp
index e45630bb2e0..318caa79d9d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndarray/tolist.hpp
@@ -23,14 +23,12 @@ namespace numpy
};
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- types::list<T>>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 1, types::list<T>>
tolist(types::ndarray<T, pS> const &expr);
template <class T, class pS>
- typename std::enable_if<
- std::tuple_size<pS>::value != 1,
- typename tolist_type<T, std::tuple_size<pS>::value>::type>::type
+ std::enable_if_t<std::tuple_size<pS>::value != 1,
+ typename tolist_type<T, std::tuple_size<pS>::value>::type>
tolist(types::ndarray<T, pS> const &expr);
NUMPY_EXPR_TO_NDARRAY0_DECL(tolist);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp
index 18d78f2ef5f..4b0934c7edd 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndenumerate.hpp
@@ -9,9 +9,8 @@ namespace numpy
{
template <class E>
struct ndenumerate_iterator
- : std::iterator<
- std::random_access_iterator_tag,
- std::tuple<types::array_tuple<long, E::value>, typename E::dtype>> {
+ : std::iterator<std::random_access_iterator_tag,
+ std::tuple<types::array_tuple<long, E::value>, typename E::dtype>> {
long index;
E const &expr;
typename E::dtype *iter;
@@ -19,12 +18,15 @@ namespace numpy
ndenumerate_iterator();
ndenumerate_iterator(E const &expr, long first);
- std::tuple<types::array_tuple<long, E::value>, typename E::dtype>
- operator*() const;
+ std::tuple<types::array_tuple<long, E::value>, typename E::dtype> operator*() const;
ndenumerate_iterator &operator++();
ndenumerate_iterator &operator+=(long n);
bool operator!=(ndenumerate_iterator const &other) const;
+ bool operator==(ndenumerate_iterator const &other) const
+ {
+ return !(*this != other);
+ }
bool operator<(ndenumerate_iterator const &other) const;
long operator-(ndenumerate_iterator const &other) const;
};
@@ -43,8 +45,7 @@ namespace numpy
};
template <class T, class pS>
- _ndenumerate<types::ndarray<T, pS>>
- ndenumerate(types::ndarray<T, pS> const &expr);
+ _ndenumerate<types::ndarray<T, pS>> ndenumerate(types::ndarray<T, pS> const &expr);
NUMPY_EXPR_TO_NDARRAY0_DECL(ndenumerate);
DEFINE_FUNCTOR(pythonic::numpy, ndenumerate);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp
index 387665cdbf9..b4a40661526 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ndindex.hpp
@@ -13,10 +13,9 @@ namespace numpy
template <size_t N>
struct ndindex_iterator
: std::iterator<
- std::random_access_iterator_tag, types::array_tuple<long, N>,
- ptrdiff_t, types::array_tuple<long, N> *,
- types::array_tuple<
- long, N> /* reference_type, but no reference is possible*/> {
+ std::random_access_iterator_tag, types::array_tuple<long, N>, ptrdiff_t,
+ types::array_tuple<long, N> *,
+ types::array_tuple<long, N> /* reference_type, but no reference is possible*/> {
long index;
types::array_tuple<long, N> shape;
ndindex_iterator();
@@ -25,6 +24,10 @@ namespace numpy
ndindex_iterator &operator++();
ndindex_iterator &operator+=(long n);
bool operator!=(ndindex_iterator const &other) const;
+ bool operator==(ndindex_iterator const &other) const
+ {
+ return !(*this != other);
+ }
bool operator<(ndindex_iterator const &other) const;
long operator-(ndindex_iterator const &other) const;
};
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp
index add55d20ea8..d09edac13f7 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/nonzero.hpp
@@ -11,8 +11,7 @@ namespace numpy
template <class E>
auto nonzero(E const &expr)
- -> types::array_tuple<types::ndarray<long, types::array_tuple<long, 1>>,
- E::value>;
+ -> types::array_tuple<types::ndarray<long, types::array_tuple<long, 1>>, E::value>;
DEFINE_FUNCTOR(pythonic::numpy, nonzero)
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp
index 8ce8d3f505a..276e2531ad1 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ones.hpp
@@ -14,16 +14,14 @@ namespace numpy
typename dtype::type ones(std::tuple<> const &shape, dtype d = dtype());
template <class pS, class dtype = functor::float64>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- ones(pS const &shape, dtype d = dtype());
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> ones(pS const &shape,
+ dtype d = dtype());
template <class dtype = functor::float64>
- types::ndarray<typename dtype::type, types::pshape<long>>
- ones(long size, dtype d = dtype());
+ types::ndarray<typename dtype::type, types::pshape<long>> ones(long size, dtype d = dtype());
template <long N, class dtype = functor::float64>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
ones(std::integral_constant<long, N>, dtype d = dtype());
DEFINE_FUNCTOR(pythonic::numpy, ones);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp
index 784b017d7e3..e121ca3a91e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ones_like.hpp
@@ -10,13 +10,11 @@ namespace numpy
{
template <class E, class dtype>
- auto ones_like(E const &expr, dtype d = dtype())
- -> decltype(ones(sutils::getshape(expr), d));
+ auto ones_like(E const &expr, dtype d = dtype()) -> decltype(ones(sutils::getshape(expr), d));
template <class E>
auto ones_like(E const &expr, types::none_type d = builtins::None)
- -> decltype(ones(sutils::getshape(expr),
- types::dtype_t<typename E::dtype>()));
+ -> decltype(ones(sutils::getshape(expr), types::dtype_t<typename E::dtype>()));
DEFINE_FUNCTOR(pythonic::numpy, ones_like)
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp
index c125edba2e6..ab0ded6c449 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/outer.hpp
@@ -11,21 +11,17 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T0, class pS0, class T1, class pS1>
- types::ndarray<decltype(std::declval<T0>() + std::declval<T1>()),
- types::pshape<long, long>>
+ types::ndarray<decltype(std::declval<T0>() + std::declval<T1>()), types::pshape<long, long>>
outer(types::ndarray<T0, pS0> const &a, types::ndarray<T1, pS1> const &b);
template <class T0, class pS0, class E1>
- auto outer(types::ndarray<T0, pS0> const &a,
- E1 const &b) -> decltype(outer(a, asarray(b)));
+ auto outer(types::ndarray<T0, pS0> const &a, E1 const &b) -> decltype(outer(a, asarray(b)));
template <class E0, class T1, class pS1>
- auto outer(E0 const &a, types::ndarray<T1, pS1> const &b)
- -> decltype(outer(asarray(a), b));
+ auto outer(E0 const &a, types::ndarray<T1, pS1> const &b) -> decltype(outer(asarray(a), b));
template <class E0, class E1>
- auto outer(E0 const &a,
- E1 const &b) -> decltype(outer(asarray(a), asarray(b)));
+ auto outer(E0 const &a, E1 const &b) -> decltype(outer(asarray(a), asarray(b)));
DEFINE_FUNCTOR(pythonic::numpy, outer);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp
index 968ae7ee2c7..59eb4d6be2f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/partial_sum.hpp
@@ -10,28 +10,25 @@ namespace numpy
template <class Op, class E>
using result_dtype = types::dtype_t<decltype(std::declval<Op>()(
- std::declval<typename std::remove_reference<E>::type::dtype>(),
- std::declval<typename std::remove_reference<E>::type::dtype>()))>;
+ std::declval<typename std::remove_reference_t<E>::dtype>(),
+ std::declval<typename std::remove_reference_t<E>::dtype>()))>;
template <class Op, class E, class dtype = result_dtype<Op, E>>
- types::ndarray<typename dtype::type, types::pshape<long>>
- partial_sum(E const &expr, dtype d = dtype());
+ types::ndarray<typename dtype::type, types::pshape<long>> partial_sum(E const &expr,
+ dtype d = dtype());
template <class Op, class E, class dtype = result_dtype<Op, E>>
- auto partial_sum(E const &expr, long axis, dtype d = dtype()) ->
- typename std::enable_if<E::value == 1,
- decltype(partial_sum<Op, E, dtype>(expr))>::type;
+ auto partial_sum(E const &expr, long axis, dtype d = dtype())
+ -> std::enable_if_t<E::value == 1, decltype(partial_sum<Op, E, dtype>(expr))>;
template <class Op, class E, class dtype = result_dtype<Op, E>>
- using partial_sum_type =
- types::ndarray<typename dtype::type, types::array_tuple<long, E::value>>;
+ using partial_sum_type = types::ndarray<typename dtype::type, types::array_tuple<long, E::value>>;
template <class Op, class E, class dtype = result_dtype<Op, E>>
using partial_sum_type2 =
- types::ndarray<typename dtype::type,
- types::array_tuple<long, E::value - 1>>;
+ types::ndarray<typename dtype::type, types::array_tuple<long, E::value - 1>>;
template <class Op, class E, class dtype = result_dtype<Op, E>>
- typename std::enable_if<E::value != 1, partial_sum_type<Op, E, dtype>>::type
+ std::enable_if_t<E::value != 1, partial_sum_type<Op, E, dtype>>
partial_sum(E const &expr, long axis, dtype d = dtype());
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp
index 86e0094b91c..b084ee2d53d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/place.hpp
@@ -11,12 +11,11 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS, class Tp, class pSp, class F>
- types::none_type place(types::ndarray<T, pS> &expr,
- types::ndarray<Tp, pSp> const &mask, F const &values);
+ types::none_type place(types::ndarray<T, pS> &expr, types::ndarray<Tp, pSp> const &mask,
+ F const &values);
template <class T, class pS, class M, class F>
- types::none_type place(types::ndarray<T, pS> &expr, M const &mask,
- F const &values);
+ types::none_type place(types::ndarray<T, pS> &expr, M const &mask, F const &values);
template <class E, class M, class F>
types::none_type place(E &, M const &, F const &);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp
index 459108a512d..c0f735c8f85 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/prod.hpp
@@ -11,8 +11,8 @@ namespace numpy
{
template <class... Args>
- auto prod(Args &&...args) -> decltype(reduce<operator_::functor::imul>(
- std::forward<Args>(args)...));
+ auto prod(Args &&...args)
+ -> decltype(reduce<operator_::functor::imul>(std::forward<Args>(args)...));
DEFINE_FUNCTOR(pythonic::numpy, prod);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp
index 6ee15eaaabd..8f069744e74 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ptp.hpp
@@ -9,8 +9,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto ptp(E const &expr,
- long axis) -> decltype(max(expr, axis) - min(expr, axis));
+ auto ptp(E const &expr, long axis) -> decltype(max(expr, axis) - min(expr, axis));
template <class E>
auto ptp(E const &expr) -> decltype(max(expr) - min(expr));
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp
index fad2c56efe2..cf9043166b5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/put.hpp
@@ -10,8 +10,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class F, class T, class pS, class E>
- typename std::enable_if<types::is_numexpr_arg<F>::value,
- types::none_type>::type
+ std::enable_if_t<types::is_numexpr_arg<F>::value, types::none_type>
put(types::ndarray<T, pS> &expr, F const &ind, E const &v);
template <class T, class pS>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp
index c10c896432d..132ac3942f9 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/putmask.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS, class E, class F>
- types::none_type putmask(types::ndarray<T, pS> &expr, E const &mask,
- F const &values);
+ types::none_type putmask(types::ndarray<T, pS> &expr, E const &mask, F const &values);
template <class E, class M, class F>
types::none_type putmask(E &, M const &, F const &);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp
index 38234fdbe39..081ba79a304 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/choice.hpp
@@ -12,16 +12,13 @@ namespace numpy
namespace random
{
template <class pS, class P>
- types::ndarray<long, pS> choice(long max, pS const &shape, bool replace,
- P const &p);
+ types::ndarray<long, pS> choice(long max, pS const &shape, bool replace, P const &p);
template <class P>
- types::ndarray<long, types::pshape<long>> choice(long max, long size,
- bool replace, P &&p);
+ types::ndarray<long, types::pshape<long>> choice(long max, long size, bool replace, P &&p);
template <class T>
- auto choice(long max,
- T &&size) -> decltype(randint(0, max, std::forward<T>(size)));
+ auto choice(long max, T &&size) -> decltype(randint(0, max, std::forward<T>(size)));
long choice(long max);
@@ -32,16 +29,15 @@ namespace numpy
types::ndarray<typename T::dtype, pS> choice(T const &a, pS const &shape);
template <class T>
- types::ndarray<typename T::dtype, types::pshape<long>> choice(T &&a,
- long size);
+ types::ndarray<typename T::dtype, types::pshape<long>> choice(T &&a, long size);
template <class T, class pS, class P>
- types::ndarray<typename T::dtype, pS> choice(T const &a, pS const &shape,
- bool replace, P const &p);
+ types::ndarray<typename T::dtype, pS> choice(T const &a, pS const &shape, bool replace,
+ P const &p);
template <class T, class P>
- types::ndarray<typename T::dtype, types::pshape<long>>
- choice(T &&a, long size, bool replace, P &&p);
+ types::ndarray<typename T::dtype, types::pshape<long>> choice(T &&a, long size, bool replace,
+ P &&p);
DEFINE_FUNCTOR(pythonic::numpy::random, choice);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp
index 32e9ae53994..e4e6f7685b3 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/f.hpp
@@ -14,9 +14,8 @@ namespace numpy
template <class pS>
types::ndarray<double, pS> f(double dfnum, double dfden, pS const &shape);
- auto f(double dfnum, double dfden,
- long size) -> decltype(f(dfnum, dfden,
- types::array_tuple<long, 1>{{size}}));
+ auto f(double dfnum, double dfden, long size)
+ -> decltype(f(dfnum, dfden, types::array_tuple<long, 1>{{size}}));
double f(double dfnum, double dfden, types::none_type size = {});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp
index 336e10eb729..a5a740187d6 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gamma.hpp
@@ -12,14 +12,12 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<double, pS> gamma(double shape, double scale,
- pS const &array_shape);
+ types::ndarray<double, pS> gamma(double shape, double scale, pS const &array_shape);
auto gamma(double shape, double scale, long size)
-> decltype(gamma(shape, scale, types::array_tuple<long, 1>{{size}}));
- double gamma(double shape = 0.0, double scale = 1.0,
- types::none_type size = {});
+ double gamma(double shape = 0.0, double scale = 1.0, types::none_type size = {});
DEFINE_FUNCTOR(pythonic::numpy::random, gamma);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp
index 0dd5481d500..6a45541a333 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/gumbel.hpp
@@ -12,14 +12,12 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<double, pS> gumbel(double loc, double scale,
- pS const &shape);
+ types::ndarray<double, pS> gumbel(double loc, double scale, pS const &shape);
auto gumbel(double loc, double scale, long size)
-> decltype(gumbel(loc, scale, types::array_tuple<long, 1>{{size}}));
- double gumbel(double loc = 0.0, double scale = 1.0,
- types::none_type size = {});
+ double gumbel(double loc = 0.0, double scale = 1.0, types::none_type size = {});
DEFINE_FUNCTOR(pythonic::numpy::random, gumbel);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp
index f0a5fab81a8..fc6bb940180 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/laplace.hpp
@@ -12,14 +12,12 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<double, pS> laplace(double loc, double scale,
- pS const &shape);
+ types::ndarray<double, pS> laplace(double loc, double scale, pS const &shape);
auto laplace(double loc, double scale, long size)
-> decltype(laplace(loc, scale, types::array_tuple<long, 1>{{size}}));
- double laplace(double loc = 0.0, double scale = 1.0,
- types::none_type size = {});
+ double laplace(double loc = 0.0, double scale = 1.0, types::none_type size = {});
DEFINE_FUNCTOR(pythonic::numpy::random, laplace);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp
index 938ce930ca3..13dcd527ba0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/logistic.hpp
@@ -12,14 +12,12 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<double, pS> logistic(double loc, double scale,
- pS const &shape);
+ types::ndarray<double, pS> logistic(double loc, double scale, pS const &shape);
auto logistic(double loc, double scale, long size)
-> decltype(logistic(loc, scale, types::array_tuple<long, 1>{{size}}));
- double logistic(double loc = 0.0, double scale = 1.0,
- types::none_type size = {});
+ double logistic(double loc = 0.0, double scale = 1.0, types::none_type size = {});
DEFINE_FUNCTOR(pythonic::numpy::random, logistic);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp
index 5c1ee965f9c..19b6d51087c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/lognormal.hpp
@@ -12,15 +12,12 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<double, pS> lognormal(double mean, double sigma,
- pS const &shape);
+ types::ndarray<double, pS> lognormal(double mean, double sigma, pS const &shape);
auto lognormal(double mean, double sigma, long size)
- -> decltype(lognormal(mean, sigma,
- types::array_tuple<long, 1>{{size}}));
+ -> decltype(lognormal(mean, sigma, types::array_tuple<long, 1>{{size}}));
- double lognormal(double mean = 0.0, double sigma = 1.0,
- types::none_type size = {});
+ double lognormal(double mean = 0.0, double sigma = 1.0, types::none_type size = {});
DEFINE_FUNCTOR(pythonic::numpy::random, lognormal);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp
index 1b70ef5082b..7188ada2998 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/negative_binomial.hpp
@@ -12,12 +12,10 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<long, pS> negative_binomial(long n, double p,
- pS const &shape);
+ types::ndarray<long, pS> negative_binomial(long n, double p, pS const &shape);
auto negative_binomial(long n, double p, long size)
- -> decltype(negative_binomial(n, p,
- types::array_tuple<long, 1>{{size}}));
+ -> decltype(negative_binomial(n, p, types::array_tuple<long, 1>{{size}}));
long negative_binomial(long n, double p, types::none_type size = {});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp
index bc69b5ff004..f2e8aa00e06 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/normal.hpp
@@ -12,14 +12,12 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<double, pS> normal(double loc, double scale,
- pS const &shape);
+ types::ndarray<double, pS> normal(double loc, double scale, pS const &shape);
auto normal(double loc, double scale, long size)
-> decltype(normal(loc, scale, types::array_tuple<long, 1>{{size}}));
- double normal(double loc = 0.0, double scale = 1.0,
- types::none_type size = {});
+ double normal(double loc = 0.0, double scale = 1.0, types::none_type size = {});
DEFINE_FUNCTOR(pythonic::numpy::random, normal);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp
index a98eb234815..72987148c58 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/pareto.hpp
@@ -15,8 +15,7 @@ namespace numpy
template <class pS>
types::ndarray<double, pS> pareto(double a, pS const &shape);
- auto pareto(double a, long size)
- -> decltype(pareto(a, types::array_tuple<long, 1>{{size}}));
+ auto pareto(double a, long size) -> decltype(pareto(a, types::array_tuple<long, 1>{{size}}));
double pareto(double a, types::none_type size = {});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp
index f10fdc7553a..b5ad6dafd9a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/power.hpp
@@ -14,8 +14,7 @@ namespace numpy
{
template <class pS>
types::ndarray<double, pS> power(double a, pS const &shape);
- auto power(double a, long size)
- -> decltype(power(a, types::array_tuple<long, 1>{{size}}));
+ auto power(double a, long size) -> decltype(power(a, types::array_tuple<long, 1>{{size}}));
double power(double a, types::none_type size = {});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp
index 5e10ebecc51..cd37233bdb9 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/rand.hpp
@@ -10,8 +10,7 @@ namespace numpy
namespace random
{
template <class... T>
- types::ndarray<double, types::array_tuple<long, sizeof...(T)>>
- rand(T... shape);
+ types::ndarray<double, types::array_tuple<long, sizeof...(T)>> rand(T... shape);
double rand();
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp
index bcc8ebbdeb2..60de4b4388b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randint.hpp
@@ -11,18 +11,15 @@ namespace numpy
namespace random
{
template <class pS>
- typename std::enable_if<!std::is_integral<pS>::value,
- types::ndarray<long, pS>>::type
+ std::enable_if_t<!std::is_integral<pS>::value, types::ndarray<long, pS>>
randint(long min, long max, pS const &shape);
template <class pS>
- typename std::enable_if<std::is_integral<pS>::value,
- types::ndarray<long, types::pshape<long>>>::type
+ std::enable_if_t<std::is_integral<pS>::value, types::ndarray<long, types::pshape<long>>>
randint(long min, long max, pS const &shape);
template <class pS>
- auto randint(long max, types::none_type,
- pS const &shape) -> decltype(randint(0, max, shape));
+ auto randint(long max, types::none_type, pS const &shape) -> decltype(randint(0, max, shape));
long randint(long min, long max);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp
index 1a9cdd1c649..5c1b6083fc4 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/randn.hpp
@@ -11,8 +11,7 @@ namespace numpy
namespace random
{
template <class... T>
- types::ndarray<double, types::array_tuple<long, sizeof...(T)>>
- randn(T... shape);
+ types::ndarray<double, types::array_tuple<long, sizeof...(T)>> randn(T... shape);
double randn();
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp
index 084c57b6843..fb10a2cfef1 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/random.hpp
@@ -14,13 +14,11 @@ namespace numpy
template <class pS>
types::ndarray<double, pS> random(pS const &shape);
- auto
- random(long size) -> decltype(random(types::array_tuple<long, 1>{{size}}));
+ auto random(long size) -> decltype(random(types::array_tuple<long, 1>{{size}}));
template <long N>
auto random(std::integral_constant<long, N>)
- -> decltype(random(
- types::array_tuple<std::integral_constant<long, N>, 1>{}))
+ -> decltype(random(types::array_tuple<std::integral_constant<long, N>, 1>{}))
{
return random(types::array_tuple<std::integral_constant<long, N>, 1>{});
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp
index da81018b81d..7b297850a5b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/uniform.hpp
@@ -13,14 +13,12 @@ namespace numpy
namespace random
{
template <class pS>
- types::ndarray<double, pS> uniform(double low, double high,
- pS const &array_shape);
+ types::ndarray<double, pS> uniform(double low, double high, pS const &array_shape);
auto uniform(double low, double high, long size)
-> decltype(uniform(low, high, types::array_tuple<long, 1>{{size}}));
- double uniform(double low = 0.0, double high = 1.0,
- types::none_type size = {});
+ double uniform(double low = 0.0, double high = 1.0, types::none_type size = {});
DEFINE_FUNCTOR(pythonic::numpy::random, uniform);
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp
index 2f96e7d0b9e..aa640a87dd8 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/random/weibull.hpp
@@ -14,8 +14,7 @@ namespace numpy
template <class pS>
types::ndarray<double, pS> weibull(double a, pS const &shape);
- auto weibull(double a, long size)
- -> decltype(weibull(a, types::array_tuple<long, 1>{{size}}));
+ auto weibull(double a, long size) -> decltype(weibull(a, types::array_tuple<long, 1>{{size}}));
double weibull(double a, types::none_type size = {});
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp
index 9fd9e8e51ef..73902ffa921 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ravel.hpp
@@ -9,8 +9,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- ravel(types::ndarray<T, pS> const &expr);
+ types::ndarray<T, types::pshape<long>> ravel(types::ndarray<T, pS> const &expr);
NUMPY_EXPR_TO_NDARRAY0_DECL(ravel);
DEFINE_FUNCTOR(pythonic::numpy, ravel);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp
index 900733f5f8c..ce46770c0f9 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/real.hpp
@@ -11,11 +11,9 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto real(E &&expr) -> decltype(builtins::getattr(types::attr::REAL{},
- std::forward<E>(expr)));
+ auto real(E &&expr) -> decltype(builtins::getattr(types::attr::REAL{}, std::forward<E>(expr)));
template <class T>
- auto real(types::list<T> const &expr)
- -> decltype(real(numpy::functor::asarray{}(expr)));
+ auto real(types::list<T> const &expr) -> decltype(real(numpy::functor::asarray{}(expr)));
DEFINE_FUNCTOR(pythonic::numpy, real);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp
index 6923590ca56..5b37b1fbeff 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/reduce.hpp
@@ -27,65 +27,58 @@ namespace numpy
};
template <class Op, class E>
struct reduce_result_type_helper<Op, E, types::none_type> {
- using type = typename std::conditional<
+ using type = std::conditional_t<
std::is_integral<typename types::dtype_of<E>::type>::value &&
(sizeof(typename types::dtype_of<E>::type) < sizeof(long)) &&
!std::is_same<Op, operator_::functor::imin>::value &&
!std::is_same<Op, operator_::functor::imax>::value,
- typename std::conditional<
- std::is_same<typename types::dtype_of<E>::type, bool>::value,
- long,
- typename std::conditional<
- std::is_signed<typename types::dtype_of<E>::type>::value,
- long, unsigned long>::type>::type,
- typename types::dtype_of<E>::type>::type;
+ std::conditional_t<
+ std::is_same<typename types::dtype_of<E>::type, bool>::value, long,
+ std::conditional_t<std::is_signed<typename types::dtype_of<E>::type>::value, long,
+ unsigned long>>,
+ typename types::dtype_of<E>::type>;
};
template <class Op, class E, class T = types::none_type>
- using reduce_result_type =
- typename reduce_result_type_helper<Op, E, T>::type;
+ using reduce_result_type = typename reduce_result_type_helper<Op, E, T>::type;
} // namespace
template <class Op, class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, E>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, E>
reduce(E const &expr, types::none_type _ = types::none_type());
template <class Op, class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, E>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, E>
reduce(E const &array, long axis);
template <class Op, class E, class dtype = types::none_type>
- typename std::enable_if<types::is_numexpr_arg<E>::value,
- reduce_result_type<Op, E, dtype>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value, reduce_result_type<Op, E, dtype>>
reduce(E const &expr, types::none_type axis = {}, dtype d = {});
template <class Op, class E, class dtype = types::none_type>
- reduce_result_type<Op, E> reduce(types::numpy_texpr<E> const &expr,
- types::none_type axis = {}, dtype d = {})
+ reduce_result_type<Op, E> reduce(types::numpy_texpr<E> const &expr, types::none_type axis = {},
+ dtype d = {})
{
return reduce<Op>(expr.arg, axis, d);
}
template <class Op, class E, class dtype = types::none_type>
- typename std::enable_if<E::value == 1, reduce_result_type<Op, E, dtype>>::type
+ std::enable_if_t<E::value == 1, reduce_result_type<Op, E, dtype>>
reduce(E const &array, long axis, dtype d = {}, types::none_type out = {});
template <class Op, class E, class Out>
- typename std::enable_if<E::value == 1, reduce_result_type<Op, E>>::type
+ std::enable_if_t<E::value == 1, reduce_result_type<Op, E>>
reduce(E const &array, long axis, types::none_type dtype, Out &&out);
namespace
{
template <class E, class Op, class dtype = types::none_type>
- using reduced_type = types::ndarray<reduce_result_type<Op, E, dtype>,
- types::array_tuple<long, E::value - 1>>;
+ using reduced_type =
+ types::ndarray<reduce_result_type<Op, E, dtype>, types::array_tuple<long, E::value - 1>>;
}
template <class Op, class E, class dtype = types::none_type>
- typename std::enable_if<E::value != 1, reduced_type<E, Op, dtype>>::type
- reduce(E const &array, long axis, dtype d = {},
- types::none_type out = types::none_type());
+ std::enable_if_t<E::value != 1, reduced_type<E, Op, dtype>>
+ reduce(E const &array, long axis, dtype d = {}, types::none_type out = types::none_type());
template <class Op, class E>
reduced_type<E, Op> reduce(types::numpy_texpr<E> const &array, long axis,
@@ -96,8 +89,8 @@ namespace numpy
}
template <class Op, class E, class Out>
- typename std::enable_if<E::value != 1, reduced_type<E, Op>>::type
- reduce(E const &array, long axis, types::none_type dtype, Out &&out);
+ std::enable_if_t<E::value != 1, reduced_type<E, Op>> reduce(E const &array, long axis,
+ types::none_type dtype, Out &&out);
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp
index 691687ff80b..1ac9d83fe19 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/remainder.hpp
@@ -15,8 +15,7 @@ namespace numpy
namespace wrapper
{
template <class T0, class T1>
- auto remainder(T0 const &x,
- T1 const &y) -> decltype(x - y * xsimd::floor(x / y))
+ auto remainder(T0 const &x, T1 const &y) -> decltype(x - y * xsimd::floor(x / y))
{
return x - y * xsimd::floor(x / y);
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp
index 39dba3a7c0c..42efc350b38 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/repeat.hpp
@@ -15,9 +15,8 @@ namespace numpy
repeat(types::ndarray<T, pS> const &expr, long repeats, long axis);
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- repeat(types::ndarray<T, pS> const &expr, long repeats,
- types::none_type axis = types::none_type{});
+ types::ndarray<T, types::pshape<long>> repeat(types::ndarray<T, pS> const &expr, long repeats,
+ types::none_type axis = types::none_type{});
NUMPY_EXPR_TO_NDARRAY0_DECL(repeat);
DEFINE_FUNCTOR(pythonic::numpy, repeat);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp
index cf8e122e52f..e5c9d22c1f7 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/roll.hpp
@@ -13,12 +13,10 @@ namespace numpy
types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, long shift);
template <class T, class pS>
- types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, long shift,
- long axis);
+ types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, long shift, long axis);
template <class T, class pS, size_t N>
- types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr,
- types::array_tuple<long, N> shift,
+ types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, types::array_tuple<long, N> shift,
types::array_tuple<long, N> axis);
NUMPY_EXPR_TO_NDARRAY0_DECL(roll);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp
index 378b30d021d..53165832fee 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/searchsorted.hpp
@@ -15,13 +15,12 @@ namespace numpy
{
template <class T, class U>
- typename std::enable_if<!types::is_numexpr_arg<T>::value, long>::type
+ std::enable_if_t<!types::is_numexpr_arg<T>::value, long>
searchsorted(U const &a, T const &v, types::str const &side = "left");
template <class E, class T>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value,
- types::ndarray<long, types::array_tuple<long, E::value>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value,
+ types::ndarray<long, types::array_tuple<long, E::value>>>
searchsorted(T const &a, E const &v, types::str const &side = "left");
DEFINE_FUNCTOR(pythonic::numpy, searchsorted);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp
index c8040d7a3a7..d946749210e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/select.hpp
@@ -11,39 +11,31 @@ namespace numpy
template <class C, class L>
types::ndarray<typename L::dtype, types::array_tuple<long, L::value - 1>>
- select(C const &condlist, L const &choicelist,
- typename L::dtype _default = 0);
+ select(C const &condlist, L const &choicelist, typename L::dtype _default = 0);
template <class T, class TpS, class U, class UpS>
- typename std::enable_if<
- std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
- types::ndarray<
- T, types::array_tuple<long, std::tuple_size<TpS>::value>>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<TpS>::value>>>
select(types::list<types::ndarray<U, UpS>> const &condlist,
types::list<types::ndarray<T, TpS>> const &choicelist, T _default = 0);
template <class T, class TpS, class U, class UpS, size_t M>
- typename std::enable_if<std::tuple_size<TpS>::value ==
- std::tuple_size<UpS>::value,
- types::ndarray<T, TpS>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, TpS>>
select(types::static_list<types::ndarray<U, UpS>, M> const &condlist,
- types::static_list<types::ndarray<T, TpS>, M> const &choicelist,
- T _default = 0);
+ types::static_list<types::ndarray<T, TpS>, M> const &choicelist, T _default = 0);
template <class T, class TpS, class U, class UpS, size_t M>
- typename std::enable_if<std::tuple_size<TpS>::value ==
- std::tuple_size<UpS>::value,
- types::ndarray<T, TpS>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, TpS>>
select(types::static_list<types::ndarray<U, UpS>, M> const &condlist,
types::list<types::ndarray<T, TpS>> const &choicelist, T _default = 0);
template <class T, class TpS, class U, class UpS, size_t M>
- typename std::enable_if<std::tuple_size<TpS>::value ==
- std::tuple_size<UpS>::value,
- types::ndarray<T, TpS>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, TpS>>
select(types::list<types::ndarray<U, UpS>> const &condlist,
- types::static_list<types::ndarray<T, TpS>, M> const &choicelist,
- T _default = 0);
+ types::static_list<types::ndarray<T, TpS>, M> const &choicelist, T _default = 0);
DEFINE_FUNCTOR(pythonic::numpy, select);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp
index df740d99f85..a43b68b49e2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/short_.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::short_> {
+ static PyObject *convert(numpy::functor::short_ const &c);
+};
+
+template <>
+struct from_python<numpy::functor::short_> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::short_ convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp
index 97c40568135..80096c645ed 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/sort.hpp
@@ -11,12 +11,12 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, 1>>
- sort(E const &expr, types::none_type);
+ types::ndarray<typename E::dtype, types::array_tuple<long, 1>> sort(E const &expr,
+ types::none_type);
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
- sort(E const &expr, long axis = -1);
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> sort(E const &expr,
+ long axis = -1);
template <class E>
types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp
index dfc51673471..a5e9a60028c 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/split.hpp
@@ -8,20 +8,17 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- types::list<
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>
+ types::list<types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>
split(types::ndarray<T, pS> const &a, long nb_split);
template <class T, class pS, class I>
- typename std::enable_if<
+ std::enable_if_t<
types::is_iterable<I>::value,
- types::list<types::ndarray<
- T, types::array_tuple<long, std::tuple_size<pS>::value>>>>::type
+ types::list<types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>>
split(types::ndarray<T, pS> const &a, I const &split_mask);
template <class E, class I>
- types::list<
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>>
+ types::list<types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>>
split(E const &a, I const &);
DEFINE_FUNCTOR(pythonic::numpy, split);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp
index 94cbfcc5dd7..f9f1142b270 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/stack.hpp
@@ -15,14 +15,12 @@ namespace numpy
namespace details
{
template <class... Tys>
- using stack_helper_t =
- typename __combined<typename assignable<Tys>::type...>::type;
+ using stack_helper_t = typename __combined<typename assignable<Tys>::type...>::type;
}
template <class... Tys>
- types::ndarray<
- typename details::stack_helper_t<Tys...>::dtype,
- types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>>
+ types::ndarray<typename details::stack_helper_t<Tys...>::dtype,
+ types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>>
stack(std::tuple<Tys...> const &args, long axis = 0);
DEFINE_FUNCTOR(pythonic::numpy, stack);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp
index 0e403bf214c..cd28fd2192b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/std_.hpp
@@ -10,8 +10,7 @@ namespace numpy
{
template <class... Args>
- auto std_(Args &&...args)
- -> decltype(functor::sqrt{}(var(std::forward<Args>(args)...)));
+ auto std_(Args &&...args) -> decltype(functor::sqrt{}(var(std::forward<Args>(args)...)));
DEFINE_FUNCTOR(pythonic::numpy, std_);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp
index 13552f2cd3e..32d50646393 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/swapaxes.hpp
@@ -8,11 +8,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- auto swapaxes(T &&a, int axis1, int axis2)
- -> decltype(functor::transpose{}(
- std::forward<T>(a),
- std::declval<
- types::array_tuple<long, std::decay<T>::type::value>>()));
+ auto swapaxes(T &&a, int axis1, int axis2) -> decltype(functor::transpose{}(
+ std::forward<T>(a), std::declval<types::array_tuple<long, std::decay_t<T>::value>>()));
DEFINE_FUNCTOR(pythonic::numpy, swapaxes);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp
index 47c311c86df..286fb9d1502 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/take.hpp
@@ -6,8 +6,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class F, class T>
- auto take(T &&expr, F &&indices)
- -> decltype(std::forward<T>(expr)[std::forward<F>(indices)]);
+ auto take(T &&expr, F &&indices) -> decltype(std::forward<T>(expr)[std::forward<F>(indices)]);
DEFINE_FUNCTOR(pythonic::numpy, take);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp
index 6c844eeceee..04ac0e475f6 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/tile.hpp
@@ -9,8 +9,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
- tile(E const &expr, long reps);
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> tile(E const &expr,
+ long reps);
template <class E, size_t N>
types::ndarray<typename E::dtype, types::array_tuple<long, N>>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp
index 0eb9ade8b3e..c5a98f8a8eb 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/transpose.hpp
@@ -13,8 +13,7 @@ namespace numpy
{
template <class E>
- types::numpy_texpr<types::broadcasted<E>>
- transpose(types::broadcasted<E> const &arr)
+ types::numpy_texpr<types::broadcasted<E>> transpose(types::broadcasted<E> const &arr)
{
return {arr};
}
@@ -26,36 +25,31 @@ namespace numpy
}
template <class E>
- typename std::enable_if<E::value == 2, types::numpy_texpr<E>>::type
- transpose(E const &arr)
+ std::enable_if_t<E::value == 2, types::numpy_texpr<E>> transpose(E const &arr)
{
return {arr};
}
template <class E>
- typename std::enable_if<E::value == 1, E>::type transpose(E const &arr)
+ std::enable_if_t<E::value == 1, E> transpose(E const &arr)
{
return arr;
}
template <class T, class pS>
- typename std::enable_if<
- (std::tuple_size<pS>::value > 2),
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>::
- type
- transpose(types::ndarray<T, pS> const &a);
+ std::enable_if_t<(std::tuple_size<pS>::value > 2),
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>
+ transpose(types::ndarray<T, pS> const &a);
template <class T, class pS, size_t M>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- transpose(types::ndarray<T, pS> const &a,
- types::array_tuple<long, M> const &t);
+ transpose(types::ndarray<T, pS> const &a, types::array_tuple<long, M> const &t);
template <class T, class pS, class... Args>
types::ndarray<T, types::array_tuple<long, 1 + sizeof...(Args)>>
transpose(types::ndarray<T, pS> const &a, long index, Args const &...indices)
{
- return transpose(a, types::array_tuple<long, 1 + sizeof...(Args)>{
- {index, (long)indices...}});
+ return transpose(a, types::array_tuple<long, 1 + sizeof...(Args)>{{index, (long)indices...}});
}
template <class T>
@@ -64,16 +58,15 @@ namespace numpy
template <class Op, class... Args>
auto transpose(types::numpy_expr<Op, Args...> const &expr)
-> decltype(_transpose<types::numpy_expr<Op, Args...>>{}(
- expr, utils::make_index_sequence<sizeof...(Args)>()))
+ expr, std::make_index_sequence<sizeof...(Args)>()))
{
return _transpose<types::numpy_expr<Op, Args...>>{}(
- expr, utils::make_index_sequence<sizeof...(Args)>());
+ expr, std::make_index_sequence<sizeof...(Args)>());
}
template <class Op, class... Args>
struct _transpose<types::numpy_expr<Op, Args...>> {
template <size_t... Is>
- auto operator()(types::numpy_expr<Op, Args...> const &expr,
- utils::index_sequence<Is...>)
+ auto operator()(types::numpy_expr<Op, Args...> const &expr, std::index_sequence<Is...>)
-> decltype(Op{}(transpose(std::get<Is>(expr.args))...))
{
return Op{}(transpose(std::get<Is>(expr.args))...);
@@ -81,14 +74,11 @@ namespace numpy
};
template <class E>
- auto transpose(E const &expr) ->
- typename std::enable_if<
- (E::value > 2),
- decltype(transpose(types::ndarray<typename E::dtype,
- typename E::shape_t>{expr}))>::type
+ auto transpose(E const &expr) -> std::enable_if_t<
+ (E::value > 2),
+ decltype(transpose(types::ndarray<typename E::dtype, typename E::shape_t>{expr}))>
{
- return transpose(
- types::ndarray<typename E::dtype, typename E::shape_t>{expr});
+ return transpose(types::ndarray<typename E::dtype, typename E::shape_t>{expr});
}
DEFINE_FUNCTOR(pythonic::numpy, transpose);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp
index e95fd990dea..e99d72a3dbe 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ubyte.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::ubyte> {
+ static PyObject *convert(numpy::functor::ubyte const &c);
+};
+
+template <>
+struct from_python<numpy::functor::ubyte> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::ubyte convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp
index be76448d59e..3e64b889b8e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_accumulate.hpp
@@ -15,11 +15,9 @@ namespace numpy
{
namespace UFUNC_NAME
{
- template <class T,
- class dtype = numpy::result_dtype<numpy::functor::UFUNC_NAME, T>>
+ template <class T, class dtype = numpy::result_dtype<numpy::functor::UFUNC_NAME, T>>
auto accumulate(T &&a, long axis = 0, dtype d = dtype())
- -> decltype(partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a),
- axis, d));
+ -> decltype(partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a), axis, d));
DEFINE_FUNCTOR(pythonic::numpy::UFUNC_NAME, accumulate);
} // namespace UFUNC_NAME
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp
index 8f8b19f5999..de63f457131 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ufunc_reduce.hpp
@@ -20,21 +20,16 @@ namespace numpy
template <class Arg>
auto reduce(Arg &&arg)
- -> decltype(numpy::reduce<operator_::functor::UFUNC_INAME>(
- std::forward<Arg>(arg), 0L))
+ -> decltype(numpy::reduce<operator_::functor::UFUNC_INAME>(std::forward<Arg>(arg), 0L))
{
- return numpy::reduce<operator_::functor::UFUNC_INAME>(
- std::forward<Arg>(arg), 0L);
+ return numpy::reduce<operator_::functor::UFUNC_INAME>(std::forward<Arg>(arg), 0L);
}
template <class... Args>
- auto reduce(Args &&...args) ->
- typename std::enable_if<
- sizeof...(Args) != 1,
- decltype(numpy::reduce<operator_::functor::UFUNC_INAME>(
- std::forward<Args>(args)...))>::type
+ auto reduce(Args &&...args) -> std::enable_if_t<
+ sizeof...(Args) != 1,
+ decltype(numpy::reduce<operator_::functor::UFUNC_INAME>(std::forward<Args>(args)...))>
{
- return numpy::reduce<operator_::functor::UFUNC_INAME>(
- std::forward<Args>(args)...);
+ return numpy::reduce<operator_::functor::UFUNC_INAME>(std::forward<Args>(args)...);
}
DEFINE_FUNCTOR(pythonic::numpy::UFUNC_NAME, reduce);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp
index dd6242f7759..bc13cf6e2e2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint.hpp
@@ -25,4 +25,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::uint> {
+ static PyObject *convert(numpy::functor::uint const &c);
+};
+
+template <>
+struct from_python<numpy::functor::uint> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::uint convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp
index 0d1f6c33533..924a732a56b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint16.hpp
@@ -26,4 +26,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::uint16> {
+ static PyObject *convert(numpy::functor::uint16 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::uint16> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::uint16 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp
index 0d0bfcb17b4..d0f6e29a473 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint32.hpp
@@ -24,5 +24,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::uint32> {
+ static PyObject *convert(numpy::functor::uint32 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::uint32> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::uint32 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp
index 85264f209c8..ca718acc098 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint64.hpp
@@ -25,4 +25,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::uint64> {
+ static PyObject *convert(numpy::functor::uint64 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::uint64> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::uint64 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp
index 8eef53ba882..78d3d491fd2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uint8.hpp
@@ -26,4 +26,23 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::uint8> {
+ static PyObject *convert(numpy::functor::uint8 const &c);
+};
+
+template <>
+struct from_python<numpy::functor::uint8> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::uint8 convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp
index dc9a6e25c77..0d65b7067fd 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/uintc.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::uintc> {
+ static PyObject *convert(numpy::functor::uintc const &c);
+};
+
+template <>
+struct from_python<numpy::functor::uintc> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::uintc convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp
index 241fd221ecc..d03e5cf50c2 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/union1d.hpp
@@ -9,9 +9,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class F>
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>
union1d(E const &e, F const &f);
DEFINE_FUNCTOR(pythonic::numpy, union1d)
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp
index e353f4de2a8..293c811fcb0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/unique.hpp
@@ -25,85 +25,68 @@ namespace numpy
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::true_immediate return_inverse);
+ unique(E const &expr, types::false_immediate return_index, types::true_immediate return_inverse);
template <class E>
types::ndarray<typename E::dtype, types::pshape<long>>
- unique(E const &expr, types::false_immediate return_index,
- types::false_immediate return_inverse);
+ unique(E const &expr, types::false_immediate return_index, types::false_immediate return_inverse);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::false_immediate return_inverse);
+ unique(E const &expr, types::true_immediate return_index, types::false_immediate return_inverse);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::true_immediate return_inverse);
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::true_immediate return_index, types::true_immediate return_inverse);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::true_immediate return_inverse,
+ unique(E const &expr, types::true_immediate return_index, types::true_immediate return_inverse,
types::true_immediate return_counts);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::true_immediate return_inverse,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::true_immediate return_index, types::true_immediate return_inverse,
types::false_immediate return_counts);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::false_immediate return_inverse,
+ unique(E const &expr, types::true_immediate return_index, types::false_immediate return_inverse,
types::false_immediate return_counts);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::false_immediate return_inverse,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::true_immediate return_index, types::false_immediate return_inverse,
types::true_immediate return_counts);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::true_immediate return_inverse,
+ unique(E const &expr, types::false_immediate return_index, types::true_immediate return_inverse,
types::false_immediate return_counts);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::true_immediate return_inverse,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::false_immediate return_index, types::true_immediate return_inverse,
types::true_immediate return_counts);
template <class E>
types::ndarray<typename E::dtype, types::pshape<long>>
- unique(E const &expr, types::false_immediate return_index,
- types::false_immediate return_inverse,
+ unique(E const &expr, types::false_immediate return_index, types::false_immediate return_inverse,
types::false_immediate return_counts);
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::false_immediate return_inverse,
+ unique(E const &expr, types::false_immediate return_index, types::false_immediate return_inverse,
types::true_immediate return_counts);
DEFINE_FUNCTOR(pythonic::numpy, unique)
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp
index fcab8025b35..9705a57bdb4 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/unravel_index.hpp
@@ -9,9 +9,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class S>
- typename std::enable_if<
- std::is_scalar<E>::value,
- types::array_tuple<long, std::tuple_size<S>::value>>::type
+ std::enable_if_t<std::is_scalar<E>::value, types::array_tuple<long, std::tuple_size<S>::value>>
unravel_index(E const &expr, S const &shape, types::str const &order = "C");
DEFINE_FUNCTOR(pythonic::numpy, unravel_index);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp
index e0928a5001f..0a906d03312 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/unwrap.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::ndarray<double, typename E::shape_t> unwrap(E const &expr,
- double discont = pi);
+ types::ndarray<double, typename E::shape_t> unwrap(E const &expr, double discont = pi);
DEFINE_FUNCTOR(pythonic::numpy, unwrap)
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp
index de2018e7957..a7ec888e757 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/ushort.hpp
@@ -25,5 +25,23 @@ namespace numpy
#include "pythonic/include/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+template <>
+struct to_python<numpy::functor::ushort> {
+ static PyObject *convert(numpy::functor::ushort const &c);
+};
+
+template <>
+struct from_python<numpy::functor::ushort> {
+ static bool is_convertible(PyObject *obj);
+ static numpy::functor::ushort convert(PyObject *obj);
+};
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp
index f6a74f69b1c..8486b142e8a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/var.hpp
@@ -15,14 +15,12 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- using var_type = typename std::conditional<
- std::is_integral<typename E::dtype>::value, double,
- decltype(std::real(std::declval<typename E::dtype>()))>::type;
+ using var_type = std::conditional_t<std::is_integral<typename E::dtype>::value, double,
+ decltype(std::real(std::declval<typename E::dtype>()))>;
template <class E>
auto var(E const &expr, types::none_type axis = builtins::None,
- types::none_type dtype = builtins::None,
- types::none_type out = builtins::None,
+ types::none_type dtype = builtins::None, types::none_type out = builtins::None,
long ddof = 0) -> decltype(var_type<E>(std::real(mean(expr))));
template <class E>
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp
index db4cdcd64d7..c5228c440dc 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/vdot.hpp
@@ -12,8 +12,7 @@ namespace numpy
{
template <class U, class V>
auto vdot(U const &u, V const &v)
- -> decltype(functor::dot{}(functor::asarray{}(u).flat(),
- functor::asarray{}(v).flat()));
+ -> decltype(functor::dot{}(functor::asarray{}(u).flat(), functor::asarray{}(v).flat()));
DEFINE_FUNCTOR(pythonic::numpy, vdot);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/vectorize.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/vectorize.hpp
index 14e1fead586..e38e50a5f65 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/vectorize.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/vectorize.hpp
@@ -12,16 +12,13 @@ namespace numpy
struct vectorized {
using callable = void;
template <typename... T>
- auto operator()(T &&...args) const ->
- typename std::enable_if<!types::valid_numexpr_parameters<
- typename std::decay<T>::type...>::value,
- decltype(F{}(std::forward<T>(args)...))>::type;
+ auto operator()(T &&...args) const
+ -> std::enable_if_t<!types::valid_numexpr_parameters<std::decay_t<T>...>::value,
+ decltype(F{}(std::forward<T>(args)...))>;
template <class... E>
- typename std::enable_if<
- types::valid_numexpr_parameters<typename std::decay<E>::type...>::value,
- types::numpy_expr<F,
- typename types::adapt_type<E, E...>::type...>>::type
+ std::enable_if_t<types::valid_numexpr_parameters<std::decay_t<E>...>::value,
+ types::numpy_expr<F, typename types::adapt_type<E, E...>::type...>>
operator()(E &&...args) const;
};
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp
index 9742af5e880..46dbf5b56f3 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/vstack.hpp
@@ -14,9 +14,9 @@ namespace numpy
}
template <class ArraySequence>
- auto vstack(ArraySequence &&seq) ->
- typename std::enable_if<(impl::vstack_helper<ArraySequence>::value > 1),
- impl::vstack_helper<ArraySequence>>::type;
+ auto vstack(ArraySequence &&seq)
+ -> std::enable_if_t<(impl::vstack_helper<ArraySequence>::value > 1),
+ impl::vstack_helper<ArraySequence>>;
// according to the numpy.vstack doc:
// Equivalent to ``np.concatenate(tup, axis=0)`` if `tup` contains arrays
@@ -25,11 +25,10 @@ namespace numpy
//
// the enable if is there to match this behavior
template <class ArraySequence>
- auto vstack(ArraySequence &&seq) ->
- typename std::enable_if<
- (impl::vstack_helper<ArraySequence>::value == 1),
- decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape(
- std::declval<types::array_tuple<long, 2>>()))>::type;
+ auto vstack(ArraySequence &&seq)
+ -> std::enable_if_t<(impl::vstack_helper<ArraySequence>::value == 1),
+ decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape(
+ std::declval<types::array_tuple<long, 2>>()))>;
DEFINE_FUNCTOR(pythonic::numpy, vstack);
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp
index 559c9aca5be..3bf9482dfbe 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/where.hpp
@@ -12,15 +12,14 @@ namespace numpy
namespace impl
{
template <class E, class F, class G>
- typename __combined<F, G>::type where(E const &cond, F const &true_,
- G const &false_);
+ typename __combined<F, G>::type where(E const &cond, F const &true_, G const &false_);
}
-#define NUMPY_NARY_EXTRA_METHOD \
- template <class E> \
- auto operator()(E &&expr)->decltype(nonzero{}(std::forward<E>(expr))) \
- { \
- return nonzero{}(std::forward<E>(expr)); \
+#define NUMPY_NARY_EXTRA_METHOD \
+ template <class E> \
+ auto operator()(E &&expr)->decltype(nonzero{}(std::forward<E>(expr))) \
+ { \
+ return nonzero{}(std::forward<E>(expr)); \
}
#define NUMPY_NARY_FUNC_NAME where
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp
index d716de5d1bf..7747118c011 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros.hpp
@@ -13,16 +13,14 @@ namespace numpy
typename dtype::type zeros(std::tuple<> const &shape, dtype d = dtype());
template <class pS, class dtype = functor::float64>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- zeros(pS const &shape, dtype d = dtype());
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> zeros(pS const &shape,
+ dtype d = dtype());
template <class dtype = functor::float64>
- types::ndarray<typename dtype::type, types::pshape<long>>
- zeros(long size, dtype d = dtype());
+ types::ndarray<typename dtype::type, types::pshape<long>> zeros(long size, dtype d = dtype());
template <long N, class dtype = functor::float64>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
zeros(std::integral_constant<long, N>, dtype d = dtype());
DEFINE_FUNCTOR(pythonic::numpy, zeros);
diff --git a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp
index c593ddbad11..78cac6e2677 100644
--- a/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/numpy/zeros_like.hpp
@@ -10,13 +10,11 @@ namespace numpy
{
template <class E, class dtype>
- auto zeros_like(E const &expr, dtype d = dtype())
- -> decltype(zeros(sutils::getshape(expr), d));
+ auto zeros_like(E const &expr, dtype d = dtype()) -> decltype(zeros(sutils::getshape(expr), d));
template <class E>
auto zeros_like(E const &expr, types::none_type d = builtins::None)
- -> decltype(zeros(sutils::getshape(expr),
- types::dtype_t<typename E::dtype>()));
+ -> decltype(zeros(sutils::getshape(expr), types::dtype_t<typename E::dtype>()));
DEFINE_FUNCTOR(pythonic::numpy, zeros_like)
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp
index beba5e98f77..fa2a59c0a54 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/concat.hpp
@@ -9,8 +9,7 @@ namespace operator_
{
template <class A, class B>
- auto concat(A &&a,
- B &&b) -> decltype(std::forward<A>(a) + std::forward<B>(b));
+ auto concat(A &&a, B &&b) -> decltype(std::forward<A>(a) + std::forward<B>(b));
DEFINE_FUNCTOR(pythonic::operator_, concat);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp
index ce741d860ed..2bb08e23d10 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/contains.hpp
@@ -9,8 +9,7 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto contains(A &&a,
- B &&b) -> decltype(in(std::forward<A>(a), std::forward<B>(b)));
+ auto contains(A &&a, B &&b) -> decltype(in(std::forward<A>(a), std::forward<B>(b)));
DEFINE_FUNCTOR(pythonic::operator_, contains);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp
index 3d8d44f6a4b..ecddd2e1712 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/div.hpp
@@ -10,10 +10,9 @@ namespace operator_
{
template <class A, class B>
auto div(A &&a, B &&b) // for ndarrays
- -> typename std::enable_if<
- !std::is_fundamental<typename std::decay<A>::type>::value ||
- !std::is_fundamental<typename std::decay<B>::type>::value,
- decltype(std::forward<A>(a) / std::forward<B>(b))>::type;
+ -> std::enable_if_t<!std::is_fundamental<std::decay_t<A>>::value ||
+ !std::is_fundamental<std::decay_t<B>>::value,
+ decltype(std::forward<A>(a) / std::forward<B>(b))>;
double div(double a, double b);
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp
index 78697dec48b..c136097769f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/getitem.hpp
@@ -8,8 +8,7 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto getitem(A &&a,
- B &&b) -> decltype(std::forward<A>(a)[std::forward<B>(b)]);
+ auto getitem(A &&a, B &&b) -> decltype(std::forward<A>(a)[std::forward<B>(b)]);
DEFINE_FUNCTOR(pythonic::operator_, getitem);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp
index 2d5c6a17452..a45d1008e18 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/icommon.hpp
@@ -22,19 +22,16 @@ namespace operator_
{
template <class A, class B>
- auto OPERATOR_NAME(bool, A &&a, B &&b,
- ...) -> decltype(std::forward<A>(a)
- OPERATOR_SYMBOL std::forward<B>(b));
+ auto OPERATOR_NAME(bool, A &&a, B &&b, ...)
+ -> decltype(std::forward<A>(a) OPERATOR_SYMBOL std::forward<B>(b));
template <class A, class B>
auto OPERATOR_NAME(bool, A &&a, B &&b, std::nullptr_t)
-> decltype(std::forward<A>(a) OPERATOR_ISYMBOL std::forward<B>(b));
template <class A, class B>
- auto OPERATOR_NAME(A &&a,
- B &&b) -> decltype(OPERATOR_NAME(true, std::forward<A>(a),
- std::forward<B>(b),
- nullptr))
+ auto OPERATOR_NAME(A &&a, B &&b)
+ -> decltype(OPERATOR_NAME(true, std::forward<A>(a), std::forward<B>(b), nullptr))
{
return OPERATOR_NAME(true, std::forward<A>(a), std::forward<B>(b), nullptr);
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp
index c57935e245a..7edbf76f35f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/imax.hpp
@@ -9,18 +9,16 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto imax(A &&a, B &&b) ->
- typename std::enable_if<
- std::is_const<A>::value || !std::is_assignable<A, B>::value,
- decltype(numpy::functor::maximum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type;
+ auto imax(A &&a, B &&b)
+ -> std::enable_if_t<std::is_const<A>::value || !std::is_assignable<A, B>::value,
+ decltype(numpy::functor::maximum{}(std::forward<A>(a),
+ std::forward<B>(b)))>;
template <class A, class B>
- auto imax(A &&a, B &&b) ->
- typename std::enable_if<
- !std::is_const<A>::value && std::is_assignable<A, B>::value,
- decltype(a = numpy::functor::maximum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type;
+ auto imax(A &&a, B &&b)
+ -> std::enable_if_t<!std::is_const<A>::value && std::is_assignable<A, B>::value,
+ decltype(a = numpy::functor::maximum{}(std::forward<A>(a),
+ std::forward<B>(b)))>;
DEFINE_FUNCTOR(pythonic::operator_, imax);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp
index 6036ff10dbd..82f5f2d747a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/imin.hpp
@@ -9,18 +9,16 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto imin(A &&a, B &&b) ->
- typename std::enable_if<
- std::is_const<A>::value || !std::is_assignable<A, B>::value,
- decltype(numpy::functor::minimum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type;
+ auto imin(A &&a, B &&b)
+ -> std::enable_if_t<std::is_const<A>::value || !std::is_assignable<A, B>::value,
+ decltype(numpy::functor::minimum{}(std::forward<A>(a),
+ std::forward<B>(b)))>;
template <class A, class B>
- auto imin(A &&a, B &&b) ->
- typename std::enable_if<
- !std::is_const<A>::value && std::is_assignable<A, B>::value,
- decltype(a = numpy::functor::minimum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type;
+ auto imin(A &&a, B &&b)
+ -> std::enable_if_t<!std::is_const<A>::value && std::is_assignable<A, B>::value,
+ decltype(a = numpy::functor::minimum{}(std::forward<A>(a),
+ std::forward<B>(b)))>;
DEFINE_FUNCTOR(pythonic::operator_, imin);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp
index 2426ff1db0d..3d03634f131 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/is_.hpp
@@ -10,8 +10,8 @@ namespace operator_
{
template <class A, class B>
- auto is_(A &&a, B &&b) -> decltype(builtins::id(std::forward<A>(a)) ==
- builtins::id(std::forward<B>(b)));
+ auto is_(A &&a, B &&b)
+ -> decltype(builtins::id(std::forward<A>(a)) == builtins::id(std::forward<B>(b)));
DEFINE_FUNCTOR(pythonic::operator_, is_);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp
index 46b51a1d830..dceb3cca24d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/is_not.hpp
@@ -9,8 +9,8 @@ namespace operator_
{
template <class A, class B>
- auto is_not(A &&a, B &&b) -> decltype(builtins::id(std::forward<A>(a)) !=
- builtins::id(std::forward<B>(b)));
+ auto is_not(A &&a, B &&b)
+ -> decltype(builtins::id(std::forward<A>(a)) != builtins::id(std::forward<B>(b)));
DEFINE_FUNCTOR(pythonic::operator_, is_not);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp
index 7fd8943fcfa..344c7cfa4fc 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/itemgetter.hpp
@@ -34,14 +34,13 @@ namespace operator_
void helper(T &t, A const &a, utils::int_<0>) const;
template <class A>
- auto operator()(A const &a) const
- -> std::tuple<typename std::remove_cv<typename std::remove_reference<
- decltype(a[std::declval<Types>()])>::type>::type...>;
+ auto operator()(A const &a) const -> std::tuple<
+ std::remove_cv_t<std::remove_reference_t<decltype(a[std::declval<Types>()])>>...>;
};
template <class... L>
- itemgetter_tuple_return<long, long, L...>
- itemgetter(long const &item1, long const &item2, L... items);
+ itemgetter_tuple_return<long, long, L...> itemgetter(long const &item1, long const &item2,
+ L... items);
DEFINE_FUNCTOR(pythonic::operator_, itemgetter);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp
index 75b058e449c..bd5cf12c479 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/itruediv.hpp
@@ -12,16 +12,13 @@ namespace operator_
auto itruediv(A const &a, B &&b) -> decltype(truediv(a, std::forward<B>(b)));
template <class A, class B>
- auto itruediv(A &a, B &&b) ->
- typename std::enable_if<
- std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value,
- A &>::type;
+ auto itruediv(A &a, B &&b)
+ -> std::enable_if_t<std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, A &>;
template <class A, class B>
- auto itruediv(A &a, B &&b) ->
- typename std::enable_if<
- !std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value,
- decltype(truediv(a, std::forward<B>(b)))>::type;
+ auto itruediv(A &a, B &&b)
+ -> std::enable_if_t<!std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value,
+ decltype(truediv(a, std::forward<B>(b)))>;
DEFINE_FUNCTOR(pythonic::operator_, itruediv);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp
index 0de91c72922..bcd82dacf95 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/lshift.hpp
@@ -10,8 +10,7 @@ namespace operator_
{
template <class A, class B>
- auto lshift(A &&a, B &&b) -> decltype(std::forward<A>(a)
- << std::forward<B>(b));
+ auto lshift(A &&a, B &&b) -> decltype(std::forward<A>(a) << std::forward<B>(b));
DEFINE_ALL_OPERATOR_OVERLOADS_DECL(lshift, <<)
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp
index e0733b7d2bf..51f8abe4715 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/matmul.hpp
@@ -10,9 +10,8 @@ namespace operator_
{
template <class A, class B>
- auto matmul(A &&a,
- B &&b) -> decltype(numpy::functor::dot{}(std::forward<A>(a),
- std::forward<B>(b)));
+ auto matmul(A &&a, B &&b)
+ -> decltype(numpy::functor::dot{}(std::forward<A>(a), std::forward<B>(b)));
DEFINE_FUNCTOR(pythonic::operator_, matmul);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp
index 3fecdec3d1f..294e6184a20 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/mod.hpp
@@ -9,11 +9,9 @@ namespace operator_
{
template <class A, class B>
- auto mod(A &&a, B &&b) ->
- typename std::enable_if<
- std::is_fundamental<typename std::decay<A>::type>::value &&
- std::is_fundamental<typename std::decay<B>::type>::value,
- decltype(std::forward<A>(a) % std::forward<B>(b))>::type;
+ auto mod(A &&a, B &&b) -> std::enable_if_t<std::is_fundamental<std::decay_t<A>>::value &&
+ std::is_fundamental<std::decay_t<B>>::value,
+ decltype(std::forward<A>(a) % std::forward<B>(b))>;
inline double mod(double a, long b);
@@ -21,10 +19,9 @@ namespace operator_
template <class A, class B>
auto mod(A &&a, B &&b) // for ndarrays
- -> typename std::enable_if<
- !std::is_fundamental<typename std::decay<A>::type>::value ||
- !std::is_fundamental<typename std::decay<B>::type>::value,
- decltype(std::forward<A>(a) % std::forward<B>(b))>::type;
+ -> std::enable_if_t<!std::is_fundamental<std::decay_t<A>>::value ||
+ !std::is_fundamental<std::decay_t<B>>::value,
+ decltype(std::forward<A>(a) % std::forward<B>(b))>;
DEFINE_FUNCTOR(pythonic::operator_, mod);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/overloads.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/overloads.hpp
index f4753f9b317..27d38b07c08 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/overloads.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/overloads.hpp
@@ -1,23 +1,22 @@
#ifndef PYTHONIC_INCLUDE_OPERATOR_OVERLOADS_HPP
#define PYTHONIC_INCLUDE_OPERATOR_OVERLOADS_HPP
-#define PYTHONIC_OPERATOR_OVERLOAD_DECL(type, opname, op) \
- type opname(type a, type b);
+#define PYTHONIC_OPERATOR_OVERLOAD_DECL(type, opname, op) type opname(type a, type b);
// workaround the fact that char and short computations are done using int in C,
// while they are done at their respective type in numpy
-#define DEFINE_ALL_OPERATOR_OVERLOADS_DECL(opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(bool, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned char, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(char, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(signed char, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned short, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(signed short, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned int, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(signed int, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned long, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(signed long, opname, op) \
- PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned long long, opname, op) \
+#define DEFINE_ALL_OPERATOR_OVERLOADS_DECL(opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(bool, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned char, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(char, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(signed char, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned short, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(signed short, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned int, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(signed int, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned long, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(signed long, opname, op) \
+ PYTHONIC_OPERATOR_OVERLOAD_DECL(unsigned long long, opname, op) \
PYTHONIC_OPERATOR_OVERLOAD_DECL(signed long long, opname, op)
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp
index cc64a33a52b..612e1523692 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/rshift.hpp
@@ -9,8 +9,7 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto rshift(A &&a,
- B &&b) -> decltype(std::forward<A>(a) >> std::forward<B>(b));
+ auto rshift(A &&a, B &&b) -> decltype(std::forward<A>(a) >> std::forward<B>(b));
DEFINE_ALL_OPERATOR_OVERLOADS_DECL(rshift, >>)
diff --git a/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp b/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp
index b6df765b478..e9e5dcbae2b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/operator_/truediv.hpp
@@ -8,8 +8,7 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto truediv(A &&a, B &&b) -> decltype(std::forward<A>(a) /
- (double)std::forward<B>(b));
+ auto truediv(A &&a, B &&b) -> decltype(std::forward<A>(a) / (double)std::forward<B>(b));
DEFINE_FUNCTOR(pythonic::operator_, truediv);
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp b/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp
index df2cfc2382d..a6b75e510c8 100644
--- a/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/random/sample.hpp
@@ -12,8 +12,7 @@ namespace random
{
template <class Iterable>
types::list<typename std::iterator_traits<
- typename std::remove_cv<typename std::remove_reference<Iterable>::type>::
- type::iterator>::value_type>
+ typename std::remove_cv_t<std::remove_reference_t<Iterable>>::iterator>::value_type>
sample(Iterable &&s, size_t k);
DEFINE_FUNCTOR(pythonic::random, sample);
diff --git a/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp b/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp
index fd7d18d33a2..fa772fae2c4 100644
--- a/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/scipy/special/i0.hpp
@@ -24,39 +24,30 @@ namespace scipy
* lim(x->0){ exp(-x) I0(x) } = 1.
*/
static constexpr double A[] = {
- -4.41534164647933937950E-18, 3.33079451882223809783E-17,
- -2.43127984654795469359E-16, 1.71539128555513303061E-15,
- -1.16853328779934516808E-14, 7.67618549860493561688E-14,
- -4.85644678311192946090E-13, 2.95505266312963983461E-12,
- -1.72682629144155570723E-11, 9.67580903537323691224E-11,
- -5.18979560163526290666E-10, 2.65982372468238665035E-9,
- -1.30002500998624804212E-8, 6.04699502254191894932E-8,
- -2.67079385394061173391E-7, 1.11738753912010371815E-6,
- -4.41673835845875056359E-6, 1.64484480707288970893E-5,
- -5.75419501008210370398E-5, 1.88502885095841655729E-4,
- -5.76375574538582365885E-4, 1.63947561694133579842E-3,
- -4.32430999505057594430E-3, 1.05464603945949983183E-2,
- -2.37374148058994688156E-2, 4.93052842396707084878E-2,
- -9.49010970480476444210E-2, 1.71620901522208775349E-1,
- -3.04682672343198398683E-1, 6.76795274409476084995E-1};
+ -4.41534164647933937950E-18, 3.33079451882223809783E-17, -2.43127984654795469359E-16,
+ 1.71539128555513303061E-15, -1.16853328779934516808E-14, 7.67618549860493561688E-14,
+ -4.85644678311192946090E-13, 2.95505266312963983461E-12, -1.72682629144155570723E-11,
+ 9.67580903537323691224E-11, -5.18979560163526290666E-10, 2.65982372468238665035E-9,
+ -1.30002500998624804212E-8, 6.04699502254191894932E-8, -2.67079385394061173391E-7,
+ 1.11738753912010371815E-6, -4.41673835845875056359E-6, 1.64484480707288970893E-5,
+ -5.75419501008210370398E-5, 1.88502885095841655729E-4, -5.76375574538582365885E-4,
+ 1.63947561694133579842E-3, -4.32430999505057594430E-3, 1.05464603945949983183E-2,
+ -2.37374148058994688156E-2, 4.93052842396707084878E-2, -9.49010970480476444210E-2,
+ 1.71620901522208775349E-1, -3.04682672343198398683E-1, 6.76795274409476084995E-1};
/* Chebyshev coefficients for exp(-x) sqrt(x) I0(x)
* in the inverted interval [8,infinity].
*
* lim(x->inf){ exp(-x) sqrt(x) I0(x) } = 1/sqrt(2pi).
*/
static constexpr double B[] = {
- -7.23318048787475395456E-18, -4.83050448594418207126E-18,
- 4.46562142029675999901E-17, 3.46122286769746109310E-17,
- -2.82762398051658348494E-16, -3.42548561967721913462E-16,
- 1.77256013305652638360E-15, 3.81168066935262242075E-15,
- -9.55484669882830764870E-15, -4.15056934728722208663E-14,
- 1.54008621752140982691E-14, 3.85277838274214270114E-13,
- 7.18012445138366623367E-13, -1.79417853150680611778E-12,
- -1.32158118404477131188E-11, -3.14991652796324136454E-11,
- 1.18891471078464383424E-11, 4.94060238822496958910E-10,
- 3.39623202570838634515E-9, 2.26666899049817806459E-8,
- 2.04891858946906374183E-7, 2.89137052083475648297E-6,
- 6.88975834691682398426E-5, 3.36911647825569408990E-3,
+ -7.23318048787475395456E-18, -4.83050448594418207126E-18, 4.46562142029675999901E-17,
+ 3.46122286769746109310E-17, -2.82762398051658348494E-16, -3.42548561967721913462E-16,
+ 1.77256013305652638360E-15, 3.81168066935262242075E-15, -9.55484669882830764870E-15,
+ -4.15056934728722208663E-14, 1.54008621752140982691E-14, 3.85277838274214270114E-13,
+ 7.18012445138366623367E-13, -1.79417853150680611778E-12, -1.32158118404477131188E-11,
+ -3.14991652796324136454E-11, 1.18891471078464383424E-11, 4.94060238822496958910E-10,
+ 3.39623202570838634515E-9, 2.26666899049817806459E-8, 2.04891858946906374183E-7,
+ 2.89137052083475648297E-6, 6.88975834691682398426E-5, 3.36911647825569408990E-3,
8.04490411014108831608E-1};
template <class T>
diff --git a/contrib/python/pythran/pythran/pythonic/include/string/ascii_letters.hpp b/contrib/python/pythran/pythran/pythonic/include/string/ascii_letters.hpp
index cbfefa9d67f..52d21f1b106 100644
--- a/contrib/python/pythran/pythran/pythonic/include/string/ascii_letters.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/string/ascii_letters.hpp
@@ -7,8 +7,7 @@ PYTHONIC_NS_BEGIN
namespace string
{
- static types::str const
- ascii_letters("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ static types::str const ascii_letters("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/NoneType.hpp b/contrib/python/pythran/pythran/pythonic/include/types/NoneType.hpp
index 9dfdbd77bc9..a47fc0415d1 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/NoneType.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/NoneType.hpp
@@ -83,8 +83,7 @@ namespace types
struct none_data {
explicit operator bool() const
{
- return !static_cast<P const *>(this)->is_none &&
- static_cast<P const *>(this)->data;
+ return !static_cast<P const *>(this)->is_none && static_cast<P const *>(this)->data;
}
operator T const &() const
{
@@ -95,8 +94,7 @@ namespace types
struct none_data<P, bool> {
operator bool() const
{
- return !static_cast<P const *>(this)->is_none &&
- static_cast<P const *>(this)->data;
+ return !static_cast<P const *>(this)->is_none && static_cast<P const *>(this)->data;
}
};
template <class T>
@@ -134,31 +132,28 @@ namespace types
}
};
-#define NONE_OPERATOR_OVERLOAD(op) \
- template <class T> \
- auto operator op(none<T> const &t0, T const &t1) \
- ->decltype(static_cast<T const &>(t0) op t1) \
- { \
- return static_cast<T const &>(t0) op t1; \
- } \
- \
- template <class T> \
- auto operator op(T const &t0, none<T> const &t1) \
- ->decltype(t0 op static_cast<T const &>(t1)) \
- { \
- return t0 op static_cast<T const &>(t1); \
- } \
- \
- template <class T> \
- auto operator op(none<T> const &t0, none<T> const &t1) \
- ->none<decltype(static_cast<T const &>(t0) \
- op static_cast<T const &>(t1))> \
- { \
- if (t0.is_none && t1.is_none) \
- return none_type{}; \
- else { \
- return {static_cast<T const &>(t0) op static_cast<T const &>(t1)}; \
- } \
+#define NONE_OPERATOR_OVERLOAD(op) \
+ template <class T> \
+ auto operator op(none<T> const &t0, T const &t1)->decltype(static_cast<T const &>(t0) op t1) \
+ { \
+ return static_cast<T const &>(t0) op t1; \
+ } \
+ \
+ template <class T> \
+ auto operator op(T const &t0, none<T> const &t1)->decltype(t0 op static_cast<T const &>(t1)) \
+ { \
+ return t0 op static_cast<T const &>(t1); \
+ } \
+ \
+ template <class T> \
+ auto operator op(none<T> const &t0, none<T> const &t1) \
+ ->none<decltype(static_cast<T const &>(t0) op static_cast<T const &>(t1))> \
+ { \
+ if (t0.is_none && t1.is_none) \
+ return none_type{}; \
+ else { \
+ return {static_cast<T const &>(t0) op static_cast<T const &>(t1)}; \
+ } \
}
NONE_OPERATOR_OVERLOAD(+)
@@ -172,12 +167,12 @@ namespace types
NONE_OPERATOR_OVERLOAD(<=)
template <class T0, class T1>
- decltype(operator_::mod(std::declval<T0>(), std::declval<T1>()))
- operator%(none<T0> const &t0, T1 const &t1);
+ decltype(operator_::mod(std::declval<T0>(), std::declval<T1>())) operator%(none<T0> const &t0,
+ T1 const &t1);
template <class T0, class T1>
- decltype(operator_::mod(std::declval<T0>(), std::declval<T1>()))
- operator%(T0 const &t0, none<T1> const &t1);
+ decltype(operator_::mod(std::declval<T0>(), std::declval<T1>())) operator%(T0 const &t0,
+ none<T1> const &t1);
template <class T0, class T1>
none<decltype(operator_::mod(std::declval<T0>(), std::declval<T1>()))>
@@ -213,12 +208,11 @@ namespace std
{
/* std::get overload */
template <size_t I, class T0>
- auto get(pythonic::types::none<T0> const &t)
- -> decltype(std::get<I>((T0 const &)t));
+ auto get(pythonic::types::none<T0> const &t) -> decltype(std::get<I>((T0 const &)t));
template <size_t I, class T0>
struct tuple_element<I, pythonic::types::none<T0>> {
- using type = typename std::tuple_element<I, T0>::type;
+ using type = std::tuple_element_t<I, T0>;
};
template <>
@@ -235,51 +229,43 @@ namespace std
template <class T0, class T1>
struct __combined<pythonic::types::none<T0>, T1> {
- static_assert(!pythonic::types::is_none<T1>::value,
- "none of none should'nt exist");
+ static_assert(!pythonic::types::is_none<T1>::value, "none of none should'nt exist");
using type = pythonic::types::none<typename __combined<T0, T1>::type>;
};
template <class T0, class T1>
struct __combined<T1, pythonic::types::none<T0>> {
- static_assert(!pythonic::types::is_none<T0>::value,
- "none of none should'nt exist");
+ static_assert(!pythonic::types::is_none<T0>::value, "none of none should'nt exist");
using type = pythonic::types::none<typename __combined<T0, T1>::type>;
};
template <class T0, class T1>
struct __combined<pythonic::types::none<T1>, pythonic::types::none<T0>> {
- static_assert(!pythonic::types::is_none<T0>::value,
- "none of none shouldn't exist");
- static_assert(!pythonic::types::is_none<T1>::value,
- "none of none shouldn't exist");
+ static_assert(!pythonic::types::is_none<T0>::value, "none of none shouldn't exist");
+ static_assert(!pythonic::types::is_none<T1>::value, "none of none shouldn't exist");
using type = pythonic::types::none<typename __combined<T0, T1>::type>;
};
template <class T>
struct __combined<pythonic::types::none_type, T> {
- static_assert(!pythonic::types::is_none<T>::value,
- "none of none shouldn't exist");
+ static_assert(!pythonic::types::is_none<T>::value, "none of none shouldn't exist");
using type = pythonic::types::none<T>;
};
template <class T>
struct __combined<pythonic::types::none_type, pythonic::types::none<T>> {
- static_assert(!pythonic::types::is_none<T>::value,
- "none of none shouldn't exist");
+ static_assert(!pythonic::types::is_none<T>::value, "none of none shouldn't exist");
using type = pythonic::types::none<T>;
};
template <class T>
struct __combined<T, pythonic::types::none_type> {
- static_assert(!pythonic::types::is_none<T>::value,
- "none of none shouldn't exist");
+ static_assert(!pythonic::types::is_none<T>::value, "none of none shouldn't exist");
using type = pythonic::types::none<T>;
};
template <class T>
struct __combined<pythonic::types::none<T>, pythonic::types::none_type> {
- static_assert(!pythonic::types::is_none<T>::value,
- "none of none shouldn't exist");
+ static_assert(!pythonic::types::is_none<T>::value, "none of none shouldn't exist");
using type = pythonic::types::none<T>;
};
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/array.hpp b/contrib/python/pythran/pythran/pythonic/include/types/array.hpp
index d4e6c1e06ec..0826c948565 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/array.hpp
@@ -65,8 +65,7 @@ namespace types
};
template <class E>
- struct array_iterator
- : std::iterator<std::random_access_iterator_tag, typename E::value_type> {
+ struct array_iterator : std::iterator<std::random_access_iterator_tag, typename E::value_type> {
E data;
long index;
array_iterator(E data, long index) : data(data), index(index)
@@ -129,6 +128,10 @@ namespace types
{
return index < other.index;
}
+ bool operator<=(array_iterator const &other) const
+ {
+ return index <= other.index;
+ }
array_iterator &operator=(array_iterator const &other)
{
index = other.index;
@@ -142,9 +145,7 @@ namespace types
{
// data holder
- typedef
- typename std::remove_cv<typename std::remove_reference<T>::type>::type
- _type;
+ using _type = std::remove_cv_t<std::remove_reference_t<T>>;
typedef container<_type> container_type;
utils::shared_ref<container_type> _data;
@@ -156,8 +157,7 @@ namespace types
public:
// types
typedef T data_type;
- typedef typename std::conditional<std::is_integral<T>::value, long,
- double>::type value_type;
+ typedef std::conditional_t<std::is_integral<T>::value, long, double> value_type;
typedef array_reference<sliced_array> reference;
typedef value_type const_reference;
typedef array_iterator<sliced_array> iterator;
@@ -174,15 +174,13 @@ namespace types
typedef data_type dtype;
static const size_t value = 1;
static const bool is_vectorizable =
- types::is_vectorizable_dtype<dtype>::value &&
- !std::is_same<S, slice>::value;
+ types::is_vectorizable_dtype<dtype>::value && !std::is_same<S, slice>::value;
static const bool is_flat = std::is_same<slice, S>::value;
static const bool is_strided = std::is_same<slice, S>::value;
using shape_t = types::array_tuple<long, value>;
template <size_t I>
- auto shape() const -> decltype(details::extract_shape(*this,
- utils::int_<I>{}))
+ auto shape() const -> decltype(details::extract_shape(*this, utils::int_<I>{}))
{
return details::extract_shape(*this, utils::int_<I>{});
}
@@ -201,8 +199,7 @@ namespace types
template <size_t N, class V>
array<T> operator+(array_base<T, N, V> const &) const;
template <class Tp, class Sp>
- array<typename __combined<T, Tp>::type>
- operator+(sliced_array<Tp, Sp> const &) const;
+ array<typename __combined<T, Tp>::type> operator+(sliced_array<Tp, Sp> const &) const;
// iterators
iterator begin();
@@ -236,9 +233,8 @@ namespace types
const_reference operator[](long i) const;
reference operator[](long i);
template <class Sp>
- typename std::enable_if<
- is_slice<Sp>::value,
- sliced_array<T, decltype(std::declval<S>() * std::declval<Sp>())>>::type
+ std::enable_if_t<is_slice<Sp>::value,
+ sliced_array<T, decltype(std::declval<S>() * std::declval<Sp>())>>
operator[](Sp s) const;
template <class... Indices>
@@ -276,8 +272,7 @@ namespace types
long count(T const &x) const;
template <class Tp, class Sp>
- friend std::ostream &operator<<(std::ostream &os,
- sliced_array<Tp, Sp> const &v);
+ friend std::ostream &operator<<(std::ostream &os, sliced_array<Tp, Sp> const &v);
};
/* array */
@@ -288,9 +283,7 @@ namespace types
static const size_t DEFAULT_CAPACITY = 16;
// data holder
- typedef
- typename std::remove_cv<typename std::remove_reference<T>::type>::type
- _type;
+ using _type = std::remove_cv_t<std::remove_reference_t<T>>;
typedef container<_type> container_type;
utils::shared_ref<container_type> _data;
@@ -303,8 +296,7 @@ namespace types
public:
// types
typedef T data_type;
- typedef typename std::conditional<std::is_integral<T>::value, long,
- double>::type value_type;
+ typedef std::conditional_t<std::is_integral<T>::value, long, double> value_type;
typedef array_reference<array> reference;
typedef value_type const_reference;
typedef array_iterator<array> iterator;
@@ -353,8 +345,7 @@ namespace types
array<T> &operator=(sliced_array<Tp, S> const &other);
template <class pS>
- array &
- operator=(ndarray<T, pshape<pS>> const &); // implemented in ndarray.hpp
+ array &operator=(ndarray<T, pshape<pS>> const &); // implemented in ndarray.hpp
template <class S>
array<T> &operator+=(sliced_array<T, S> const &other);
@@ -417,8 +408,7 @@ namespace types
const_reference operator[](long n) const;
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value, sliced_array<T, Sp>>::type
- operator[](Sp const &s) const;
+ std::enable_if_t<is_slice<Sp>::value, sliced_array<T, Sp>> operator[](Sp const &s) const;
template <class... Indices>
dtype load(long index0, long index1, Indices... indices) const
@@ -467,8 +457,7 @@ namespace types
array<typename __combined<T, F>::type> operator+(array<F> const &s) const;
template <class F, class S>
- array<decltype(std::declval<T>() +
- std::declval<typename sliced_array<F, S>::value_type>())>
+ array<decltype(std::declval<T>() + std::declval<typename sliced_array<F, S>::value_type>())>
operator+(sliced_array<F, S> const &s) const;
array<T> operator*(long t) const;
@@ -520,8 +509,7 @@ namespace utils
* const_iterator type.
*/
template <class T, class From>
- void reserve(types::array<T> &l, From const &f,
- typename From::const_iterator *p = nullptr);
+ void reserve(types::array<T> &l, From const &f, typename From::const_iterator *p = nullptr);
} // namespace utils
template <class T>
@@ -545,16 +533,13 @@ PYTHONIC_NS_END
namespace std
{
template <size_t I, class T>
- typename pythonic::types::array<T>::reference
- get(pythonic::types::array<T> &t);
+ typename pythonic::types::array<T>::reference get(pythonic::types::array<T> &t);
template <size_t I, class T>
- typename pythonic::types::array<T>::const_reference
- get(pythonic::types::array<T> const &t);
+ typename pythonic::types::array<T>::const_reference get(pythonic::types::array<T> const &t);
template <size_t I, class T>
- typename pythonic::types::array<T>::value_type
- get(pythonic::types::array<T> &&t);
+ typename pythonic::types::array<T>::value_type get(pythonic::types::array<T> &&t);
template <size_t I, class T, class S>
typename pythonic::types::sliced_array<T, S>::reference
@@ -617,24 +602,20 @@ struct __combined<pythonic::types::array<T0>, pythonic::types::array<T1>> {
};
template <class T0, class T1, class S>
-struct __combined<pythonic::types::sliced_array<T1, S>,
- pythonic::types::array<T0>> {
+struct __combined<pythonic::types::sliced_array<T1, S>, pythonic::types::array<T0>> {
typedef pythonic::types::array<typename __combined<T0, T1>::type> type;
};
template <class T0, class T1, class S>
-struct __combined<pythonic::types::array<T0>,
- pythonic::types::sliced_array<T1, S>> {
+struct __combined<pythonic::types::array<T0>, pythonic::types::sliced_array<T1, S>> {
typedef pythonic::types::array<typename __combined<T0, T1>::type> type;
};
template <class T, size_t N, class V, class Tp>
-struct __combined<pythonic::types::array_base<T, N, V>,
- pythonic::types::array<Tp>> {
+struct __combined<pythonic::types::array_base<T, N, V>, pythonic::types::array<Tp>> {
typedef pythonic::types::array<typename __combined<T, Tp>::type> type;
};
template <class T, size_t N, class V, class Tp>
-struct __combined<pythonic::types::array<Tp>,
- pythonic::types::array_base<T, N, V>> {
+struct __combined<pythonic::types::array<Tp>, pythonic::types::array_base<T, N, V>> {
typedef pythonic::types::array<typename __combined<T, Tp>::type> type;
};
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/assignable.hpp b/contrib/python/pythran/pythran/pythonic/include/types/assignable.hpp
index 888fcc408ef..17747061543 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/assignable.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/assignable.hpp
@@ -34,8 +34,7 @@ namespace types
};
template <class T>
- using by_val_t = typename by_val<
- T, std::is_integral<typename std::decay<T>::type>::value>::type;
+ using by_val_t = typename by_val<T, std::is_integral<std::decay_t<T>>::value>::type;
template <class F, class... Args>
static inline auto call(F &&f, Args &&...args)
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp b/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp
index 4e2179f4848..74098791ad6 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/combined.hpp
@@ -32,13 +32,11 @@ template <class T0, class T1>
struct __combined<T0, T1> {
// callable -> functor
template <class F0, class F1>
- static pythonic::types::variant_functor<F0, F1>
- get(std::integral_constant<bool, true>);
+ static pythonic::types::variant_functor<F0, F1> get(std::integral_constant<bool, true>);
// operator+ exists -> deduce type
template <class F0, class F1>
- static decltype(std::declval<F0>() +
- std::declval<F1>()) get(std::integral_constant<bool, false>);
+ static decltype(std::declval<F0>() + std::declval<F1>()) get(std::integral_constant<bool, false>);
// operator+ does not exists -> pick first one, better than error
// note that this is needed because broadcasting is too complex to be modeled
@@ -51,12 +49,11 @@ struct __combined<T0, T1> {
template <class F0, class F1>
static F0 get(...);
- using type = typename std::conditional<
+ using type = std::conditional_t<
std::is_same<T0, T1>::value, T0,
- decltype(get<T0, T1>(std::integral_constant < bool,
- pythonic::types::is_callable<T0>::value
- &&pythonic::types::is_callable<T1>::value >
- ()))>::type;
+ decltype(get<T0, T1>(
+ std::integral_constant<bool, pythonic::types::is_callable<T0>::value &&
+ pythonic::types::is_callable<T1>::value>()))>;
};
template <class T0, class T1>
@@ -68,7 +65,7 @@ struct __combined<T0, const T1> : std::add_const<typename __combined<T0, T1>::ty
};
template <class T0, class T1>
-struct __combined<T0 &, T1> : __combined<T0, T1> {
+struct __combined<T0 &, T1> : __combined<T0, T1> {
};
template <class T0, class T1>
@@ -144,71 +141,70 @@ struct __combined<const T0, const T1> : std::add_const<typename __combined<T0, T
};
template <class T0, class T1>
-struct __combined<const T0 &, const T1 &> : std::add_lvalue_reference<typename std::add_const<typename __combined<T0, T1>::type>::type> {
+struct __combined<const T0 &, const T1 &>
+ : std::add_lvalue_reference<typename std::add_const<typename __combined<T0, T1>::type>::type> {
};
template <class T>
class container
{
public:
- using value_type =
- typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+ using value_type = std::remove_cv_t<std::remove_reference_t<T>>;
private:
container();
};
-namespace std {
+namespace std
+{
template <size_t I, class T>
struct tuple_element<I, container<T>> {
using type = typename container<T>::value_type;
};
-}
+} // namespace std
template <class K, class V>
class indexable_container
{
public:
- using key_type =
- typename std::remove_cv<typename std::remove_reference<K>::type>::type;
- using value_type =
- typename std::remove_cv<typename std::remove_reference<V>::type>::type;
+ using key_type = std::remove_cv_t<std::remove_reference_t<K>>;
+ using value_type = std::remove_cv_t<std::remove_reference_t<V>>;
private:
indexable_container();
};
-namespace std {
+namespace std
+{
template <size_t I, class K, class V>
struct tuple_element<I, indexable_container<K, V>> {
using type = typename indexable_container<K, V>::value_type;
};
-}
+} // namespace std
template <class T>
class dict_container
{
public:
- using value_type =
- typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+ using value_type = std::remove_cv_t<std::remove_reference_t<T>>;
private:
dict_container();
};
-namespace std {
+namespace std
+{
template <size_t I, class T>
struct tuple_element<I, dict_container<T>> {
using type = typename dict_container<T>::value_type;
};
-}
+} // namespace std
template <class T>
class indexable
{
public:
- using type =
- typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+ using type = std::remove_cv_t<std::remove_reference_t<T>>;
private:
indexable();
@@ -218,8 +214,7 @@ template <class T>
class indexable_dict
{
public:
- using type =
- typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+ using type = std::remove_cv_t<std::remove_reference_t<T>>;
private:
indexable_dict();
@@ -227,8 +222,8 @@ private:
template <class K0, class V0, class K1, class V1>
struct __combined<indexable_container<K0, V0>, indexable_container<K1, V1>> {
- using type = indexable_container<typename __combined<K0, K1>::type,
- typename __combined<V0, V1>::type>;
+ using type =
+ indexable_container<typename __combined<K0, K1>::type, typename __combined<V0, V1>::type>;
};
template <class K, class V>
@@ -294,10 +289,10 @@ struct __combined<pythonic::types::variant_functor<Types0...>,
/* } */
/* mimic numpy behavior { */
-#define SCALAR_COMBINER(Type) \
- template <> \
- struct __combined<Type, Type> { \
- using type = Type; \
+#define SCALAR_COMBINER(Type) \
+ template <> \
+ struct __combined<Type, Type> { \
+ using type = Type; \
};
SCALAR_COMBINER(bool)
SCALAR_COMBINER(uint8_t)
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp b/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp
index 19ae86680ae..6662f2075bf 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/complex.hpp
@@ -29,12 +29,12 @@ namespace std
{
template <class T, class S>
- using complex_broadcast_t = typename std::enable_if<
- std::is_scalar<S>::value && !std::is_same<T, S>::value,
- std::complex<typename std::common_type<T, S>::type>>::type;
+ using complex_broadcast_t =
+ std::enable_if_t<std::is_scalar<S>::value && !std::is_same<T, S>::value,
+ std::complex<std::common_type_t<T, S>>>;
template <class T, class S>
- using complex_bool_t = typename std::enable_if<
- std::is_scalar<S>::value && !std::is_same<T, S>::value, bool>::type;
+ using complex_bool_t =
+ std::enable_if_t<std::is_scalar<S>::value && !std::is_same<T, S>::value, bool>;
template <class T, class S>
complex_broadcast_t<T, S> operator+(std::complex<T> self, S other);
@@ -91,12 +91,9 @@ namespace builtins
T getattr(types::attr::REAL, std::complex<T> const &self);
template <class T>
T getattr(types::attr::IMAG, std::complex<T> const &self);
- numpy::functor::complex64 getattr(types::attr::DTYPE,
- std::complex<float> const &self);
- numpy::functor::complex128 getattr(types::attr::DTYPE,
- std::complex<double> const &self);
- numpy::functor::complex256 getattr(types::attr::DTYPE,
- std::complex<long double> const &self);
+ numpy::functor::complex64 getattr(types::attr::DTYPE, std::complex<float> const &self);
+ numpy::functor::complex128 getattr(types::attr::DTYPE, std::complex<double> const &self);
+ numpy::functor::complex256 getattr(types::attr::DTYPE, std::complex<long double> const &self);
} // namespace builtins
PYTHONIC_NS_END
@@ -119,13 +116,13 @@ struct __combined<std::complex<T0>, std::complex<T1>> {
/* } */
-#define STD_COMPLEX_IMPLICT_OPERATOR_CAST(op) \
- template <class T, class U> \
- auto operator op(std::complex<T> const &lhs, std::complex<U> const &rhs) \
- ->std::complex<typename std::common_type<T, U>::type> \
- { \
- using ctype = std::complex<typename std::common_type<T, U>::type>; \
- return ctype{lhs} op ctype{rhs}; \
+#define STD_COMPLEX_IMPLICT_OPERATOR_CAST(op) \
+ template <class T, class U> \
+ auto operator op(std::complex<T> const &lhs, std::complex<U> const &rhs) \
+ ->std::complex<std::common_type_t<T, U>> \
+ { \
+ using ctype = std::complex<std::common_type_t<T, U>>; \
+ return ctype{lhs} op ctype{rhs}; \
}
STD_COMPLEX_IMPLICT_OPERATOR_CAST(+)
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/dict.hpp b/contrib/python/pythran/pythran/pythonic/include/types/dict.hpp
index 7772a2641e5..7b38bf8418e 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/dict.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/dict.hpp
@@ -31,19 +31,32 @@ namespace types
struct item_iterator_adaptator {
I base;
using difference_type = typename std::iterator_traits<I>::difference_type;
- using value_type = make_tuple_t<
- typename std::remove_cv<typename std::iterator_traits<I>::value_type::first_type>::type,
- typename std::iterator_traits<I>::value_type::second_type>;
+ using value_type =
+ make_tuple_t<std::remove_cv_t<typename std::iterator_traits<I>::value_type::first_type>,
+ typename std::iterator_traits<I>::value_type::second_type>;
using pointer = value_type *;
using reference = value_type &;
using iterator_category = typename std::iterator_traits<I>::iterator_category;
item_iterator_adaptator() = default;
item_iterator_adaptator(I const &i);
value_type operator*() const;
- bool operator==(item_iterator_adaptator const& other) const { return base == other.base;}
- bool operator!=(item_iterator_adaptator const& other) const { return base != other.base;}
- item_iterator_adaptator& operator++() { ++base; return *this;}
- auto operator->() ->decltype( &*base) { return &*base;}
+ bool operator==(item_iterator_adaptator const &other) const
+ {
+ return base == other.base;
+ }
+ bool operator!=(item_iterator_adaptator const &other) const
+ {
+ return base != other.base;
+ }
+ item_iterator_adaptator &operator++()
+ {
+ ++base;
+ return *this;
+ }
+ auto operator->() -> decltype(&*base)
+ {
+ return &*base;
+ }
};
template <class I>
@@ -57,10 +70,23 @@ namespace types
key_iterator_adaptator() = default;
key_iterator_adaptator(I const &i);
value_type operator*() const;
- bool operator==(key_iterator_adaptator const& other) const { return base == other.base;}
- bool operator!=(key_iterator_adaptator const& other) const { return base != other.base;}
- key_iterator_adaptator& operator++() { ++base; return *this;}
- auto operator->() ->decltype( &*base) { return &*base;}
+ bool operator==(key_iterator_adaptator const &other) const
+ {
+ return base == other.base;
+ }
+ bool operator!=(key_iterator_adaptator const &other) const
+ {
+ return base != other.base;
+ }
+ key_iterator_adaptator &operator++()
+ {
+ ++base;
+ return *this;
+ }
+ auto operator->() -> decltype(&*base)
+ {
+ return &*base;
+ }
};
template <class I>
@@ -74,10 +100,23 @@ namespace types
value_iterator_adaptator() = default;
value_iterator_adaptator(I const &i);
value_type operator*() const;
- bool operator==(value_iterator_adaptator const& other) const { return base == other.base;}
- bool operator!=(value_iterator_adaptator const& other) const { return base != other.base;}
- value_iterator_adaptator& operator++() { ++base; return *this;}
- auto operator->() ->decltype( &*base) { return &*base;}
+ bool operator==(value_iterator_adaptator const &other) const
+ {
+ return base == other.base;
+ }
+ bool operator!=(value_iterator_adaptator const &other) const
+ {
+ return base != other.base;
+ }
+ value_iterator_adaptator &operator++()
+ {
+ ++base;
+ return *this;
+ }
+ auto operator->() -> decltype(&*base)
+ {
+ return &*base;
+ }
};
template <class D>
@@ -134,35 +173,73 @@ namespace types
value_type data_[1];
bool empty_;
- none_type_map(size_type) : data_(), empty_(true) {}
+ none_type_map(size_type) : data_(), empty_(true)
+ {
+ }
template <class B, class E>
- none_type_map(B begin, E end) : data_{begin == end ? value_type() : *begin}, empty_(begin == end) {
+ none_type_map(B begin, E end)
+ : data_{begin == end ? value_type() : *begin}, empty_(begin == end)
+ {
}
- mapped_type& operator[](none_type) {
+ mapped_type &operator[](none_type)
+ {
empty_ = false;
return data_[0].second;
}
- iterator find(none_type) {
+ iterator find(none_type)
+ {
return data_ + empty_;
}
- const_iterator find(none_type) const {
+ const_iterator find(none_type) const
+ {
return data_ + empty_;
}
- iterator begin() { return data_ + empty_; }
- const_iterator begin() const { return data_ + empty_; }
- iterator end() { return data_ + 1; }
- const_iterator end() const { return data_ + 1; }
+ iterator begin()
+ {
+ return data_ + empty_;
+ }
+ const_iterator begin() const
+ {
+ return data_ + empty_;
+ }
+ iterator end()
+ {
+ return data_ + 1;
+ }
+ const_iterator end() const
+ {
+ return data_ + 1;
+ }
- bool empty() const { return empty_;}
- void clear() { empty_ = true; data_[0].second = {}; }
- const_iterator erase(const_iterator pos) { clear(); return end();}
- bool erase(none_type) { bool res = empty_; clear(); return !res;}
+ bool empty() const
+ {
+ return empty_;
+ }
+ void clear()
+ {
+ empty_ = true;
+ data_[0].second = {};
+ }
+ const_iterator erase(const_iterator pos)
+ {
+ clear();
+ return end();
+ }
+ bool erase(none_type)
+ {
+ bool res = empty_;
+ clear();
+ return !res;
+ }
- size_t size() const { return empty_?0:1;}
+ size_t size() const
+ {
+ return empty_ ? 0 : 1;
+ }
};
template <class K, class V>
@@ -170,15 +247,12 @@ namespace types
{
// data holder
- using _key_type =
- typename std::remove_cv<typename std::remove_reference<K>::type>::type;
- using _value_type =
- typename std::remove_cv<typename std::remove_reference<V>::type>::type;
- using container_type = typename std::conditional<std::is_same<K, none_type>::value,
- none_type_map<_value_type>,
- std::unordered_map<
- _key_type, _value_type, std::hash<_key_type>, std::equal_to<_key_type>,
- utils::allocator<std::pair<const _key_type, _value_type>>>>::type;
+ using _key_type = std::remove_cv_t<std::remove_reference_t<K>>;
+ using _value_type = std::remove_cv_t<std::remove_reference_t<V>>;
+ using container_type = std::conditional_t<
+ std::is_same<K, none_type>::value, none_type_map<_value_type>,
+ std::unordered_map<_key_type, _value_type, std::hash<_key_type>, std::equal_to<_key_type>,
+ utils::allocator<std::pair<const _key_type, _value_type>>>>;
utils::shared_ref<container_type> data;
template <class Kp, class Vp>
@@ -188,20 +262,20 @@ namespace types
// types
using reference = typename container_type::reference;
using const_reference = typename container_type::const_reference;
- using iterator = utils::comparable_iterator<
- key_iterator_adaptator<typename container_type::iterator>>;
- using const_iterator = utils::comparable_iterator<
- key_iterator_adaptator<typename container_type::const_iterator>>;
- using item_iterator = utils::comparable_iterator<
- item_iterator_adaptator<typename container_type::iterator>>;
+ using iterator =
+ utils::comparable_iterator<key_iterator_adaptator<typename container_type::iterator>>;
+ using const_iterator =
+ utils::comparable_iterator<key_iterator_adaptator<typename container_type::const_iterator>>;
+ using item_iterator =
+ utils::comparable_iterator<item_iterator_adaptator<typename container_type::iterator>>;
using item_const_iterator = utils::comparable_iterator<
item_iterator_adaptator<typename container_type::const_iterator>>;
- using key_iterator = utils::comparable_iterator<
- key_iterator_adaptator<typename container_type::iterator>>;
- using key_const_iterator = utils::comparable_iterator<
- key_iterator_adaptator<typename container_type::const_iterator>>;
- using value_iterator = utils::comparable_iterator<
- value_iterator_adaptator<typename container_type::iterator>>;
+ using key_iterator =
+ utils::comparable_iterator<key_iterator_adaptator<typename container_type::iterator>>;
+ using key_const_iterator =
+ utils::comparable_iterator<key_iterator_adaptator<typename container_type::const_iterator>>;
+ using value_iterator =
+ utils::comparable_iterator<value_iterator_adaptator<typename container_type::iterator>>;
using value_const_iterator = utils::comparable_iterator<
value_iterator_adaptator<typename container_type::const_iterator>>;
using size_type = typename container_type::size_type;
@@ -334,8 +408,7 @@ namespace types
template <class K, class V>
struct assignable<types::dict<K, V>> {
- using type =
- types::dict<typename assignable<K>::type, typename assignable<V>::type>;
+ using type = types::dict<typename assignable<K>::type, typename assignable<V>::type>;
};
std::ostream &operator<<(std::ostream &os, types::empty_dict const &);
@@ -388,57 +461,45 @@ struct __combined<pythonic::types::dict<C, B>, container<A>> {
template <class T>
struct __combined<pythonic::types::empty_dict, pythonic::types::list<T>> {
- using type = pythonic::types::dict<typename std::tuple_element<0, T>::type,
- typename std::tuple_element<1, T>::type>;
+ using type = pythonic::types::dict<std::tuple_element_t<0, T>, std::tuple_element_t<1, T>>;
};
template <class T, size_t N>
-struct __combined<pythonic::types::empty_dict,
- pythonic::types::static_list<T, N>> {
- using type = pythonic::types::dict<typename std::tuple_element<0, T>::type,
- typename std::tuple_element<1, T>::type>;
+struct __combined<pythonic::types::empty_dict, pythonic::types::static_list<T, N>> {
+ using type = pythonic::types::dict<std::tuple_element_t<0, T>, std::tuple_element_t<1, T>>;
};
template <class T>
struct __combined<pythonic::types::list<T>, pythonic::types::empty_dict> {
- using type = pythonic::types::dict<typename std::tuple_element<0, T>::type,
- typename std::tuple_element<1, T>::type>;
+ using type = pythonic::types::dict<std::tuple_element_t<0, T>, std::tuple_element_t<1, T>>;
};
template <class T, size_t N>
-struct __combined<pythonic::types::static_list<T, N>,
- pythonic::types::empty_dict> {
- using type = pythonic::types::dict<typename std::tuple_element<0, T>::type,
- typename std::tuple_element<1, T>::type>;
+struct __combined<pythonic::types::static_list<T, N>, pythonic::types::empty_dict> {
+ using type = pythonic::types::dict<std::tuple_element_t<0, T>, std::tuple_element_t<1, T>>;
};
template <class K0, class V0, class T>
struct __combined<pythonic::types::dict<K0, V0>, pythonic::types::list<T>> {
- using type = pythonic::types::dict<
- typename __combined<K0, typename std::tuple_element<0, T>::type>::type,
- typename __combined<V0, typename std::tuple_element<1, T>::type>::type>;
+ using type = pythonic::types::dict<typename __combined<K0, std::tuple_element_t<0, T>>::type,
+ typename __combined<V0, std::tuple_element_t<1, T>>::type>;
};
template <class K0, class V0, class T, size_t N>
-struct __combined<pythonic::types::dict<K0, V0>,
- pythonic::types::static_list<T, N>> {
- using type = pythonic::types::dict<
- typename __combined<K0, typename std::tuple_element<0, T>::type>::type,
- typename __combined<V0, typename std::tuple_element<1, T>::type>::type>;
+struct __combined<pythonic::types::dict<K0, V0>, pythonic::types::static_list<T, N>> {
+ using type = pythonic::types::dict<typename __combined<K0, std::tuple_element_t<0, T>>::type,
+ typename __combined<V0, std::tuple_element_t<1, T>>::type>;
};
template <class K0, class V0, class T>
struct __combined<pythonic::types::list<T>, pythonic::types::dict<K0, V0>> {
- using type = pythonic::types::dict<
- typename __combined<K0, typename std::tuple_element<0, T>::type>::type,
- typename __combined<V0, typename std::tuple_element<1, T>::type>::type>;
+ using type = pythonic::types::dict<typename __combined<K0, std::tuple_element_t<0, T>>::type,
+ typename __combined<V0, std::tuple_element_t<1, T>>::type>;
};
template <class K0, class V0, class T, size_t N>
-struct __combined<pythonic::types::static_list<T, N>,
- pythonic::types::dict<K0, V0>> {
- using type = pythonic::types::dict<
- typename __combined<K0, typename std::tuple_element<0, T>::type>::type,
- typename __combined<V0, typename std::tuple_element<1, T>::type>::type>;
+struct __combined<pythonic::types::static_list<T, N>, pythonic::types::dict<K0, V0>> {
+ using type = pythonic::types::dict<typename __combined<K0, std::tuple_element_t<0, T>>::type,
+ typename __combined<V0, std::tuple_element_t<1, T>>::type>;
};
template <class K>
@@ -488,14 +549,14 @@ struct __combined<pythonic::types::empty_dict, indexable_container<K, V>> {
template <class K0, class V0, class K1, class V1>
struct __combined<pythonic::types::dict<K0, V0>, indexable_container<K1, V1>> {
- using type = pythonic::types::dict<typename __combined<K0, K1>::type,
- typename __combined<V0, V1>::type>;
+ using type =
+ pythonic::types::dict<typename __combined<K0, K1>::type, typename __combined<V0, V1>::type>;
};
template <class K0, class V0, class K1, class V1>
struct __combined<indexable_container<K1, V1>, pythonic::types::dict<K0, V0>> {
- using type = pythonic::types::dict<typename __combined<K0, K1>::type,
- typename __combined<V0, V1>::type>;
+ using type =
+ pythonic::types::dict<typename __combined<K0, K1>::type, typename __combined<V0, V1>::type>;
};
template <class K, class V>
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp b/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp
index 0db63dcff6f..72de31be8b5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/dynamic_tuple.hpp
@@ -33,14 +33,11 @@ namespace types
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using reverse_iterator = typename container_type::reverse_iterator;
- using const_reverse_iterator =
- typename container_type::const_reverse_iterator;
+ using const_reverse_iterator = typename container_type::const_reverse_iterator;
// minimal ndarray interface
- using dtype =
- typename utils::nested_container_value_type<dynamic_tuple>::type;
- static const size_t value =
- utils::nested_container_depth<dynamic_tuple>::value;
+ using dtype = typename utils::nested_container_value_type<dynamic_tuple>::type;
+ static const size_t value = utils::nested_container_depth<dynamic_tuple>::value;
static const bool is_vectorizable = true;
static const bool is_strided = false;
@@ -157,8 +154,7 @@ namespace types
else {
dynamic_tuple res;
res.data->reserve(ns.size());
- for (auto i = ns.lower, step = ns.step, n = ns.upper; i != n;
- i += step) {
+ for (auto i = ns.lower, step = ns.step, n = ns.upper; i != n; i += step) {
res.data->emplace_back(fast(i));
}
return res;
@@ -173,8 +169,7 @@ namespace types
using shape_t = typename shape_builder<dynamic_tuple, value>::type;
template <size_t I>
- auto shape() const -> decltype(details::extract_shape(*this,
- utils::int_<I>{}))
+ auto shape() const -> decltype(details::extract_shape(*this, utils::int_<I>{}))
{
return details::extract_shape(*this, utils::int_<I>{});
}
@@ -217,15 +212,13 @@ namespace std
}
template <size_t I, class T>
- typename pythonic::types::dynamic_tuple<T>::reference
- get(pythonic::types::dynamic_tuple<T> &t)
+ typename pythonic::types::dynamic_tuple<T>::reference get(pythonic::types::dynamic_tuple<T> &t)
{
return t[I];
}
template <size_t I, class T>
- typename pythonic::types::dynamic_tuple<T>::reference
- get(pythonic::types::dynamic_tuple<T> &&t)
+ typename pythonic::types::dynamic_tuple<T>::reference get(pythonic::types::dynamic_tuple<T> &&t)
{
return t[I];
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp b/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp
index 3cdb832ece1..5c168fd3e1f 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/exceptions.hpp
@@ -24,17 +24,17 @@ namespace types
};
// Use this to create a python exception class
-#define CLASS_EXCEPTION_DECL(name, parent) \
- class name : public parent \
- { \
- public: \
- name() = default; \
- name(const name &e) = default; \
- template <class... Types> \
- name(Types const &...types) : parent(types...) \
- { \
- } \
- virtual ~name() noexcept = default; \
+#define CLASS_EXCEPTION_DECL(name, parent) \
+ class name : public parent \
+ { \
+ public: \
+ name() = default; \
+ name(const name &e) = default; \
+ template <class... Types> \
+ name(Types const &...types) : parent(types...) \
+ { \
+ } \
+ virtual ~name() noexcept = default; \
};
CLASS_EXCEPTION_DECL(SystemExit, BaseException);
@@ -88,34 +88,32 @@ namespace types
PYTHONIC_NS_END
#include "pythonic/include/utils/functor.hpp"
-#define PYTHONIC_EXCEPTION_DECL(name) \
- template <typename... Types> \
- types::name name(Types const &...args); \
- \
+#define PYTHONIC_EXCEPTION_DECL(name) \
+ template <typename... Types> \
+ types::name name(Types const &...args); \
+ \
DEFINE_FUNCTOR(pythonic::builtins, name);
/* pythran attribute system { */
-#define DECLARE_EXCEPTION_GETATTR(name) \
- PYTHONIC_NS_BEGIN \
- namespace builtins \
- { \
- types::none<types::dynamic_tuple<types::str>> \
- getattr(types::attr::ARGS, types::name const &f); \
- } \
+#define DECLARE_EXCEPTION_GETATTR(name) \
+ PYTHONIC_NS_BEGIN \
+ namespace builtins \
+ { \
+ types::none<types::dynamic_tuple<types::str>> getattr(types::attr::ARGS, \
+ types::name const &f); \
+ } \
PYTHONIC_NS_END
-#define DECLARE_EXCEPTION_GETATTR_FULL(name) \
- PYTHONIC_NS_BEGIN \
- namespace builtins \
- { \
- types::none<types::dynamic_tuple<types::str>> \
- getattr(types::attr::ARGS, types::name const &e); \
- types::none<types::str> getattr(types::attr::ERRNO, types::name const &e); \
- types::none<types::str> getattr(types::attr::STRERROR, \
- types::name const &e); \
- types::none<types::str> getattr(types::attr::FILENAME, \
- types::name const &e); \
- } \
+#define DECLARE_EXCEPTION_GETATTR_FULL(name) \
+ PYTHONIC_NS_BEGIN \
+ namespace builtins \
+ { \
+ types::none<types::dynamic_tuple<types::str>> getattr(types::attr::ARGS, \
+ types::name const &e); \
+ types::none<types::str> getattr(types::attr::ERRNO, types::name const &e); \
+ types::none<types::str> getattr(types::attr::STRERROR, types::name const &e); \
+ types::none<types::str> getattr(types::attr::FILENAME, types::name const &e); \
+ } \
PYTHONIC_NS_END
DECLARE_EXCEPTION_GETATTR(BaseException);
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/file.hpp b/contrib/python/pythran/pythran/pythonic/include/types/file.hpp
index 7d192c9a9de..8e50d50aa59 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/file.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/file.hpp
@@ -18,9 +18,8 @@ namespace types
{
class file;
- struct file_iterator
- : std::iterator<std::forward_iterator_tag, types::str, ptrdiff_t,
- types::str *, types::str /* no ref */> {
+ struct file_iterator : std::iterator<std::forward_iterator_tag, types::str, ptrdiff_t,
+ types::str *, types::str /* no ref */> {
private:
file *f;
mutable bool set;
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp b/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp
index f15b2acc577..7f14333027d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/finfo.hpp
@@ -26,8 +26,7 @@ PYTHONIC_NS_BEGIN
namespace builtins
{
template <class T>
- auto getattr(types::attr::EPS,
- pythonic::types::finfo<T> const &f) -> decltype(f.eps());
+ auto getattr(types::attr::EPS, pythonic::types::finfo<T> const &f) -> decltype(f.eps());
}
PYTHONIC_NS_END
/* } */
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp b/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp
index 85998cccb52..3870b3254fe 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/generator.hpp
@@ -10,9 +10,8 @@ namespace types
{
template <class T>
struct generator_iterator
- : std::iterator<std::forward_iterator_tag, typename T::result_type,
- ptrdiff_t, typename T::result_type *,
- typename T::result_type /* no ref */> {
+ : std::iterator<std::forward_iterator_tag, typename T::result_type, ptrdiff_t,
+ typename T::result_type *, typename T::result_type /* no ref */> {
T the_generator;
generator_iterator();
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp b/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp
index 7b8de529d4c..f3960f92343 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/immediate.hpp
@@ -17,8 +17,7 @@ namespace types
return Val;
}
- template <class U, U Wal,
- class _ = typename std::enable_if<Val == (T)Wal, void>::type>
+ template <class U, U Wal, class _ = std::enable_if_t<Val == (T)Wal, void>>
immediate(std::integral_constant<U, Wal>)
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/int.hpp b/contrib/python/pythran/pythran/pythonic/include/types/int.hpp
index 40a53da2146..228644477db 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/int.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/int.hpp
@@ -7,11 +7,9 @@ PYTHONIC_NS_BEGIN
namespace builtins
{
template <class T>
- typename std::enable_if<std::is_integral<T>::value, T>::value
- getattr(types::attr::REAL, T self);
+ typename std::enable_if<std::is_integral<T>::value, T>::value getattr(types::attr::REAL, T self);
template <class T>
- typename std::enable_if<std::is_integral<T>::value, T>::value
- getattr(types::attr::IMAG, T self);
+ typename std::enable_if<std::is_integral<T>::value, T>::value getattr(types::attr::IMAG, T self);
} // namespace builtins
PYTHONIC_NS_END
#ifdef ENABLE_PYTHON_MODULE
@@ -20,10 +18,10 @@ PYTHONIC_NS_END
PYTHONIC_NS_BEGIN
-#define PYTHONIC_INT_TO_PYTHON(TYPE) \
- template <> \
- struct to_python<TYPE> { \
- static PyObject *convert(TYPE l); \
+#define PYTHONIC_INT_TO_PYTHON(TYPE) \
+ template <> \
+ struct to_python<TYPE> { \
+ static PyObject *convert(TYPE l); \
}
PYTHONIC_INT_TO_PYTHON(char);
@@ -40,11 +38,11 @@ PYTHONIC_INT_TO_PYTHON(signed long long);
#undef PYTHONIC_INT_TO_PYTHON
-#define PYTHONIC_INT_FROM_PYTHON(TYPE) \
- template <> \
- struct from_python<TYPE> { \
- static bool is_convertible(PyObject *obj); \
- static TYPE convert(PyObject *obj); \
+#define PYTHONIC_INT_FROM_PYTHON(TYPE) \
+ template <> \
+ struct from_python<TYPE> { \
+ static bool is_convertible(PyObject *obj); \
+ static TYPE convert(PyObject *obj); \
}
PYTHONIC_INT_FROM_PYTHON(unsigned char);
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp b/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp
index 13680b0c1a2..b6cb4644c91 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/lazy.hpp
@@ -8,13 +8,12 @@ namespace types
template <class T>
using lazy_res_t = decltype((std::declval<T>()()));
template <class T>
- using lazy_res_decay_t = typename std::decay<lazy_res_t<T>>::type;
+ using lazy_res_decay_t = std::decay_t<lazy_res_t<T>>;
template <class T0, class T1>
- using lazy_combined_t = typename std::conditional<
- std::is_same<lazy_res_t<T0>, lazy_res_t<T1>>::value, lazy_res_t<T0>,
- typename __combined<lazy_res_decay_t<T0>,
- lazy_res_decay_t<T1>>::type>::type;
+ using lazy_combined_t =
+ std::conditional_t<std::is_same<lazy_res_t<T0>, lazy_res_t<T1>>::value, lazy_res_t<T0>,
+ typename __combined<lazy_res_decay_t<T0>, lazy_res_decay_t<T1>>::type>;
} // namespace types
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/list.hpp b/contrib/python/pythran/pythran/pythonic/include/types/list.hpp
index 5d5d939aaab..61e304452ae 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/list.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/list.hpp
@@ -43,9 +43,7 @@ namespace types
{
// data holder
- typedef
- typename std::remove_cv<typename std::remove_reference<T>::type>::type
- _type;
+ using _type = std::remove_cv_t<std::remove_reference_t<T>>;
typedef container<_type> container_type;
utils::shared_ref<container_type> _data;
@@ -67,25 +65,20 @@ namespace types
typedef typename container_type::pointer pointer;
typedef typename container_type::const_pointer const_pointer;
typedef typename container_type::reverse_iterator reverse_iterator;
- typedef
- typename container_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename container_type::const_reverse_iterator const_reverse_iterator;
// minimal ndarray interface
- typedef
- typename utils::nested_container_value_type<sliced_list>::type dtype;
- static const size_t value =
- utils::nested_container_depth<sliced_list>::value;
+ typedef typename utils::nested_container_value_type<sliced_list>::type dtype;
+ static const size_t value = utils::nested_container_depth<sliced_list>::value;
static_assert(value != 0, "valid shape");
static const bool is_vectorizable =
- types::is_vectorizable_dtype<dtype>::value &&
- !std::is_same<S, slice>::value;
+ types::is_vectorizable_dtype<dtype>::value && !std::is_same<S, slice>::value;
static const bool is_flat = std::is_same<slice, S>::value;
static const bool is_strided = std::is_same<slice, S>::value;
using shape_t = types::array_tuple<long, value>;
template <size_t I>
- auto shape() const -> decltype(details::extract_shape(*this,
- utils::int_<I>{}))
+ auto shape() const -> decltype(details::extract_shape(*this, utils::int_<I>{}))
{
return details::extract_shape(*this, utils::int_<I>{});
}
@@ -104,8 +97,7 @@ namespace types
template <size_t N, class V>
list<T> operator+(array_base<T, N, V> const &) const;
template <class Tp, class Sp>
- list<typename __combined<T, Tp>::type>
- operator+(sliced_list<Tp, Sp> const &) const;
+ list<typename __combined<T, Tp>::type> operator+(sliced_list<Tp, Sp> const &) const;
// iterators
iterator begin();
@@ -122,9 +114,8 @@ namespace types
const_reference operator[](long i) const;
reference operator[](long i);
template <class Sp>
- typename std::enable_if<
- is_slice<Sp>::value,
- sliced_list<T, decltype(std::declval<S>() * std::declval<Sp>())>>::type
+ std::enable_if_t<is_slice<Sp>::value,
+ sliced_list<T, decltype(std::declval<S>() * std::declval<Sp>())>>
operator[](Sp s) const;
template <class... Indices>
@@ -163,8 +154,7 @@ namespace types
long count(T const &x) const;
template <class Tp, class Sp>
- friend std::ostream &operator<<(std::ostream &os,
- sliced_list<Tp, Sp> const &v);
+ friend std::ostream &operator<<(std::ostream &os, sliced_list<Tp, Sp> const &v);
};
/* list */
@@ -174,9 +164,7 @@ namespace types
static constexpr size_t DEFAULT_CAPACITY = 16;
// data holder
- typedef
- typename std::remove_cv<typename std::remove_reference<T>::type>::type
- _type;
+ using _type = std::remove_cv_t<std::remove_reference_t<T>>;
typedef container<_type> container_type;
utils::shared_ref<container_type> _data;
@@ -199,8 +187,7 @@ namespace types
typedef typename container_type::pointer pointer;
typedef typename container_type::const_pointer const_pointer;
typedef typename container_type::reverse_iterator reverse_iterator;
- typedef
- typename container_type::const_reverse_iterator const_reverse_iterator;
+ typedef typename container_type::const_reverse_iterator const_reverse_iterator;
// minimal ndarray interface
typedef typename utils::nested_container_value_type<list>::type dtype;
@@ -227,8 +214,7 @@ namespace types
{
}
template <class Tp, size_t N, class... S>
- list(numpy_gexpr<static_list<Tp, N>, S...> const &other)
- : list(other.begin(), other.end())
+ list(numpy_gexpr<static_list<Tp, N>, S...> const &other) : list(other.begin(), other.end())
{
}
list<T> &operator=(list<T> &&other);
@@ -242,8 +228,7 @@ namespace types
list<T> &operator=(sliced_list<Tp, S> const &other);
template <class pS>
- list &
- operator=(ndarray<T, pshape<pS>> const &); // implemented in ndarray.hpp
+ list &operator=(ndarray<T, pshape<pS>> const &); // implemented in ndarray.hpp
template <class S>
list<T> &operator+=(sliced_list<T, S> const &other);
@@ -296,8 +281,7 @@ namespace types
const_reference operator[](long n) const;
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value, sliced_list<T, Sp>>::type
- operator[](Sp const &s) const;
+ std::enable_if_t<is_slice<Sp>::value, sliced_list<T, Sp>> operator[](Sp const &s) const;
template <class... Indices>
dtype load(long index0, long index1, Indices... indices) const
@@ -346,8 +330,7 @@ namespace types
list<typename __combined<T, F>::type> operator+(list<F> const &s) const;
template <class F, class S>
- list<decltype(std::declval<T>() +
- std::declval<typename sliced_list<F, S>::value_type>())>
+ list<decltype(std::declval<T>() + std::declval<typename sliced_list<F, S>::value_type>())>
operator+(sliced_list<F, S> const &s) const;
list<T> operator+(empty_list const &) const;
@@ -403,8 +386,8 @@ namespace types
}
template <class T0, size_t N, class T1>
- list<typename __combined<T0, T1>::type>
- operator+(static_list<T0, N> const &l0, list<T1> const &l1)
+ list<typename __combined<T0, T1>::type> operator+(static_list<T0, N> const &l0,
+ list<T1> const &l1)
{
list<typename __combined<T0, T1>::type> out(l0.begin(), l0.end());
return out += l1;
@@ -434,9 +417,7 @@ namespace types
static_list<T, N> operator+(array_base<T, N, V> const &s) const;
empty_list operator+(empty_list const &) const;
template <class F>
- typename std::enable_if<!is_numexpr_arg<F>::value,
- list<typename F::value_type>>::type
- operator+(F s) const;
+ std::enable_if_t<!is_numexpr_arg<F>::value, list<typename F::value_type>> operator+(F s) const;
explicit operator bool() const;
template <class T>
operator list<T>() const;
@@ -457,8 +438,7 @@ namespace types
return {};
}
template <class S>
- typename std::enable_if<is_slice<S>::value, empty_list>::type
- operator[](S) const
+ std::enable_if_t<is_slice<S>::value, empty_list> operator[](S) const
{
return {};
}
@@ -491,8 +471,7 @@ namespace utils
* const_iterator type.
*/
template <class T, class From>
- void reserve(types::list<T> &l, From const &f,
- typename From::const_iterator *p = nullptr);
+ void reserve(types::list<T> &l, From const &f, typename From::const_iterator *p = nullptr);
} // namespace utils
template <class T>
@@ -519,16 +498,13 @@ namespace std
typename pythonic::types::list<T>::reference get(pythonic::types::list<T> &t);
template <size_t I, class T>
- typename pythonic::types::list<T>::const_reference
- get(pythonic::types::list<T> const &t);
+ typename pythonic::types::list<T>::const_reference get(pythonic::types::list<T> const &t);
template <size_t I, class T>
- typename pythonic::types::list<T>::value_type
- get(pythonic::types::list<T> &&t);
+ typename pythonic::types::list<T>::value_type get(pythonic::types::list<T> &&t);
template <size_t I, class T, class S>
- typename pythonic::types::sliced_list<T, S>::reference
- get(pythonic::types::sliced_list<T, S> &t);
+ typename pythonic::types::sliced_list<T, S>::reference get(pythonic::types::sliced_list<T, S> &t);
template <size_t I, class T, class S>
typename pythonic::types::sliced_list<T, S>::const_reference
@@ -607,45 +583,37 @@ struct __combined<pythonic::types::list<T0>, pythonic::types::list<T1>> {
};
template <class T, class S>
-struct __combined<pythonic::types::sliced_list<T, S>,
- pythonic::types::empty_list> {
+struct __combined<pythonic::types::sliced_list<T, S>, pythonic::types::empty_list> {
typedef pythonic::types::list<T> type;
};
template <class T, class S>
-struct __combined<pythonic::types::empty_list,
- pythonic::types::sliced_list<T, S>> {
+struct __combined<pythonic::types::empty_list, pythonic::types::sliced_list<T, S>> {
typedef pythonic::types::list<T> type;
};
template <class T0, class T1, class S>
-struct __combined<pythonic::types::sliced_list<T1, S>,
- pythonic::types::list<T0>> {
+struct __combined<pythonic::types::sliced_list<T1, S>, pythonic::types::list<T0>> {
typedef pythonic::types::list<typename __combined<T0, T1>::type> type;
};
template <class T0, class T1, class S>
-struct __combined<pythonic::types::list<T0>,
- pythonic::types::sliced_list<T1, S>> {
+struct __combined<pythonic::types::list<T0>, pythonic::types::sliced_list<T1, S>> {
typedef pythonic::types::list<typename __combined<T0, T1>::type> type;
};
template <class T, size_t N, class V>
-struct __combined<pythonic::types::array_base<T, N, V>,
- pythonic::types::empty_list> {
+struct __combined<pythonic::types::array_base<T, N, V>, pythonic::types::empty_list> {
typedef pythonic::types::list<T> type;
};
template <class T, size_t N, class V>
-struct __combined<pythonic::types::empty_list,
- pythonic::types::array_base<T, N, V>> {
+struct __combined<pythonic::types::empty_list, pythonic::types::array_base<T, N, V>> {
typedef pythonic::types::list<T> type;
};
template <class T, size_t N, class V, class Tp>
-struct __combined<pythonic::types::array_base<T, N, V>,
- pythonic::types::list<Tp>> {
+struct __combined<pythonic::types::array_base<T, N, V>, pythonic::types::list<Tp>> {
typedef pythonic::types::list<typename __combined<T, Tp>::type> type;
};
template <class T, size_t N, class V, class Tp>
-struct __combined<pythonic::types::list<Tp>,
- pythonic::types::array_base<T, N, V>> {
+struct __combined<pythonic::types::list<Tp>, pythonic::types::array_base<T, N, V>> {
typedef pythonic::types::list<typename __combined<T, Tp>::type> type;
};
@@ -662,11 +630,10 @@ struct to_python<typename std::vector<bool>::reference> {
struct phantom_type; // ghost don't exist
template <>
-struct to_python<typename std::conditional<
- std::is_same<bool, typename std::vector<bool>::const_reference>::value,
- phantom_type, typename std::vector<bool>::const_reference>::type> {
- static PyObject *
- convert(typename std::vector<bool>::const_reference const &v);
+struct to_python<
+ std::conditional_t<std::is_same<bool, typename std::vector<bool>::const_reference>::value,
+ phantom_type, typename std::vector<bool>::const_reference>> {
+ static PyObject *convert(typename std::vector<bool>::const_reference const &v);
};
template <typename T>
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp
index fff23b7522d..7b3f4759a51 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/ndarray.hpp
@@ -17,12 +17,12 @@
#include "pythonic/include/types/tuple.hpp"
#include "pythonic/include/numpy/bool_.hpp"
-#include "pythonic/include/numpy/complex256.hpp"
#include "pythonic/include/numpy/complex128.hpp"
+#include "pythonic/include/numpy/complex256.hpp"
#include "pythonic/include/numpy/complex64.hpp"
+#include "pythonic/include/numpy/float128.hpp"
#include "pythonic/include/numpy/float32.hpp"
#include "pythonic/include/numpy/float64.hpp"
-#include "pythonic/include/numpy/float128.hpp"
#include "pythonic/include/numpy/int16.hpp"
#include "pythonic/include/numpy/int32.hpp"
#include "pythonic/include/numpy/int64.hpp"
@@ -128,8 +128,7 @@ namespace types
template <class S, class Iter>
static T *initialize_from_iterable(S &shape, T *from, Iter &&iter);
- static numpy_iexpr<ndarray<T, pS> const &> get(ndarray<T, pS> const &self,
- long i);
+ static numpy_iexpr<ndarray<T, pS> const &> get(ndarray<T, pS> const &self, long i);
};
template <class T, class pS>
@@ -142,8 +141,7 @@ namespace types
type_helper() = delete; // Not intended to be instantiated
static iterator make_iterator(ndarray<T, pshape<pS>> &n, long i);
- static const_iterator make_iterator(ndarray<T, pshape<pS>> const &n,
- long i);
+ static const_iterator make_iterator(ndarray<T, pshape<pS>> const &n, long i);
template <class S, class Iter>
static T *initialize_from_iterable(S &shape, T *from, Iter &&iter);
@@ -161,8 +159,7 @@ namespace types
type_helper() = delete; // Not intended to be instantiated
static iterator make_iterator(ndarray<T, pshape<pS>> &n, long i);
- static const_iterator make_iterator(ndarray<T, pshape<pS>> const &n,
- long i);
+ static const_iterator make_iterator(ndarray<T, pshape<pS>> const &n, long i);
template <class S, class Iter>
static T *initialize_from_iterable(S &shape, T *from, Iter &&iter);
@@ -179,8 +176,7 @@ namespace types
type_helper() = delete; // Not intended to be instantiated
static iterator make_iterator(ndarray<T, array_tuple<pS, 1>> &n, long i);
- static const_iterator make_iterator(ndarray<T, array_tuple<pS, 1>> const &n,
- long i);
+ static const_iterator make_iterator(ndarray<T, array_tuple<pS, 1>> const &n, long i);
template <class S, class Iter>
static T *initialize_from_iterable(S &shape, T *from, Iter &&iter);
@@ -198,8 +194,7 @@ namespace types
type_helper() = delete; // Not intended to be instantiated
static iterator make_iterator(ndarray<T, array_tuple<pS, 1>> &n, long i);
- static const_iterator make_iterator(ndarray<T, array_tuple<pS, 1>> const &n,
- long i);
+ static const_iterator make_iterator(ndarray<T, array_tuple<pS, 1>> const &n, long i);
template <class S, class Iter>
static T *initialize_from_iterable(S &shape, T *from, Iter &&iter);
@@ -234,16 +229,14 @@ namespace types
using const_flat_iterator = T const *;
using shape_t = pS;
- static_assert(std::tuple_size<shape_t>::value == value,
- "consistent shape size");
+ static_assert(std::tuple_size<shape_t>::value == value, "consistent shape size");
/* members */
utils::shared_ref<raw_array<T>> mem; // shared data pointer
- T *buffer; // pointer to the first data stored in the equivalent flat
- // array
- shape_t _shape; // shape of the multidimensional array
- sutils::concat_t<types::array_tuple<long, value - 1>,
- pshape<std::integral_constant<long, 1>>>
+ T *buffer; // pointer to the first data stored in the equivalent flat
+ // array
+ shape_t _shape; // shape of the multidimensional array
+ sutils::concat_t<types::array_tuple<long, value - 1>, pshape<std::integral_constant<long, 1>>>
_strides; // strides
/* mem management */
@@ -286,15 +279,11 @@ namespace types
ndarray(T *data, pS const &pshape, PyObject *obj);
#endif
- template <
- class Iterable,
- class = typename std::enable_if<
- !is_array<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>::value &&
- is_iterable<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>::
- value,
- void>::type>
+ template <class Iterable,
+ class = std::enable_if_t<
+ !is_array<std::remove_cv_t<std::remove_reference_t<Iterable>>>::value &&
+ is_iterable<std::remove_cv_t<std::remove_reference_t<Iterable>>>::value,
+ void>>
ndarray(Iterable &&iterable);
/* from a numpy expression */
@@ -348,8 +337,7 @@ namespace types
{
static_assert(is_dtype<E>::value, "valid store");
*(buffer + noffset<std::tuple_size<pS>::value>{}(
- *this, array_tuple<long, value>{{indices...}})) =
- static_cast<E>(elt);
+ *this, array_tuple<long, value>{{indices...}})) = static_cast<E>(elt);
}
template <class... Indices>
dtype load(Indices... indices) const
@@ -362,44 +350,37 @@ namespace types
void update(E elt, Indices... indices) const
{
static_assert(is_dtype<E>::value, "valid store");
- Op{}(*(buffer + noffset<std::tuple_size<pS>::value>{}(
- *this, array_tuple<long, value>{{indices...}})),
+ Op{}(*(buffer +
+ noffset<std::tuple_size<pS>::value>{}(*this, array_tuple<long, value>{{indices...}})),
static_cast<E>(elt));
}
/* element indexing
* differentiate const from non const, && r-value from l-value
* */
- auto fast(
- long i) const & -> decltype(type_helper<ndarray const &>::get(*this, i))
+ auto fast(long i) const & -> decltype(type_helper<ndarray const &>::get(*this, i))
{
return type_helper<ndarray const &>::get(*this, i);
}
- auto fast(long i) && -> decltype(type_helper<ndarray>::get(std::move(*this),
- i))
+ auto fast(long i) && -> decltype(type_helper<ndarray>::get(std::move(*this), i))
{
return type_helper<ndarray>::get(std::move(*this), i);
}
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T &>::type
- fast(array_tuple<Ty, value> const &indices);
+ std::enable_if_t<std::is_integral<Ty>::value, T &> fast(array_tuple<Ty, value> const &indices);
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T>::type
+ std::enable_if_t<std::is_integral<Ty>::value, T>
fast(array_tuple<Ty, value> const &indices) const;
template <class Ty, size_t M>
- auto fast(array_tuple<Ty, M> const &indices) const & ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>().fast(*this,
- indices))>::type;
+ auto fast(array_tuple<Ty, M> const &indices) const & -> std::enable_if_t<
+ std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(*this, indices))>;
template <class Ty, size_t M>
- auto fast(array_tuple<Ty, M> const &indices) && ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>().fast(std::move(*this),
- indices))>::type;
+ auto fast(array_tuple<Ty, M> const &indices) && -> std::enable_if_t<
+ std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(std::move(*this), indices))>;
#ifdef USE_XSIMD
using simd_iterator = const_simd_nditerator<ndarray>;
@@ -430,89 +411,71 @@ namespace types
operator[](none_type) const;
template <class S>
- typename std::enable_if<is_slice<S>::value,
- numpy_gexpr<ndarray const &, normalize_t<S>>>::type
+ std::enable_if_t<is_slice<S>::value, numpy_gexpr<ndarray const &, normalize_t<S>>>
operator[](S const &s) const &;
template <class S>
- typename std::enable_if<is_slice<S>::value,
- numpy_gexpr<ndarray, normalize_t<S>>>::type
+ std::enable_if_t<is_slice<S>::value, numpy_gexpr<ndarray, normalize_t<S>>>
operator[](S const &s) &&;
long size() const;
/* extended slice indexing */
template <class Ty>
- auto operator()(Ty s) const ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype((*this)[s])>::type
+ auto operator()(Ty s) const
+ -> std::enable_if_t<std::is_integral<Ty>::value, decltype((*this)[s])>
{
return (*this)[s];
}
template <class S0, class... S>
auto operator()(S0 const &s0, S const &...s)
- const & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}(
- (*this), s0, s...));
+ const & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...));
template <class S0, class... S>
auto operator()(S0 const &s0, S const &...s)
- & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this),
- s0,
- s...));
+ & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...));
template <class S0, class... S>
auto operator()(S0 const &s0, S const &...s)
- && -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}(
- std::move(*this), s0, s...));
+ && -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}(std::move(*this), s0,
+ s...));
/* element filtering */
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- F::value != 1 && !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pshape<long>>,
- ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pshape<long>>, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- F::value != 1 && !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pshape<long>>,
- ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pshape<long>>, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray, F>>
operator[](F const &filter) const;
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray, F>>
fast(F const &filter) const;
auto operator[](long i) const & -> decltype(this->fast(i))
@@ -532,112 +495,93 @@ namespace types
}
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T const &>::type
+ std::enable_if_t<std::is_integral<Ty>::value, T const &>
operator[](array_tuple<Ty, value> const &indices) const;
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T &>::type
+ std::enable_if_t<std::is_integral<Ty>::value, T &>
operator[](array_tuple<Ty, value> const &indices);
template <class Ty, size_t M>
- auto operator[](array_tuple<Ty, M> const &indices) const & ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>()(*this, indices))>::type;
+ auto operator[](array_tuple<Ty, M> const &indices) const
+ & -> std::enable_if_t<std::is_integral<Ty>::value, decltype(nget<M - 1>()(*this, indices))>;
template <class Ty, size_t M>
- auto operator[](array_tuple<Ty, M> const &indices) && ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>()(std::move(*this),
- indices))>::type;
+ auto operator[](array_tuple<Ty, M> const &indices) && -> std::enable_if_t<
+ std::is_integral<Ty>::value, decltype(nget<M - 1>()(std::move(*this), indices))>;
template <class... Tys, size_t... Is>
- auto _fwdlongindex(std::tuple<Tys...> const &indices,
- utils::index_sequence<Is...>) const
+ auto _fwdlongindex(std::tuple<Tys...> const &indices, std::index_sequence<Is...>) const
-> decltype((*this)(static_cast<long>(Is)...))
{
return (*this)(static_cast<long>(std::get<Is>(indices))...);
}
template <class... Tys>
- auto operator[](std::tuple<Tys...> const &indices) const ->
- typename std::enable_if<
- utils::all_of<std::is_integral<Tys>::value...>::value,
- decltype(this->_fwdlongindex(
- indices, utils::make_index_sequence<sizeof...(Tys)>()))>::type
+ auto operator[](std::tuple<Tys...> const &indices) const -> std::enable_if_t<
+ utils::all_of<std::is_integral<Tys>::value...>::value,
+ decltype(this->_fwdlongindex(indices, std::make_index_sequence<sizeof...(Tys)>()))>
{
- return _fwdlongindex(indices,
- utils::make_index_sequence<sizeof...(Tys)>());
+ return _fwdlongindex(indices, std::make_index_sequence<sizeof...(Tys)>());
}
template <class... Tys, size_t... Is>
- auto _fwdlongindex(std::tuple<Tys...> const &indices,
- utils::index_sequence<Is...>)
+ auto _fwdlongindex(std::tuple<Tys...> const &indices, std::index_sequence<Is...>)
-> decltype((*this)(static_cast<long>(Is)...))
{
return (*this)(static_cast<long>(std::get<Is>(indices))...);
}
template <class... Tys>
- auto operator[](std::tuple<Tys...> const &indices) ->
- typename std::enable_if<
- utils::all_of<std::is_integral<Tys>::value...>::value,
- decltype(this->_fwdlongindex(
- indices, utils::make_index_sequence<sizeof...(Tys)>()))>::type
+ auto operator[](std::tuple<Tys...> const &indices) -> std::enable_if_t<
+ utils::all_of<std::is_integral<Tys>::value...>::value,
+ decltype(this->_fwdlongindex(indices, std::make_index_sequence<sizeof...(Tys)>()))>
{
- return _fwdlongindex(indices,
- utils::make_index_sequence<sizeof...(Tys)>());
+ return _fwdlongindex(indices, std::make_index_sequence<sizeof...(Tys)>());
}
template <class Ty0, class Ty1, class... Tys>
- auto operator[](std::tuple<Ty0, Ty1, Tys...> const &indices) const ->
- typename std::enable_if<
- std::is_integral<Ty0>::value &&
- !utils::all_of<std::is_integral<Ty1>::value,
- std::is_integral<Tys>::value...>::value,
- decltype((*this)[std::get<0>(indices)][tuple_tail(indices)])>::type
+ auto operator[](std::tuple<Ty0, Ty1, Tys...> const &indices) const -> std::enable_if_t<
+ std::is_integral<Ty0>::value &&
+ !utils::all_of<std::is_integral<Ty1>::value, std::is_integral<Tys>::value...>::value,
+ decltype((*this)[std::get<0>(indices)][tuple_tail(indices)])>
{
return (*this)[std::get<0>(indices)][tuple_tail(indices)];
}
template <class Slices, size_t... Is>
- auto _fwdindex(Slices const &indices, utils::index_sequence<Is...>)
- const & -> decltype((*this)(std::get<Is>(indices)...))
+ auto
+ _fwdindex(Slices const &indices,
+ std::index_sequence<Is...>) const & -> decltype((*this)(std::get<Is>(indices)...))
{
return (*this)(std::get<Is>(indices)...);
}
template <class S, size_t... Is>
- auto _fwdindex(dynamic_tuple<S> const &indices,
- utils::index_sequence<Is...>)
- const & -> decltype((*this)(std::get<Is>(indices)...))
+ auto
+ _fwdindex(dynamic_tuple<S> const &indices,
+ std::index_sequence<Is...>) const & -> decltype((*this)(std::get<Is>(indices)...))
{
- return (*this)((indices.size() > Is ? std::get<Is>(indices)
- : cstride_slice<1>())...);
+ return (*this)((indices.size() > Is ? std::get<Is>(indices) : cstride_slice<1>())...);
}
template <class Ty0, class Ty1, class... Tys,
- class _ = typename std::enable_if<is_numexpr_arg<Ty0>::value,
- void>::type>
- auto operator[](std::tuple<Ty0, Ty1, Tys...> const &indices) const ->
- typename std::enable_if<is_numexpr_arg<Ty0>::value,
- decltype(this->_fwdindex(
- indices, utils::make_index_sequence<
- 2 + sizeof...(Tys)>()))>::type;
+ class _ = std::enable_if_t<is_numexpr_arg<Ty0>::value, void>>
+ auto operator[](std::tuple<Ty0, Ty1, Tys...> const &indices) const -> std::enable_if_t<
+ is_numexpr_arg<Ty0>::value,
+ decltype(this->_fwdindex(indices, std::make_index_sequence<2 + sizeof...(Tys)>()))>;
- template <class Ty, size_t M,
- class _ = typename std::enable_if<!std::is_integral<Ty>::value,
- void>::type>
- auto operator[](array_tuple<Ty, M> const &indices) const
- & -> decltype(this->_fwdindex(indices, utils::make_index_sequence<M>()))
+ template <class Ty, size_t M, class _ = std::enable_if_t<!std::is_integral<Ty>::value, void>>
+ auto operator[](array_tuple<Ty, M> const &indices)
+ const & -> decltype(this->_fwdindex(indices, std::make_index_sequence<M>()))
{
- return _fwdindex(indices, utils::make_index_sequence<M>());
+ return _fwdindex(indices, std::make_index_sequence<M>());
}
template <class S>
auto operator[](dynamic_tuple<S> const &indices) const
- -> decltype(this->_fwdindex(indices,
- utils::make_index_sequence<value>()))
+ -> decltype(this->_fwdindex(indices, std::make_index_sequence<value>()))
{
- return _fwdindex(indices, utils::make_index_sequence<value>());
+ return _fwdindex(indices, std::make_index_sequence<value>());
}
/* through iterators */
@@ -709,8 +653,7 @@ namespace types
std::ostream &operator<<(std::ostream &os, ndarray<T, pS> const &e);
template <class E>
- typename std::enable_if<is_array<E>::value, std::ostream &>::type
- operator<<(std::ostream &os, E const &e);
+ std::enable_if_t<is_array<E>::value, std::ostream &> operator<<(std::ostream &os, E const &e);
/* } */
} // namespace types
PYTHONIC_NS_END
@@ -720,11 +663,9 @@ namespace std
{
template <size_t I, class E>
- auto get(E &&a) ->
- typename std::enable_if<
- pythonic::types::is_array<typename std::remove_cv<
- typename std::remove_reference<E>::type>::type>::value,
- decltype(std::forward<E>(a)[I])>::type;
+ auto get(E &&a) -> std::enable_if_t<
+ pythonic::types::is_array<std::remove_cv_t<std::remove_reference_t<E>>>::value,
+ decltype(std::forward<E>(a)[I])>;
template <size_t I, class T, class pS>
struct tuple_element<I, pythonic::types::ndarray<T, pS>> {
@@ -748,14 +689,12 @@ namespace std
template <size_t I, class E, class... S>
struct tuple_element<I, pythonic::types::numpy_gexpr<E, S...>> {
- using type =
- decltype(std::declval<pythonic::types::numpy_gexpr<E, S...>>()[0]);
+ using type = decltype(std::declval<pythonic::types::numpy_gexpr<E, S...>>()[0]);
};
template <size_t I, class T, class F>
struct tuple_element<I, pythonic::types::numpy_vexpr<T, F>> {
- using type =
- decltype(std::declval<pythonic::types::numpy_vexpr<T, F>>()[0]);
+ using type = decltype(std::declval<pythonic::types::numpy_vexpr<T, F>>()[0]);
};
} // namespace std
@@ -769,23 +708,20 @@ namespace types
namespace details
{
- using dtype_table = std::tuple<void, pythonic::numpy::functor::int8,
- pythonic::numpy::functor::int16, void,
- pythonic::numpy::functor::int32, void, void,
- void, pythonic::numpy::functor::int64>;
+ using dtype_table =
+ std::tuple<void, pythonic::numpy::functor::int8, pythonic::numpy::functor::int16, void,
+ pythonic::numpy::functor::int32, void, void, void,
+ pythonic::numpy::functor::int64>;
using dtype_utable =
- std::tuple<void, pythonic::numpy::functor::uint8,
- pythonic::numpy::functor::uint16, void,
+ std::tuple<void, pythonic::numpy::functor::uint8, pythonic::numpy::functor::uint16, void,
pythonic::numpy::functor::uint32, void, void, void,
pythonic::numpy::functor::uint64>;
template <class T>
struct dtype_helper {
- using table = typename std::conditional<std::is_signed<T>::value,
- dtype_table, dtype_utable>::type;
- using type = typename std::tuple_element<
- (sizeof(T) < std::tuple_size<table>::value) ? sizeof(T) : 0,
- table>::type;
+ using table = std::conditional_t<std::is_signed<T>::value, dtype_table, dtype_utable>;
+ using type =
+ std::tuple_element_t<(sizeof(T) < std::tuple_size<table>::value) ? sizeof(T) : 0, table>;
};
template <>
@@ -829,44 +765,39 @@ namespace builtins
struct _build_gexpr {
template <class E, class... S>
auto operator()(E const &a, S const &...slices)
- -> decltype(_build_gexpr<N - 1>{}(a, types::cstride_slice<1>(),
- slices...));
+ -> decltype(_build_gexpr<N - 1>{}(a, types::cstride_slice<1>(), slices...));
};
template <>
struct _build_gexpr<1> {
template <class E, class... S>
- auto operator()(E const &a,
- S const &...slices) -> decltype(E(a)(slices...));
+ auto operator()(E const &a, S const &...slices) -> decltype(E(a)(slices...));
};
template <class E>
E _make_real(E const &a, utils::int_<0>);
template <class E>
- auto _make_real(E const &a, utils::int_<1>)
- -> decltype(_build_gexpr<E::value>{}(
- types::ndarray<typename types::is_complex<typename E::dtype>::type,
- types::array_tuple<long, E::value>>{},
- types::slice()));
+ auto _make_real(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}(
+ types::ndarray<typename types::is_complex<typename E::dtype>::type,
+ types::array_tuple<long, E::value>>{},
+ types::slice()));
template <class T, class Ss, size_t... Is>
- auto real_get(T &&expr, Ss const &indices, utils::index_sequence<Is...>)
+ auto real_get(T &&expr, Ss const &indices, std::index_sequence<Is...>)
-> decltype(std::forward<T>(expr)(std::get<Is>(indices)...))
{
return std::forward<T>(expr)(std::get<Is>(indices)...);
}
template <class E>
- types::ndarray<typename E::dtype, typename E::shape_t>
- _make_imag(E const &a, utils::int_<0>);
+ types::ndarray<typename E::dtype, typename E::shape_t> _make_imag(E const &a, utils::int_<0>);
template <class E>
- auto _make_imag(E const &a, utils::int_<1>)
- -> decltype(_build_gexpr<E::value>{}(
- types::ndarray<typename types::is_complex<typename E::dtype>::type,
- types::array_tuple<long, E::value>>{},
- types::slice()));
+ auto _make_imag(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}(
+ types::ndarray<typename types::is_complex<typename E::dtype>::type,
+ types::array_tuple<long, E::value>>{},
+ types::slice()));
template <class T, class Ss, size_t... Is>
- auto imag_get(T &&expr, Ss const &indices, utils::index_sequence<Is...>)
+ auto imag_get(T &&expr, Ss const &indices, std::index_sequence<Is...>)
-> decltype(std::forward<T>(expr)(std::get<Is>(indices)...))
{
return std::forward<T>(expr)(std::get<Is>(indices)...);
@@ -885,8 +816,7 @@ namespace builtins
constexpr decltype(long(E::value)) getattr(types::attr::NDIM, E const &a);
template <class E>
- std::integral_constant<long, E::value> getattr(types::attr::NDIM,
- E *const &a);
+ std::integral_constant<long, E::value> getattr(types::attr::NDIM, E *const &a);
inline long getattr(types::attr::NDIM, ...)
{
@@ -908,8 +838,8 @@ namespace builtins
constexpr long getattr(types::attr::ITEMSIZE, E const &a);
template <class E>
- std::integral_constant<long, sizeof(typename E::dtype)>
- getattr(types::attr::ITEMSIZE, E *const &a);
+ std::integral_constant<long, sizeof(typename E::dtype)> getattr(types::attr::ITEMSIZE,
+ E *const &a);
template <class E>
long getattr(types::attr::NBYTES, E const &a);
@@ -925,25 +855,22 @@ namespace builtins
template <class T, class pS>
auto getattr(types::attr::REAL, types::ndarray<T, pS> const &a)
- -> decltype(details::_make_real(
- a, utils::int_<types::is_complex<T>::value>{}));
+ -> decltype(details::_make_real(a, utils::int_<types::is_complex<T>::value>{}));
template <class Op, class... Args>
auto getattr(types::attr::REAL, types::numpy_expr<Op, Args...> const &a)
-> decltype(details::_make_real(
- a, utils::int_<types::is_complex<
- typename types::numpy_expr<Op, Args...>::dtype>::value>{}));
+ a,
+ utils::int_<types::is_complex<typename types::numpy_expr<Op, Args...>::dtype>::value>{}));
template <class E>
auto getattr(types::attr::REAL, types::numpy_texpr<E> const &a)
- -> decltype(types::numpy_texpr<decltype(getattr(types::attr::REAL{},
- a.arg))>{
+ -> decltype(types::numpy_texpr<decltype(getattr(types::attr::REAL{}, a.arg))>{
getattr(types::attr::REAL{}, a.arg)});
template <class E>
auto getattr(types::attr::REAL, types::numpy_iexpr<E> const &a)
- -> decltype(types::numpy_iexpr<decltype(getattr(types::attr::REAL{},
- a.arg))>{
+ -> decltype(types::numpy_iexpr<decltype(getattr(types::attr::REAL{}, a.arg))>{
getattr(types::attr::REAL{}, a.arg)})
{
return {getattr(types::attr::REAL{}, a.arg)};
@@ -951,8 +878,7 @@ namespace builtins
template <class T, class F>
auto getattr(types::attr::REAL, types::numpy_vexpr<T, F> const &a)
- -> decltype(types::numpy_vexpr<
- decltype(getattr(types::attr::REAL{}, a.data_)), F>{
+ -> decltype(types::numpy_vexpr<decltype(getattr(types::attr::REAL{}, a.data_)), F>{
getattr(types::attr::REAL{}, a.data_), a.view_})
{
return {getattr(types::attr::REAL{}, a.data_), a.view_};
@@ -962,35 +888,31 @@ namespace builtins
auto getattr(types::attr::REAL, types::numpy_gexpr<E, S...> const &a)
-> decltype(details::real_get(
getattr(types::attr::REAL{}, a.arg), a.slices,
- utils::make_index_sequence<
- std::tuple_size<decltype(a.slices)>::value>()))
+ std::make_index_sequence<std::tuple_size<decltype(a.slices)>::value>()))
{
- return details::real_get(getattr(types::attr::REAL{}, a.arg), a.slices,
- utils::make_index_sequence<
- std::tuple_size<decltype(a.slices)>::value>());
+ return details::real_get(
+ getattr(types::attr::REAL{}, a.arg), a.slices,
+ std::make_index_sequence<std::tuple_size<decltype(a.slices)>::value>());
}
template <class T, class pS>
auto getattr(types::attr::IMAG, types::ndarray<T, pS> const &a)
- -> decltype(details::_make_imag(
- a, utils::int_<types::is_complex<T>::value>{}));
+ -> decltype(details::_make_imag(a, utils::int_<types::is_complex<T>::value>{}));
template <class Op, class... Args>
auto getattr(types::attr::IMAG, types::numpy_expr<Op, Args...> const &a)
-> decltype(details::_make_imag(
- a, utils::int_<types::is_complex<
- typename types::numpy_expr<Op, Args...>::dtype>::value>{}));
+ a,
+ utils::int_<types::is_complex<typename types::numpy_expr<Op, Args...>::dtype>::value>{}));
template <class E>
auto getattr(types::attr::IMAG, types::numpy_texpr<E> const &a)
- -> decltype(types::numpy_texpr<decltype(getattr(types::attr::IMAG{},
- a.arg))>{
+ -> decltype(types::numpy_texpr<decltype(getattr(types::attr::IMAG{}, a.arg))>{
getattr(types::attr::IMAG{}, a.arg)});
template <class E>
auto geatttr(types::attr::IMAG, types::numpy_iexpr<E> const &a)
- -> decltype(types::numpy_iexpr<decltype(getattr(types::attr::IMAG{},
- a.arg))>{
+ -> decltype(types::numpy_iexpr<decltype(getattr(types::attr::IMAG{}, a.arg))>{
getattr(types::attr::IMAG{}, a.arg)})
{
return {getattr(types::attr::IMAG{}, a.arg)};
@@ -998,8 +920,7 @@ namespace builtins
template <class T, class F>
auto getattr(types::attr::IMAG, types::numpy_vexpr<T, F> const &a)
- -> decltype(types::numpy_vexpr<
- decltype(getattr(types::attr::IMAG{}, a.data_)), F>{
+ -> decltype(types::numpy_vexpr<decltype(getattr(types::attr::IMAG{}, a.data_)), F>{
getattr(types::attr::IMAG{}, a.data_), a.view_})
{
return {getattr(types::attr::IMAG{}, a.data_), a.view_};
@@ -1009,17 +930,15 @@ namespace builtins
auto getattr(types::attr::IMAG, types::numpy_gexpr<E, S...> const &a)
-> decltype(details::imag_get(
getattr(types::attr::IMAG{}, a.arg), a.slices,
- utils::make_index_sequence<
- std::tuple_size<decltype(a.slices)>::value>()))
+ std::make_index_sequence<std::tuple_size<decltype(a.slices)>::value>()))
{
- return details::imag_get(getattr(types::attr::IMAG{}, a.arg), a.slices,
- utils::make_index_sequence<
- std::tuple_size<decltype(a.slices)>::value>());
+ return details::imag_get(
+ getattr(types::attr::IMAG{}, a.arg), a.slices,
+ std::make_index_sequence<std::tuple_size<decltype(a.slices)>::value>());
}
template <class E>
- types::dtype_t<typename types::dtype_of<E>::type> getattr(types::attr::DTYPE,
- E const &);
+ types::dtype_t<typename types::dtype_of<E>::type> getattr(types::attr::DTYPE, E const &);
} // namespace builtins
PYTHONIC_NS_END
@@ -1029,21 +948,19 @@ PYTHONIC_NS_END
#include "pythonic/include/types/combined.hpp"
template <class T1, class T2, class pS1, class pS2>
-struct __combined<pythonic::types::ndarray<T1, pS1>,
- pythonic::types::ndarray<T2, pS2>> {
+struct __combined<pythonic::types::ndarray<T1, pS1>, pythonic::types::ndarray<T2, pS2>> {
using type = pythonic::types::ndarray<
typename __combined<T1, T2>::type,
pythonic::sutils::common_shapes_t<std::tuple_size<pS1>::value, pS1, pS2>>;
};
template <class pS, class T, class... Tys>
-struct __combined<pythonic::types::ndarray<T, pS>,
- pythonic::types::numpy_expr<Tys...>> {
+struct __combined<pythonic::types::ndarray<T, pS>, pythonic::types::numpy_expr<Tys...>> {
using expr_type = pythonic::types::numpy_expr<Tys...>;
- using type = pythonic::types::ndarray<
- typename __combined<T, typename expr_type::dtype>::type,
- pythonic::sutils::common_shapes_t<std::tuple_size<pS>::value, pS,
- typename expr_type::shape_t>>;
+ using type =
+ pythonic::types::ndarray<typename __combined<T, typename expr_type::dtype>::type,
+ pythonic::sutils::common_shapes_t<std::tuple_size<pS>::value, pS,
+ typename expr_type::shape_t>>;
};
template <class pS, class T, class O>
@@ -1053,14 +970,12 @@ struct __combined<pythonic::types::ndarray<T, pS>, O> {
template <class pS, class T, class O>
struct __combined<pythonic::types::ndarray<T, pS>, pythonic::types::none<O>> {
- using type = pythonic::types::none<
- typename __combined<pythonic::types::ndarray<T, pS>, O>::type>;
+ using type = pythonic::types::none<typename __combined<pythonic::types::ndarray<T, pS>, O>::type>;
};
template <class pS, class T, class O>
struct __combined<pythonic::types::none<O>, pythonic::types::ndarray<T, pS>> {
- using type = pythonic::types::none<
- typename __combined<O, pythonic::types::ndarray<T, pS>>::type>;
+ using type = pythonic::types::none<typename __combined<O, pythonic::types::ndarray<T, pS>>::type>;
};
template <class pS, class T>
@@ -1099,26 +1014,22 @@ PYTHONIC_NS_BEGIN
template <class T, class pS>
struct to_python<types::ndarray<T, pS>> {
- static PyObject *convert(types::ndarray<T, pS> const &n,
- bool transpose = false);
+ static PyObject *convert(types::ndarray<T, pS> const &n, bool transpose = false);
};
template <class Arg>
struct to_python<types::numpy_iexpr<Arg>> {
- static PyObject *convert(types::numpy_iexpr<Arg> const &v,
- bool transpose = false);
+ static PyObject *convert(types::numpy_iexpr<Arg> const &v, bool transpose = false);
};
template <class Arg, class... S>
struct to_python<types::numpy_gexpr<Arg, S...>> {
- static PyObject *convert(types::numpy_gexpr<Arg, S...> const &v,
- bool transpose = false);
+ static PyObject *convert(types::numpy_gexpr<Arg, S...> const &v, bool transpose = false);
};
template <class E>
struct to_python<types::numpy_texpr<E>> {
- static PyObject *convert(types::numpy_texpr<E> const &t,
- bool transpose = false)
+ static PyObject *convert(types::numpy_texpr<E> const &t, bool transpose = false)
{
auto const &n = t.arg;
PyObject *result = to_python<E>::convert(n, !transpose);
@@ -1157,18 +1068,13 @@ PYTHONIC_NS_END
namespace std
{
template <class T, class pS>
- typename pythonic::types::nditerator<pythonic::types::ndarray<T, pS>> copy(
- typename pythonic::types::const_nditerator<
- pythonic::types::ndarray<T, pS>>
- begin,
- typename pythonic::types::const_nditerator<
- pythonic::types::ndarray<T, pS>>
- end,
- typename pythonic::types::nditerator<pythonic::types::ndarray<T, pS>> out)
+ typename pythonic::types::nditerator<pythonic::types::ndarray<T, pS>>
+ copy(typename pythonic::types::const_nditerator<pythonic::types::ndarray<T, pS>> begin,
+ typename pythonic::types::const_nditerator<pythonic::types::ndarray<T, pS>> end,
+ typename pythonic::types::nditerator<pythonic::types::ndarray<T, pS>> out)
{
const long offset = pythonic::sutils::prod_tail(begin.data);
- std::copy(begin.data.buffer + begin.index * offset,
- end.data.buffer + end.index * offset,
+ std::copy(begin.data.buffer + begin.index * offset, end.data.buffer + end.index * offset,
out.data.buffer + out.index * offset);
return out + (end - begin);
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp b/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp
index 0d1f8281adf..d37e29288a0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/nditerator.hpp
@@ -15,30 +15,24 @@ namespace types
};
template <class T>
- auto fast_begin(T const &e) ->
- typename std::enable_if<has_fast_iterator<T>::value,
- decltype(e.begin(fast{}))>::type
+ auto fast_begin(T const &e)
+ -> std::enable_if_t<has_fast_iterator<T>::value, decltype(e.begin(fast{}))>
{
return e.begin(fast{});
}
template <class T>
- auto fast_begin(T const &e) ->
- typename std::enable_if<!has_fast_iterator<T>::value,
- decltype(e.begin())>::type
+ auto fast_begin(T const &e) -> std::enable_if_t<!has_fast_iterator<T>::value, decltype(e.begin())>
{
return e.begin();
}
template <class T>
- auto fast_end(T const &e) ->
- typename std::enable_if<has_fast_iterator<T>::value,
- decltype(e.end(fast{}))>::type
+ auto fast_end(T const &e)
+ -> std::enable_if_t<has_fast_iterator<T>::value, decltype(e.end(fast{}))>
{
return e.end(fast{});
}
template <class T>
- auto fast_end(T const &e) ->
- typename std::enable_if<!has_fast_iterator<T>::value,
- decltype(e.end())>::type
+ auto fast_end(T const &e) -> std::enable_if_t<!has_fast_iterator<T>::value, decltype(e.end())>
{
return e.end();
}
@@ -48,8 +42,7 @@ namespace types
template <class E>
struct nditerator
: public std::iterator<std::random_access_iterator_tag,
- typename std::remove_reference<
- decltype(std::declval<E &>().fast(0))>::type> {
+ std::remove_reference_t<decltype(std::declval<E &>().fast(0))>> {
E &data;
long index;
nditerator(E &data, long index);
@@ -66,6 +59,9 @@ namespace types
bool operator!=(nditerator<E> const &other) const;
bool operator==(nditerator<E> const &other) const;
bool operator<(nditerator<E> const &other) const;
+ bool operator>(nditerator<E> const &other) const;
+ bool operator<=(nditerator<E> const &other) const;
+ bool operator>=(nditerator<E> const &other) const;
nditerator &operator=(nditerator const &other);
};
@@ -75,8 +71,7 @@ namespace types
template <class E>
struct const_nditerator
: public std::iterator<std::random_access_iterator_tag,
- typename std::remove_reference<
- decltype(std::declval<E &>().fast(0))>::type> {
+ std::remove_reference_t<decltype(std::declval<E &>().fast(0))>> {
E const &data;
long index;
const_nditerator(E const &data, long index);
@@ -92,13 +87,15 @@ namespace types
bool operator!=(const_nditerator<E> const &other) const;
bool operator==(const_nditerator<E> const &other) const;
bool operator<(const_nditerator<E> const &other) const;
+ bool operator>(const_nditerator<E> const &other) const;
+ bool operator<=(const_nditerator<E> const &other) const;
+ bool operator>=(const_nditerator<E> const &other) const;
const_nditerator &operator=(const_nditerator const &other);
};
#ifdef USE_XSIMD
template <class E>
struct const_simd_nditerator
- : public std::iterator<std::random_access_iterator_tag,
- xsimd::batch<typename E::dtype>> {
+ : public std::iterator<std::random_access_iterator_tag, xsimd::batch<typename E::dtype>> {
using vector_type = typename xsimd::batch<typename E::dtype>;
typename E::dtype const *data;
@@ -115,6 +112,9 @@ namespace types
bool operator!=(const_simd_nditerator const &other) const;
bool operator==(const_simd_nditerator const &other) const;
bool operator<(const_simd_nditerator const &other) const;
+ bool operator>(const_simd_nditerator const &other) const;
+ bool operator<=(const_simd_nditerator const &other) const;
+ bool operator>=(const_simd_nditerator const &other) const;
const_simd_nditerator &operator=(const_simd_nditerator const &other);
void store(xsimd::batch<typename E::dtype> const &);
};
@@ -132,8 +132,7 @@ namespace types
{
return *this;
}
- const_simd_nditerator_nostep &
- operator=(const_simd_nditerator_nostep const &other) = default;
+ const_simd_nditerator_nostep &operator=(const_simd_nditerator_nostep const &other) = default;
};
#endif
@@ -153,8 +152,7 @@ namespace types
template <bool is_strided>
struct make_const_nditerator {
template <class T>
- auto operator()(T const &self,
- long i) -> decltype(const_nditerator<T>(self, i)) const;
+ auto operator()(T const &self, long i) -> decltype(const_nditerator<T>(self, i)) const;
};
template <>
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_binary_op.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_binary_op.hpp
index 5aec8888b53..998c27ca8d9 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_binary_op.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_binary_op.hpp
@@ -6,12 +6,9 @@
#endif
template <class E0, class E1>
-typename std::enable_if<
- types::valid_numop_parameters<typename std::decay<E0>::type,
- typename std::decay<E1>::type>::value,
- types::numpy_expr<NUMPY_BINARY_FUNC_SYM,
- typename types::adapt_type<E0, E1>::type,
- typename types::adapt_type<E1, E0>::type>>::type
+std::enable_if_t<types::valid_numop_parameters<std::decay_t<E0>, std::decay_t<E1>>::value,
+ types::numpy_expr<NUMPY_BINARY_FUNC_SYM, typename types::adapt_type<E0, E1>::type,
+ typename types::adapt_type<E1, E0>::type>>
NUMPY_BINARY_FUNC_NAME(E0 &&self, E1 &&other);
#undef NUMPY_BINARY_FUNC_NAME
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp
index f86dc628fe0..34cb4dc9743 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_broadcast.hpp
@@ -16,8 +16,7 @@ namespace types
{
template <class T>
struct broadcasted_iterator
- : std::iterator<std::random_access_iterator_tag,
- typename std::remove_reference<T>::type> {
+ : std::iterator<std::random_access_iterator_tag, std::remove_reference_t<T>> {
T value_;
broadcasted_iterator(T const &value) : value_(value)
@@ -80,9 +79,9 @@ namespace types
static const bool is_vectorizable = true;
static const bool is_flat = false;
static const bool is_strided = false;
- using dtype = typename std::remove_reference<T>::type::dtype;
- using value_type = typename std::remove_reference<T>::type::value_type;
- static constexpr size_t value = std::remove_reference<T>::type::value + 1;
+ using dtype = typename std::remove_reference_t<T>::dtype;
+ using value_type = typename std::remove_reference_t<T>::value_type;
+ static constexpr size_t value = std::remove_reference_t<T>::value + 1;
using const_iterator = broadcasted_iterator<T>;
using iterator = const_iterator;
@@ -92,8 +91,7 @@ namespace types
template <size_t I>
long shape() const
{
- return I == 0 ? 1
- : (long)(ref.template shape < I == 0 ? 0 : (I - 1) > ());
+ return I == 0 ? 1 : (long)(ref.template shape<I == 0 ? 0 : (I - 1)>());
}
broadcasted() = default;
@@ -115,8 +113,7 @@ namespace types
T const &operator[](long i) const;
template <class S>
- typename std::enable_if<is_slice<S>::value, broadcasted const &>::type
- operator[](S s) const
+ std::enable_if_t<is_slice<S>::value, broadcasted const &> operator[](S s) const
{
return *this;
}
@@ -137,8 +134,7 @@ namespace types
#endif
template <class S>
- typename std::enable_if<is_slice<S>::value, broadcasted const &>::type
- operator()(S s) const
+ std::enable_if_t<is_slice<S>::value, broadcasted const &> operator()(S s) const
{
return *this;
}
@@ -153,9 +149,8 @@ namespace types
-> decltype(ref(std::forward<Arg1>(arg1), std::forward<Args>(args)...));
template <class S, class Arg1, class... Args>
- auto operator()(S arg0, Arg1 &&arg1, Args &&...args) const
- -> broadcast_or_broadcasted_t<typename std::decay<decltype(ref(
- std::forward<Arg1>(arg1), std::forward<Args>(args)...))>::type>;
+ auto operator()(S arg0, Arg1 &&arg1, Args &&...args) const -> broadcast_or_broadcasted_t<
+ std::decay_t<decltype(ref(std::forward<Arg1>(arg1), std::forward<Args>(args)...))>>;
long flat_size() const;
};
@@ -199,8 +194,7 @@ namespace types
#endif
template <class T>
- struct const_broadcast_iterator
- : public std::iterator<std::random_access_iterator_tag, T> {
+ struct const_broadcast_iterator : public std::iterator<std::random_access_iterator_tag, T> {
T value;
const_broadcast_iterator(T data) : value{data}
{
@@ -258,12 +252,10 @@ namespace types
template <class T, class B>
struct broadcast_dtype {
- using type =
- typename std::conditional<(std::is_integral<T>::value &&
- std::is_integral<B>::value) ||
- (std::is_floating_point<T>::value &&
- std::is_floating_point<B>::value),
- T, typename __combined<T, B>::type>::type;
+ using type = std::conditional_t<(std::is_integral<T>::value && std::is_integral<B>::value) ||
+ (std::is_floating_point<T>::value &&
+ std::is_floating_point<B>::value),
+ T, typename __combined<T, B>::type>;
};
#ifndef USE_XSIMD
template <class T, class B>
@@ -304,8 +296,7 @@ namespace types
dtype operator[](array_tuple<long, N>) const;
template <class S>
- typename std::enable_if<is_slice<S>::value, broadcast const &>::type
- operator[](S) const
+ std::enable_if_t<is_slice<S>::value, broadcast const &> operator[](S) const
{
return *this;
}
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp
index 0d13801a6bf..a6b59610364 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_expr.hpp
@@ -11,10 +11,9 @@ namespace types
template <size_t I, class Args>
bool is_trivial_broadcast()
{
- return std::is_same<typename std::tuple_element<
- 0, typename std::decay<typename std::tuple_element<
- I, Args>::type>::type::shape_t>::type,
- std::integral_constant<long, 1>>::value;
+ return std::is_same<
+ std::tuple_element_t<0, typename std::decay_t<std::tuple_element_t<I, Args>>::shape_t>,
+ std::integral_constant<long, 1>>::value;
}
template <class... Tys>
@@ -27,9 +26,8 @@ namespace types
};
template <class Ty0, class Ty1, class... Tys>
struct count_non_integral<Ty0, Ty1, Tys...>
- : std::integral_constant<long,
- count_non_integral<Ty0>::value +
- count_non_integral<Ty1, Tys...>::value> {
+ : std::integral_constant<long, count_non_integral<Ty0>::value +
+ count_non_integral<Ty1, Tys...>::value> {
};
template <class P>
struct is_perfect_stepping;
@@ -42,21 +40,18 @@ namespace types
template <size_t value, class Args, size_t... Is>
struct all_valid_indices<value, Args, 0, Is...> {
- using type = utils::index_sequence<Is...>;
+ using type = std::index_sequence<Is...>;
};
template <size_t value, class Args, size_t N, size_t... Is>
struct all_valid_indices
- : std::conditional<(value <=
- std::remove_reference<typename std::tuple_element<
- N - 1, Args>::type>::type::value),
- all_valid_indices<value, Args, N - 1, Is..., N - 1>,
- all_valid_indices<value, Args, N - 1, Is...>>::type {
+ : std::conditional_t<(value <=
+ std::remove_reference_t<std::tuple_element_t<N - 1, Args>>::value),
+ all_valid_indices<value, Args, N - 1, Is..., N - 1>,
+ all_valid_indices<value, Args, N - 1, Is...>> {
};
template <size_t value, class Args>
- using valid_indices =
- typename all_valid_indices<value, Args,
- std::tuple_size<Args>::value>::type;
+ using valid_indices = typename all_valid_indices<value, Args, std::tuple_size<Args>::value>::type;
template <class Expr>
struct is_numexpr_arg;
@@ -67,7 +62,7 @@ namespace types
template <class Op>
struct Dereferencer {
template <class Ts, size_t... I>
- auto operator()(Ts const &iters, utils::index_sequence<I...>)
+ auto operator()(Ts const &iters, std::index_sequence<I...>)
-> decltype(Op{}(*std::get<I>(iters)...))
{
return Op{}(*std::get<I>(iters)...);
@@ -80,20 +75,18 @@ namespace types
namespace details
{
template <size_t I, class Args, size_t... Is>
- long init_shape_element(Args const &args, utils::index_sequence<Is...>);
+ long init_shape_element(Args const &args, std::index_sequence<Is...>);
}
template <class Op, class Steps, class... Iters>
struct numpy_expr_iterator
: std::iterator<
std::random_access_iterator_tag,
- typename std::remove_reference<decltype(std::declval<Op>()(
- *std::declval<Iters>()...))>::type> {
+ std::remove_reference_t<decltype(std::declval<Op>()(*std::declval<Iters>()...))>> {
Steps steps_;
std::tuple<Iters...> iters_;
- numpy_expr_iterator(Steps steps, Iters... iters)
- : steps_(steps), iters_(iters...)
+ numpy_expr_iterator(Steps steps, Iters... iters) : steps_(steps), iters_(iters...)
{
}
@@ -109,16 +102,15 @@ namespace types
}
template <size_t... I>
- auto _dereference(utils::index_sequence<I...> s) const
- -> decltype(Dereferencer<Op>{}(iters_, s))
+ auto _dereference(std::index_sequence<I...> s) const -> decltype(Dereferencer<Op>{}(iters_, s))
{
return Dereferencer<Op>{}(iters_, s);
}
- auto operator*() const -> decltype(this->_dereference(
- utils::make_index_sequence<sizeof...(Iters)>{}))
+ auto operator*() const
+ -> decltype(this->_dereference(std::make_index_sequence<sizeof...(Iters)>{}))
{
- return _dereference(utils::make_index_sequence<sizeof...(Iters)>{});
+ return _dereference(std::make_index_sequence<sizeof...(Iters)>{});
}
template <size_t I>
@@ -134,22 +126,21 @@ namespace types
template <size_t I>
bool _incr_opt(std::integral_constant<bool, false> long_step)
{
- if (std::tuple_element<I, Steps>::type::value)
+ if (std::tuple_element_t<I, Steps>::value)
++std::get<I>(iters_);
return true;
}
template <size_t... I>
- void _incr(utils::index_sequence<I...>)
+ void _incr(std::index_sequence<I...>)
{
(void)std::initializer_list<bool>{_incr_opt<I>(
- std::integral_constant<
- bool, std::is_same<long, typename std::tuple_element<
- I, Steps>::type>::value>{})...};
+ std::integral_constant<bool,
+ std::is_same<long, std::tuple_element_t<I, Steps>>::value>{})...};
}
numpy_expr_iterator &operator++()
{
- _incr(utils::make_index_sequence<sizeof...(Iters)>{});
+ _incr(std::make_index_sequence<sizeof...(Iters)>{});
return *this;
}
@@ -160,29 +151,27 @@ namespace types
}
template <size_t... I>
- void _update(long i, utils::index_sequence<I...>)
+ void _update(long i, std::index_sequence<I...>)
{
- (void)std::initializer_list<bool>{
- (std::get<I>(iters_) += std::get<I>(steps_) * i, true)...};
+ (void)std::initializer_list<bool>{(std::get<I>(iters_) += std::get<I>(steps_) * i, true)...};
}
numpy_expr_iterator &operator+=(long i)
{
- _update(i, utils::make_index_sequence<sizeof...(Iters)>{});
+ _update(i, std::make_index_sequence<sizeof...(Iters)>{});
return *this;
}
template <size_t... I>
- long _difference(numpy_expr_iterator const &other,
- utils::index_sequence<I...>) const
+ long _difference(numpy_expr_iterator const &other, std::index_sequence<I...>) const
{
- std::initializer_list<long> distances{(static_cast<long>(
- std::get<I>(iters_) - std::get<I>(other.iters_)))...};
+ std::initializer_list<long> distances{
+ (static_cast<long>(std::get<I>(iters_) - std::get<I>(other.iters_)))...};
return *std::max_element(distances.begin(), distances.end());
}
long operator-(numpy_expr_iterator const &other) const
{
- return _difference(other, utils::make_index_sequence<sizeof...(Iters)>{});
+ return _difference(other, std::make_index_sequence<sizeof...(Iters)>{});
}
bool _neq(numpy_expr_iterator const &other, utils::int_<0u>) const
@@ -228,32 +217,34 @@ namespace types
template <size_t I>
bool _lt(numpy_expr_iterator const &other, utils::int_<I>) const
{
- if (!std::get<I - 1>(steps_) ||
- (std::get<I - 1>(iters_) == std::get<I - 1>(other.iters_)))
+ if (!std::get<I - 1>(steps_) || (std::get<I - 1>(iters_) == std::get<I - 1>(other.iters_)))
return _lt(other, utils::int_<I - 1>{});
else
- return std::get<I - 1>(steps_) &&
- (std::get<I - 1>(iters_) < std::get<I - 1>(other.iters_));
+ return std::get<I - 1>(steps_) && (std::get<I - 1>(iters_) < std::get<I - 1>(other.iters_));
}
bool operator<(numpy_expr_iterator const &other) const
{
return _lt(other, utils::int_<sizeof...(Iters)>{});
}
+
+ bool operator<=(numpy_expr_iterator const &other) const
+ {
+ return *this < other || *this == other;
+ }
};
#ifdef USE_XSIMD
template <class E, class Op, class Steps, class SIters, class... Iters>
struct numpy_expr_simd_iterator
: std::iterator<
std::random_access_iterator_tag,
- typename std::remove_reference<decltype(std::declval<Op>()(
- *std::declval<Iters>()...))>::type> {
+ std::remove_reference_t<decltype(std::declval<Op>()(*std::declval<Iters>()...))>> {
Steps steps_;
std::tuple<Iters...> iters_;
SIters siters_;
- numpy_expr_simd_iterator(array_tuple<long, sizeof...(Iters)> steps,
- SIters const &siters, Iters... iters)
+ numpy_expr_simd_iterator(array_tuple<long, sizeof...(Iters)> steps, SIters const &siters,
+ Iters... iters)
: steps_(steps), iters_(iters...), siters_(siters)
{
}
@@ -271,17 +262,15 @@ namespace types
}
template <size_t... I>
- auto _dereference(utils::index_sequence<I...>) const
- -> decltype(Op{}(*std::get<I>(iters_)...))
+ auto _dereference(std::index_sequence<I...>) const -> decltype(Op{}(*std::get<I>(iters_)...))
{
- return Op{}(((std::get<I>(steps_)) ? (*std::get<I>(iters_))
- : (std::get<I>(siters_)))...);
+ return Op{}(((std::get<I>(steps_)) ? (*std::get<I>(iters_)) : (std::get<I>(siters_)))...);
}
- auto operator*() const -> decltype(this->_dereference(
- utils::make_index_sequence<sizeof...(Iters)>{}))
+ auto operator*() const
+ -> decltype(this->_dereference(std::make_index_sequence<sizeof...(Iters)>{}))
{
- return _dereference(utils::make_index_sequence<sizeof...(Iters)>{});
+ return _dereference(std::make_index_sequence<sizeof...(Iters)>{});
}
template <size_t I>
@@ -297,22 +286,21 @@ namespace types
template <size_t I>
bool _incr_opt(std::integral_constant<bool, false> long_step)
{
- if (std::tuple_element<I, Steps>::type::value)
+ if (std::tuple_element_t<I, Steps>::value)
++std::get<I>(iters_);
return true;
}
template <size_t... I>
- void _incr(utils::index_sequence<I...>)
+ void _incr(std::index_sequence<I...>)
{
(void)std::initializer_list<bool>{_incr_opt<I>(
- std::integral_constant<
- bool, std::is_same<long, typename std::tuple_element<
- I, Steps>::type>::value>{})...};
+ std::integral_constant<bool,
+ std::is_same<long, std::tuple_element_t<I, Steps>>::value>{})...};
}
numpy_expr_simd_iterator &operator++()
{
- _incr(utils::make_index_sequence<sizeof...(Iters)>{});
+ _incr(std::make_index_sequence<sizeof...(Iters)>{});
return *this;
}
@@ -323,29 +311,26 @@ namespace types
}
template <size_t... I>
- void _update(long i, utils::index_sequence<I...>)
+ void _update(long i, std::index_sequence<I...>)
{
- (void)std::initializer_list<bool>{
- (std::get<I>(iters_) += std::get<I>(steps_) * i, true)...};
+ (void)std::initializer_list<bool>{(std::get<I>(iters_) += std::get<I>(steps_) * i, true)...};
}
numpy_expr_simd_iterator &operator+=(long i)
{
- _update(i, utils::make_index_sequence<sizeof...(Iters)>{});
+ _update(i, std::make_index_sequence<sizeof...(Iters)>{});
return *this;
}
template <size_t... I>
- long _difference(numpy_expr_simd_iterator const &other,
- utils::index_sequence<I...>) const
+ long _difference(numpy_expr_simd_iterator const &other, std::index_sequence<I...>) const
{
- std::initializer_list<long> distances{
- (std::get<I>(iters_) - std::get<I>(other.iters_))...};
+ std::initializer_list<long> distances{(std::get<I>(iters_) - std::get<I>(other.iters_))...};
return *std::max_element(distances.begin(), distances.end());
}
long operator-(numpy_expr_simd_iterator const &other) const
{
- return _difference(other, utils::make_index_sequence<sizeof...(Iters)>{});
+ return _difference(other, std::make_index_sequence<sizeof...(Iters)>{});
}
bool _neq(numpy_expr_simd_iterator const &other, utils::int_<0u>) const
@@ -392,12 +377,10 @@ namespace types
template <size_t I>
bool _lt(numpy_expr_simd_iterator const &other, utils::int_<I>) const
{
- if (std::get<I - 1>(steps_) &&
- (std::get<I - 1>(iters_) == std::get<I - 1>(other.iters_)))
+ if (std::get<I - 1>(steps_) && (std::get<I - 1>(iters_) == std::get<I - 1>(other.iters_)))
return _lt(other, utils::int_<I - 1>{});
else
- return std::get<I - 1>(steps_) &&
- (std::get<I - 1>(iters_) < std::get<I - 1>(other.iters_));
+ return std::get<I - 1>(steps_) && (std::get<I - 1>(iters_) < std::get<I - 1>(other.iters_));
}
bool operator<(numpy_expr_simd_iterator const &other) const
@@ -410,16 +393,14 @@ namespace types
struct numpy_expr_simd_iterator_nobroadcast
: std::iterator<
std::random_access_iterator_tag,
- typename std::remove_reference<decltype(std::declval<Op>()(
- *std::declval<Iters>()...))>::type> {
+ std::remove_reference_t<decltype(std::declval<Op>()(*std::declval<Iters>()...))>> {
std::tuple<Iters...> iters_;
numpy_expr_simd_iterator_nobroadcast(Iters... iters) : iters_(iters...)
{
}
- numpy_expr_simd_iterator_nobroadcast(
- numpy_expr_simd_iterator_nobroadcast const &other)
+ numpy_expr_simd_iterator_nobroadcast(numpy_expr_simd_iterator_nobroadcast const &other)
: iters_(other.iters_)
{
}
@@ -432,41 +413,39 @@ namespace types
}
template <size_t... I>
- auto _dereference(utils::index_sequence<I...>) const
- -> decltype(Op{}(*std::get<I>(iters_)...))
+ auto _dereference(std::index_sequence<I...>) const -> decltype(Op{}(*std::get<I>(iters_)...))
{
return Op{}((*std::get<I>(iters_))...);
}
- auto operator*() const -> decltype(this->_dereference(
- utils::make_index_sequence<sizeof...(Iters)>{}))
+ auto operator*() const
+ -> decltype(this->_dereference(std::make_index_sequence<sizeof...(Iters)>{}))
{
- return _dereference(utils::make_index_sequence<sizeof...(Iters)>{});
+ return _dereference(std::make_index_sequence<sizeof...(Iters)>{});
}
template <size_t... I>
- void _incr(utils::index_sequence<I...>)
+ void _incr(std::index_sequence<I...>)
{
(void)std::initializer_list<bool>{(++std::get<I>(iters_), true)...};
}
numpy_expr_simd_iterator_nobroadcast &operator++()
{
- _incr(utils::make_index_sequence<sizeof...(Iters)>{});
+ _incr(std::make_index_sequence<sizeof...(Iters)>{});
return *this;
}
template <size_t... I>
long _difference(numpy_expr_simd_iterator_nobroadcast const &other,
- utils::index_sequence<I...>) const
+ std::index_sequence<I...>) const
{
- std::initializer_list<long> distances{
- (std::get<I>(iters_) - std::get<I>(other.iters_))...};
+ std::initializer_list<long> distances{(std::get<I>(iters_) - std::get<I>(other.iters_))...};
return *std::max_element(distances.begin(), distances.end());
}
long operator-(numpy_expr_simd_iterator_nobroadcast const &other) const
{
- return _difference(other, utils::make_index_sequence<sizeof...(Iters)>{});
+ return _difference(other, std::make_index_sequence<sizeof...(Iters)>{});
}
numpy_expr_simd_iterator_nobroadcast operator+(long i) const
@@ -476,25 +455,23 @@ namespace types
}
template <size_t... I>
- void _update(long i, utils::index_sequence<I...>)
+ void _update(long i, std::index_sequence<I...>)
{
(void)std::initializer_list<bool>{(std::get<I>(iters_) += i, true)...};
}
numpy_expr_simd_iterator_nobroadcast &operator+=(long i)
{
- _update(i, utils::make_index_sequence<sizeof...(Iters)>{});
+ _update(i, std::make_index_sequence<sizeof...(Iters)>{});
return *this;
}
- bool _neq(numpy_expr_simd_iterator_nobroadcast const &other,
- utils::int_<0u>) const
+ bool _neq(numpy_expr_simd_iterator_nobroadcast const &other, utils::int_<0u>) const
{
return false;
}
template <size_t I>
- bool _neq(numpy_expr_simd_iterator_nobroadcast const &other,
- utils::int_<I>) const
+ bool _neq(numpy_expr_simd_iterator_nobroadcast const &other, utils::int_<I>) const
{
return (std::get<I - 1>(iters_) != std::get<I - 1>(other.iters_)) ||
_neq(other, utils::int_<I - 1>{});
@@ -505,15 +482,13 @@ namespace types
return _neq(other, utils::int_<sizeof...(Iters)>{});
}
- bool _eq(numpy_expr_simd_iterator_nobroadcast const &other,
- utils::int_<0u>) const
+ bool _eq(numpy_expr_simd_iterator_nobroadcast const &other, utils::int_<0u>) const
{
return true;
}
template <size_t I>
- bool _eq(numpy_expr_simd_iterator_nobroadcast const &other,
- utils::int_<I>) const
+ bool _eq(numpy_expr_simd_iterator_nobroadcast const &other, utils::int_<I>) const
{
return (std::get<I - 1>(iters_) == std::get<I - 1>(other.iters_)) &&
_eq(other, utils::int_<I - 1>{});
@@ -524,15 +499,13 @@ namespace types
return _eq(other, utils::int_<sizeof...(Iters)>{});
}
- bool _lt(numpy_expr_simd_iterator_nobroadcast const &other,
- utils::int_<0u>) const
+ bool _lt(numpy_expr_simd_iterator_nobroadcast const &other, utils::int_<0u>) const
{
return false;
}
template <size_t I>
- bool _lt(numpy_expr_simd_iterator_nobroadcast const &other,
- utils::int_<I>) const
+ bool _lt(numpy_expr_simd_iterator_nobroadcast const &other, utils::int_<I>) const
{
if (std::get<I - 1>(iters_) == std::get<I - 1>(other.iters_))
return _lt(other, utils::int_<I - 1>{});
@@ -548,8 +521,8 @@ namespace types
#endif
template <long N0, long N1>
- std::integral_constant<long, N0 == N1>
- make_step(std::integral_constant<long, N0>, std::integral_constant<long, N1>)
+ std::integral_constant<long, N0 == N1> make_step(std::integral_constant<long, N0>,
+ std::integral_constant<long, N1>)
{
return {};
}
@@ -568,14 +541,12 @@ namespace types
template <class S, class Sp, class... Ss>
constexpr size_t count_none(size_t I)
{
- return I == 0 ? 0
- : (std::is_same<S, none_type>::value +
- count_none<Sp, Ss...>(I - 1));
+ return I == 0 ? 0 : (std::is_same<S, none_type>::value + count_none<Sp, Ss...>(I - 1));
}
template <class BT, class T>
- using step_type_t = decltype(make_step(std::get<0>(std::declval<BT>()),
- std::get<0>(std::declval<T>())));
+ using step_type_t =
+ decltype(make_step(std::get<0>(std::declval<BT>()), std::get<0>(std::declval<T>())));
constexpr size_t clamp(size_t i, size_t j)
{
@@ -583,16 +554,13 @@ namespace types
}
template <size_t... J, class Arg, class Shp, class... S>
- auto
- make_subslice(utils::index_sequence<J...>, Arg const &arg, Shp const &shp,
- std::tuple<S...> const &ss) -> decltype(arg(std::get<J>(ss)...))
+ auto make_subslice(std::index_sequence<J...>, Arg const &arg, Shp const &shp,
+ std::tuple<S...> const &ss) -> decltype(arg(std::get<J>(ss)...))
{
// we need to adapt_slice to take broadcasting into account
return arg(adapt_slice(
- std::get<J>(ss),
- shp.template shape<clamp(J - count_none<S...>(J), Shp::value - 1)>(),
- arg.template shape<clamp(J - count_none<S...>(J),
- Arg::value - 1)>())...);
+ std::get<J>(ss), shp.template shape<clamp(J - count_none<S...>(J), Shp::value - 1)>(),
+ arg.template shape<clamp(J - count_none<S...>(J), Arg::value - 1)>())...);
}
/* Expression template for numpy expressions - binary operators
@@ -601,90 +569,79 @@ namespace types
struct numpy_expr {
using first_arg = typename utils::front<Args...>::type;
static const bool is_vectorizable =
- utils::all_of<
- std::remove_reference<Args>::type::is_vectorizable...>::value &&
- utils::all_of<
- std::is_same<typename std::remove_cv<typename std::remove_reference<
- first_arg>::type>::type::dtype,
- typename std::remove_cv<typename std::remove_reference<
- Args>::type>::type::dtype>::value...>::value &&
- types::is_vector_op<
- Op, typename std::remove_reference<Args>::type::dtype...>::value;
+ utils::all_of<std::remove_reference_t<Args>::is_vectorizable...>::value &&
+ utils::all_of<std::is_same<
+ typename std::remove_cv_t<std::remove_reference_t<first_arg>>::dtype,
+ typename std::remove_cv_t<std::remove_reference_t<Args>>::dtype>::value...>::value &&
+ types::is_vector_op<Op, typename std::remove_reference_t<Args>::dtype...>::value;
static const bool is_flat = false;
static const bool is_strided =
- utils::any_of<std::remove_reference<Args>::type::is_strided...>::value;
+ utils::any_of<std::remove_reference_t<Args>::is_strided...>::value;
static constexpr size_t value =
- utils::max_element<std::remove_reference<Args>::type::value...>::value;
- using value_type = decltype(Op()(
- std::declval<
- typename std::remove_reference<Args>::type::value_type>()...));
- using dtype = decltype(Op()(
- std::declval<typename std::remove_reference<Args>::type::dtype>()...));
+ utils::max_element<std::remove_reference_t<Args>::value...>::value;
+ using value_type =
+ decltype(Op()(std::declval<typename std::remove_reference_t<Args>::value_type>()...));
+ using dtype = decltype(Op()(std::declval<typename std::remove_reference_t<Args>::dtype>()...));
#ifdef CYTHON_ABI
- std::tuple<typename std::remove_reference<Args>::type...> args;
+ std::tuple<std::remove_reference_t<Args>...> args;
#else
std::tuple<Args...> args;
#endif
- using shape_t = sutils::merged_shapes_t<
- value, typename std::remove_reference<Args>::type::shape_t...>;
- using steps_t = pshape<step_type_t<
- shape_t, typename std::remove_reference<Args>::type::shape_t>...>;
- static_assert(value == std::tuple_size<shape_t>::value,
- "consistent shape and size");
- using const_iterator = numpy_expr_iterator<
- Op, steps_t,
- typename std::remove_reference<Args>::type::const_iterator...>;
- using iterator = numpy_expr_iterator<
- Op, steps_t, typename std::remove_reference<Args>::type::iterator...>;
+ using shape_t =
+ sutils::merged_shapes_t<value, typename std::remove_reference_t<Args>::shape_t...>;
+ using steps_t =
+ pshape<step_type_t<shape_t, typename std::remove_reference_t<Args>::shape_t>...>;
+ static_assert(value == std::tuple_size<shape_t>::value, "consistent shape and size");
+ using const_iterator =
+ numpy_expr_iterator<Op, steps_t, typename std::remove_reference_t<Args>::const_iterator...>;
+ using iterator =
+ numpy_expr_iterator<Op, steps_t, typename std::remove_reference_t<Args>::iterator...>;
using const_fast_iterator = const_nditerator<numpy_expr>;
numpy_expr() = default;
numpy_expr(numpy_expr const &) = default;
numpy_expr(numpy_expr &&) = default;
-#ifdef CYTHON_ABI
template <class... Argp>
numpy_expr(numpy_expr<Op, Argp...> const &other) : args(other.args)
{
}
-#endif
numpy_expr(Args const &...args);
template <size_t... I>
- const_iterator _begin(utils::index_sequence<I...>) const;
+ const_iterator _begin(std::index_sequence<I...>) const;
const_iterator begin() const;
template <size_t... I>
- const_iterator _end(utils::index_sequence<I...>) const;
+ const_iterator _end(std::index_sequence<I...>) const;
const_iterator end() const;
const_fast_iterator begin(types::fast) const;
const_fast_iterator end(types::fast) const;
template <size_t... I>
- iterator _begin(utils::index_sequence<I...>);
+ iterator _begin(std::index_sequence<I...>);
iterator begin();
template <size_t... I>
- iterator _end(utils::index_sequence<I...>);
+ iterator _end(std::index_sequence<I...>);
iterator end();
template <size_t... I>
- auto _fast(long i, utils::index_sequence<I...>) const
+ auto _fast(long i, std::index_sequence<I...>) const
-> decltype(Op()(std::get<I>(args).fast(i)...))
{
return Op()(std::get<I>(args).fast(i)...);
}
auto fast(long i) const
- -> decltype(this->_fast(i,
- utils::make_index_sequence<sizeof...(Args)>{}));
+ -> decltype(this->_fast(i, std::make_index_sequence<sizeof...(Args)>{}));
template <class... Indices, size_t... I>
- auto _load(utils::index_sequence<I...>, Indices... indices) const
+ auto _load(std::index_sequence<I...>, Indices... indices) const
-> decltype(Op()(std::get<I>(args).load(indices...)...))
{
return Op()(std::get<I>(args).load(indices...)...);
@@ -692,16 +649,13 @@ namespace types
template <class... Indices>
auto load(Indices... indices) const
- -> decltype(this->_load(utils::make_index_sequence<sizeof...(Args)>{},
- indices...))
+ -> decltype(this->_load(std::make_index_sequence<sizeof...(Args)>{}, indices...))
{
- return this->_load(utils::make_index_sequence<sizeof...(Args)>{},
- indices...);
+ return this->_load(std::make_index_sequence<sizeof...(Args)>{}, indices...);
}
template <size_t... I>
- auto _map_fast(array_tuple<long, sizeof...(I)> const &indices,
- utils::index_sequence<I...>) const
+ auto _map_fast(array_tuple<long, sizeof...(I)> const &indices, std::index_sequence<I...>) const
-> decltype(Op()(std::get<I>(args).fast(std::get<I>(indices))...))
{
return Op()(std::get<I>(args).fast(std::get<I>(indices))...);
@@ -709,126 +663,107 @@ namespace types
template <class... Indices>
auto map_fast(Indices... indices) const
- -> decltype(this->_map_fast(
- array_tuple<long, sizeof...(Indices)>{{indices...}},
- utils::make_index_sequence<sizeof...(Args)>{}));
+ -> decltype(this->_map_fast(array_tuple<long, sizeof...(Indices)>{{indices...}},
+ std::make_index_sequence<sizeof...(Args)>{}));
public:
template <size_t I>
- auto shape() const -> decltype(details::init_shape_element<I>(
- args, valid_indices<value, std::tuple<Args...>>{}))
+ auto shape() const
+ -> decltype(details::init_shape_element<I>(args,
+ valid_indices<value, std::tuple<Args...>>{}))
{
- return details::init_shape_element<I>(
- args, valid_indices<value, std::tuple<Args...>>{});
+ return details::init_shape_element<I>(args, valid_indices<value, std::tuple<Args...>>{});
}
template <size_t... I>
- bool _no_broadcast(utils::index_sequence<I...>) const;
+ bool _no_broadcast(std::index_sequence<I...>) const;
bool no_broadcast() const;
template <size_t... I>
- bool _no_broadcast_vectorize(utils::index_sequence<I...>) const;
+ bool _no_broadcast_vectorize(std::index_sequence<I...>) const;
bool no_broadcast_vectorize() const;
template <size_t... I>
- bool _no_broadcast_ex(utils::index_sequence<I...>) const;
+ bool _no_broadcast_ex(std::index_sequence<I...>) const;
bool no_broadcast_ex() const;
#ifdef USE_XSIMD
using simd_iterator = numpy_expr_simd_iterator<
numpy_expr, Op,
- pshape<step_type_t<
- shape_t, typename std::remove_reference<Args>::type::shape_t>...>,
- std::tuple<xsimd::batch<
- typename std::remove_reference<Args>::type::value_type>...>,
- typename std::remove_reference<Args>::type::simd_iterator...>;
+ pshape<step_type_t<shape_t, typename std::remove_reference_t<Args>::shape_t>...>,
+ std::tuple<xsimd::batch<typename std::remove_reference_t<Args>::value_type>...>,
+ typename std::remove_reference_t<Args>::simd_iterator...>;
using simd_iterator_nobroadcast = numpy_expr_simd_iterator_nobroadcast<
- numpy_expr, Op,
- typename std::remove_reference<
- Args>::type::simd_iterator_nobroadcast...>;
+ numpy_expr, Op, typename std::remove_reference_t<Args>::simd_iterator_nobroadcast...>;
template <size_t... I>
- simd_iterator _vbegin(types::vectorize, utils::index_sequence<I...>) const;
+ simd_iterator _vbegin(types::vectorize, std::index_sequence<I...>) const;
simd_iterator vbegin(types::vectorize) const;
template <size_t... I>
- simd_iterator _vend(types::vectorize, utils::index_sequence<I...>) const;
+ simd_iterator _vend(types::vectorize, std::index_sequence<I...>) const;
simd_iterator vend(types::vectorize) const;
template <size_t... I>
simd_iterator_nobroadcast _vbegin(types::vectorize_nobroadcast,
- utils::index_sequence<I...>) const;
+ std::index_sequence<I...>) const;
simd_iterator_nobroadcast vbegin(types::vectorize_nobroadcast) const;
template <size_t... I>
- simd_iterator_nobroadcast _vend(types::vectorize_nobroadcast,
- utils::index_sequence<I...>) const;
+ simd_iterator_nobroadcast _vend(types::vectorize_nobroadcast, std::index_sequence<I...>) const;
simd_iterator_nobroadcast vend(types::vectorize_nobroadcast) const;
#endif
template <size_t... I, class... S>
- auto _get(utils::index_sequence<I...> is, S const &...s) const
- -> decltype(Op{}(
- make_subslice(utils::make_index_sequence<sizeof...(S)>{},
- std::get<I>(args), *this, std::make_tuple(s...))...))
+ auto _get(std::index_sequence<I...> is, S const &...s) const
+ -> decltype(Op{}(make_subslice(std::make_index_sequence<sizeof...(S)>{}, std::get<I>(args),
+ *this, std::make_tuple(s...))...))
{
- return Op{}(make_subslice(utils::make_index_sequence<sizeof...(S)>{},
- std::get<I>(args), *this,
+ return Op{}(make_subslice(std::make_index_sequence<sizeof...(S)>{}, std::get<I>(args), *this,
std::make_tuple(s...))...);
}
template <class... S>
auto operator()(S const &...s) const
- -> decltype(this->_get(utils::make_index_sequence<sizeof...(Args)>{},
- s...));
+ -> decltype(this->_get(std::make_index_sequence<sizeof...(Args)>{}, s...));
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr, F>>
operator[](F const &filter) const;
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr, F>>
fast(F const &filter) const;
// FIXME: this does not take into account bounds and broadcasting
auto operator[](long i) const -> decltype(this->fast(i));
template <size_t... I, class S>
- auto _index(S s, utils::index_sequence<I...>) const
- -> decltype(Op{}(std::get<I>(args)[s]...))
+ auto _index(S s, std::index_sequence<I...>) const -> decltype(Op{}(std::get<I>(args)[s]...))
{
return Op{}(std::get<I>(args)[s]...);
}
template <class S>
auto operator[](S s) const
- -> decltype((*this)._index(
- (s.lower, s), utils::make_index_sequence<sizeof...(Args)>{}))
+ -> decltype((*this)._index((s.lower, s), std::make_index_sequence<sizeof...(Args)>{}))
{
- return _index(s, utils::make_index_sequence<sizeof...(Args)>{});
+ return _index(s, std::make_index_sequence<sizeof...(Args)>{});
}
dtype operator[](array_tuple<long, value> const &indices) const
{
- return _index(indices, utils::make_index_sequence<sizeof...(Args)>{});
+ return _index(indices, std::make_index_sequence<sizeof...(Args)>{});
}
explicit operator bool() const;
@@ -841,9 +776,8 @@ namespace types
template <class Op, class... Args>
struct assignable<types::numpy_expr<Op, Args...>> {
- using type = types::ndarray<
- typename pythonic::types::numpy_expr<Op, Args...>::dtype,
- typename pythonic::types::numpy_expr<Op, Args...>::shape_t>;
+ using type = types::ndarray<typename pythonic::types::numpy_expr<Op, Args...>::dtype,
+ typename pythonic::types::numpy_expr<Op, Args...>::shape_t>;
};
template <class Op, class... Arg>
@@ -864,14 +798,12 @@ struct __combined<indexable<K>, pythonic::types::numpy_expr<Op, Args...>> {
};
template <class Op, class K, class V, class... Args>
-struct __combined<pythonic::types::numpy_expr<Op, Args...>,
- indexable_container<K, V>> {
+struct __combined<pythonic::types::numpy_expr<Op, Args...>, indexable_container<K, V>> {
using type = pythonic::types::numpy_expr<Op, Args...>;
};
template <class Op, class K, class V, class... Args>
-struct __combined<indexable_container<K, V>,
- pythonic::types::numpy_expr<Op, Args...>> {
+struct __combined<indexable_container<K, V>, pythonic::types::numpy_expr<Op, Args...>> {
using type = pythonic::types::numpy_expr<Op, Args...>;
};
@@ -890,42 +822,34 @@ struct __combined<pythonic::types::numpy_expr<Op, Args...>,
pythonic::types::numpy_expr<Op2, Args2...>> {
using type = pythonic::types::ndarray<
typename pythonic::types::numpy_expr<Op, Args...>::dtype,
- pythonic::types::array_tuple<
- long, pythonic::types::numpy_expr<Op, Args...>::value>>;
+ pythonic::types::array_tuple<long, pythonic::types::numpy_expr<Op, Args...>::value>>;
};
template <class E, class Op, class... Args>
-struct __combined<pythonic::types::numpy_iexpr<E>,
- pythonic::types::numpy_expr<Op, Args...>> {
+struct __combined<pythonic::types::numpy_iexpr<E>, pythonic::types::numpy_expr<Op, Args...>> {
using type = pythonic::types::numpy_iexpr<E>;
};
template <class E, class Op, class... Args>
-struct __combined<pythonic::types::numpy_expr<Op, Args...>,
- pythonic::types::numpy_iexpr<E>> {
+struct __combined<pythonic::types::numpy_expr<Op, Args...>, pythonic::types::numpy_iexpr<E>> {
using type = pythonic::types::numpy_iexpr<E>;
};
template <class T, class pS, class Op, class... Args>
-struct __combined<pythonic::types::numpy_expr<Op, Args...>,
- pythonic::types::ndarray<T, pS>> {
+struct __combined<pythonic::types::numpy_expr<Op, Args...>, pythonic::types::ndarray<T, pS>> {
using type = pythonic::types::ndarray<T, pS>;
};
template <class T, class Op, class... Args>
-struct __combined<pythonic::types::numpy_expr<Op, Args...>,
- pythonic::types::numpy_texpr<T>> {
+struct __combined<pythonic::types::numpy_expr<Op, Args...>, pythonic::types::numpy_texpr<T>> {
using type = pythonic::types::ndarray<
typename pythonic::types::numpy_expr<Op, Args...>::dtype,
- pythonic::types::array_tuple<
- long, pythonic::types::numpy_expr<Op, Args...>::value>>;
+ pythonic::types::array_tuple<long, pythonic::types::numpy_expr<Op, Args...>::value>>;
};
template <class T, class Op, class... Args>
-struct __combined<pythonic::types::numpy_texpr<T>,
- pythonic::types::numpy_expr<Op, Args...>> {
+struct __combined<pythonic::types::numpy_texpr<T>, pythonic::types::numpy_expr<Op, Args...>> {
using type = pythonic::types::ndarray<
typename pythonic::types::numpy_expr<Op, Args...>::dtype,
- pythonic::types::array_tuple<
- long, pythonic::types::numpy_expr<Op, Args...>::value>>;
+ pythonic::types::array_tuple<long, pythonic::types::numpy_expr<Op, Args...>::value>>;
};
/*}*/
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp
index b56aeba3bc1..8b9f1acd5d9 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_gexpr.hpp
@@ -31,8 +31,7 @@ namespace types
template <class T0, class... T>
struct count_new_axis<T0, T...> {
- static constexpr size_t value =
- count_new_axis<T0>::value + count_new_axis<T...>::value;
+ static constexpr size_t value = count_new_axis<T0>::value + count_new_axis<T...>::value;
};
/* helper to cast slices
@@ -96,16 +95,12 @@ namespace types
template <class E, class... S>
auto operator()(E &&expr, S const &...s)
-> decltype(std::forward<E>(expr).reshape(make_reshape<C>(
- expr,
- std::tuple<
- std::integral_constant<bool, to_slice<S>::is_new_axis>...>()))(
+ expr, std::tuple<std::integral_constant<bool, to_slice<S>::is_new_axis>...>()))(
to_slice<S>{}(s)...))
{
return std::forward<E>(expr).reshape(make_reshape<C>(
- expr,
- std::tuple<
- std::integral_constant<bool, to_slice<S>::is_new_axis>...>()))(
+ expr, std::tuple<std::integral_constant<bool, to_slice<S>::is_new_axis>...>()))(
to_slice<S>{}(s)...);
}
};
@@ -113,51 +108,44 @@ namespace types
template <>
struct extended_slice<0> {
template <class E, class... S>
- auto operator()(E &&expr, long const &s0, S const &...s) ->
- typename std::enable_if<
- utils::all_of<std::is_integral<S>::value...>::value,
- decltype(std::forward<E>(expr)[types::make_tuple(s0, s...)])>::type
+ auto operator()(E &&expr, long const &s0, S const &...s)
+ -> std::enable_if_t<utils::all_of<std::is_integral<S>::value...>::value,
+ decltype(std::forward<E>(expr)[types::make_tuple(s0, s...)])>
{
return std::forward<E>(expr)[types::make_tuple(s0, s...)];
}
template <class E, class... S>
- auto operator()(E &&expr, long const &s0, S const &...s) ->
- typename std::enable_if<
- !utils::all_of<std::is_integral<S>::value...>::value,
- decltype(std::forward<E>(expr)[s0](s...))>::type
+ auto operator()(E &&expr, long const &s0, S const &...s)
+ -> std::enable_if_t<!utils::all_of<std::is_integral<S>::value...>::value,
+ decltype(std::forward<E>(expr)[s0](s...))>
{
return std::forward<E>(expr)[s0](s...);
}
template <class E, class... S, size_t... Is>
- numpy_gexpr<typename std::decay<E>::type, normalize_t<S>...>
- fwd(E &&expr, std::tuple<S...> const &s, utils::index_sequence<Is...>)
+ numpy_gexpr<std::decay_t<E>, normalize_t<S>...> fwd(E &&expr, std::tuple<S...> const &s,
+ std::index_sequence<Is...>)
{
- return {std::forward<E>(expr),
- std::get<Is>(s).normalize(expr.template shape<Is>())...};
+ return {std::forward<E>(expr), std::get<Is>(s).normalize(expr.template shape<Is>())...};
}
template <class E, class Sp, class... S>
- typename std::enable_if<
- is_slice<Sp>::value,
- numpy_gexpr<E, normalize_t<Sp>, normalize_t<S>...>>::type
+ std::enable_if_t<is_slice<Sp>::value, numpy_gexpr<E, normalize_t<Sp>, normalize_t<S>...>>
operator()(E &&expr, Sp const &s0, S const &...s)
{
return make_gexpr(std::forward<E>(expr), s0, s...);
}
template <class E, class F, class... S>
- typename std::enable_if<
- !is_slice<F>::value,
- numpy_gexpr<ndarray<typename std::decay<E>::type::dtype,
- array_tuple<long, std::decay<E>::type::value>>,
- cstride_normalized_slice<1>, normalize_t<S>...>>::type
+ std::enable_if_t<!is_slice<F>::value,
+ numpy_gexpr<ndarray<typename std::decay_t<E>::dtype,
+ array_tuple<long, std::decay_t<E>::value>>,
+ cstride_normalized_slice<1>, normalize_t<S>...>>
operator()(E &&expr, F const &s0, S const &...s)
{
- return numpy_vexpr<ndarray<typename std::decay<E>::type::dtype,
- array_tuple<long, std::decay<E>::type::value>>,
- F>{std::forward<E>(expr), s0}(
- fast_contiguous_slice(none_type{}, none_type{}), s...);
+ return numpy_vexpr<
+ ndarray<typename std::decay_t<E>::dtype, array_tuple<long, std::decay_t<E>::value>>, F>{
+ std::forward<E>(expr), s0}(fast_contiguous_slice(none_type{}, none_type{}), s...);
}
};
@@ -183,8 +171,7 @@ namespace types
template <class T, class... Types>
struct count_long<T, Types...> {
- static constexpr size_t value =
- count_long<T>::value + count_long<Types...>::value;
+ static constexpr size_t value = count_long<T>::value + count_long<Types...>::value;
};
template <>
@@ -226,21 +213,18 @@ namespace types
{
template <class T, class Ts, size_t... Is>
- std::tuple<T, typename std::tuple_element<Is, Ts>::type...>
- tuple_push_head(T const &val, Ts const &vals, utils::index_sequence<Is...>)
+ std::tuple<T, std::tuple_element_t<Is, Ts>...> tuple_push_head(T const &val, Ts const &vals,
+ std::index_sequence<Is...>)
{
- return std::tuple<T, typename std::tuple_element<Is, Ts>::type...>{
- val, std::get<Is>(vals)...};
+ return std::tuple<T, std::tuple_element_t<Is, Ts>...>{val, std::get<Is>(vals)...};
}
template <class T, class Ts>
auto tuple_push_head(T const &val, Ts const &vals)
- -> decltype(tuple_push_head(
- val, vals,
- utils::make_index_sequence<std::tuple_size<Ts>::value>()))
+ -> decltype(tuple_push_head(val, vals,
+ std::make_index_sequence<std::tuple_size<Ts>::value>()))
{
- return tuple_push_head(
- val, vals, utils::make_index_sequence<std::tuple_size<Ts>::value>());
+ return tuple_push_head(val, vals, std::make_index_sequence<std::tuple_size<Ts>::value>());
}
// this struct is specialized for every type combination && takes care of
@@ -257,89 +241,77 @@ namespace types
template <class... T0>
struct merge_gexpr<std::tuple<T0...>, std::tuple<>> {
template <size_t I, class S>
- std::tuple<T0...> run(S const &, std::tuple<T0...> const &t0,
- std::tuple<>);
- static_assert(
- utils::all_of<std::is_same<T0, normalize_t<T0>>::value...>::value,
- "all slices are normalized");
+ std::tuple<T0...> run(S const &, std::tuple<T0...> const &t0, std::tuple<>);
+ static_assert(utils::all_of<std::is_same<T0, normalize_t<T0>>::value...>::value,
+ "all slices are normalized");
};
template <class... T1>
struct merge_gexpr<std::tuple<>, std::tuple<T1...>> {
template <size_t I, class S>
- std::tuple<normalize_t<T1>...> run(S const &, std::tuple<>,
- std::tuple<T1...> const &t1);
+ std::tuple<normalize_t<T1>...> run(S const &, std::tuple<>, std::tuple<T1...> const &t1);
};
template <class S0, class... T0, class S1, class... T1>
struct merge_gexpr<std::tuple<S0, T0...>, std::tuple<S1, T1...>> {
template <size_t I, class S>
- auto run(S const &s, std::tuple<S0, T0...> const &t0,
- std::tuple<S1, T1...> const &t1)
- -> decltype(tuple_push_head(
- std::get<0>(t0) * std::get<0>(t1),
- merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}
- .template run<I + 1>(s, tuple_tail(t0), tuple_tail(t1))))
+ auto run(S const &s, std::tuple<S0, T0...> const &t0, std::tuple<S1, T1...> const &t1)
+ -> decltype(tuple_push_head(std::get<0>(t0) * std::get<0>(t1),
+ merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}
+ .template run<I + 1>(s, tuple_tail(t0), tuple_tail(t1))))
{
return tuple_push_head(
std::get<0>(t0) * std::get<0>(t1),
- merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}
- .template run<I + 1>(s, tuple_tail(t0), tuple_tail(t1)));
+ merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}.template run<I + 1>(
+ s, tuple_tail(t0), tuple_tail(t1)));
}
static_assert(
std::is_same<decltype(std::declval<S0>() * std::declval<S1>()),
- normalize_t<decltype(std::declval<S0>() *
- std::declval<S1>())>>::value,
+ normalize_t<decltype(std::declval<S0>() * std::declval<S1>())>>::value,
"all slices are normalized");
};
template <class... T1>
struct merge_gexpr<std::tuple<>, std::tuple<none_type, T1...>> {
template <size_t I, class S>
- auto run(S const &s, std::tuple<> const &t0,
- std::tuple<none_type, T1...> const &t1)
- -> decltype(tuple_push_head(
- std::get<0>(t1), merge_gexpr<std::tuple<>, std::tuple<T1...>>{}
- .template run<I + 1>(s, t0, tuple_tail(t1))))
+ auto run(S const &s, std::tuple<> const &t0, std::tuple<none_type, T1...> const &t1)
+ -> decltype(tuple_push_head(std::get<0>(t1),
+ merge_gexpr<std::tuple<>, std::tuple<T1...>>{}
+ .template run<I + 1>(s, t0, tuple_tail(t1))))
{
- return tuple_push_head(
- std::get<0>(t1),
- merge_gexpr<std::tuple<>, std::tuple<T1...>>{}.template run<I + 1>(
- s, t0, tuple_tail(t1)));
+ return tuple_push_head(std::get<0>(t1),
+ merge_gexpr<std::tuple<>, std::tuple<T1...>>{}.template run<I + 1>(
+ s, t0, tuple_tail(t1)));
}
};
template <class S0, class... T0, class... T1>
struct merge_gexpr<std::tuple<S0, T0...>, std::tuple<none_type, T1...>> {
template <size_t I, class S>
- auto run(S const &s, std::tuple<S0, T0...> const &t0,
- std::tuple<none_type, T1...> const &t1)
- -> decltype(tuple_push_head(
- std::get<0>(t1),
- merge_gexpr<std::tuple<S0, T0...>, std::tuple<T1...>>{}
- .template run<I + 1>(s, t0, tuple_tail(t1))))
+ auto run(S const &s, std::tuple<S0, T0...> const &t0, std::tuple<none_type, T1...> const &t1)
+ -> decltype(tuple_push_head(std::get<0>(t1),
+ merge_gexpr<std::tuple<S0, T0...>, std::tuple<T1...>>{}
+ .template run<I + 1>(s, t0, tuple_tail(t1))))
{
return tuple_push_head(
std::get<0>(t1),
- merge_gexpr<std::tuple<S0, T0...>, std::tuple<T1...>>{}
- .template run<I + 1>(s, t0, tuple_tail(t1)));
+ merge_gexpr<std::tuple<S0, T0...>, std::tuple<T1...>>{}.template run<I + 1>(
+ s, t0, tuple_tail(t1)));
}
};
template <class... T0, class S1, class... T1>
struct merge_gexpr<std::tuple<long, T0...>, std::tuple<S1, T1...>> {
template <size_t I, class S>
- auto run(S const &s, std::tuple<long, T0...> const &t0,
- std::tuple<S1, T1...> const &t1)
- -> decltype(tuple_push_head(
- std::get<0>(t0),
- merge_gexpr<std::tuple<T0...>, std::tuple<S1, T1...>>{}
- .template run<I>(s, tuple_tail(t0), t1)))
+ auto run(S const &s, std::tuple<long, T0...> const &t0, std::tuple<S1, T1...> const &t1)
+ -> decltype(tuple_push_head(std::get<0>(t0),
+ merge_gexpr<std::tuple<T0...>, std::tuple<S1, T1...>>{}
+ .template run<I>(s, tuple_tail(t0), t1)))
{
return tuple_push_head(
std::get<0>(t0),
- merge_gexpr<std::tuple<T0...>, std::tuple<S1, T1...>>{}
- .template run<I>(s, tuple_tail(t0), t1));
+ merge_gexpr<std::tuple<T0...>, std::tuple<S1, T1...>>{}.template run<I>(
+ s, tuple_tail(t0), t1));
}
};
template <class... T0, class... T1>
@@ -347,102 +319,88 @@ namespace types
template <size_t I, class S>
auto run(S const &s, std::tuple<long, T0...> const &t0,
std::tuple<none_type, T1...> const &t1)
- -> decltype(tuple_push_head(
- std::get<0>(t0),
- merge_gexpr<std::tuple<T0...>, std::tuple<none_type, T1...>>{}
- .template run<I>(s, tuple_tail(t0), t1)))
+ -> decltype(tuple_push_head(std::get<0>(t0),
+ merge_gexpr<std::tuple<T0...>, std::tuple<none_type, T1...>>{}
+ .template run<I>(s, tuple_tail(t0), t1)))
{
return tuple_push_head(
std::get<0>(t0),
- merge_gexpr<std::tuple<T0...>, std::tuple<none_type, T1...>>{}
- .template run<I>(s, tuple_tail(t0), t1));
+ merge_gexpr<std::tuple<T0...>, std::tuple<none_type, T1...>>{}.template run<I>(
+ s, tuple_tail(t0), t1));
}
};
template <class S0, class... T0, class... T1>
struct merge_gexpr<std::tuple<S0, T0...>, std::tuple<long, T1...>> {
template <size_t I, class S>
- auto run(S const &s, std::tuple<S0, T0...> const &t0,
- std::tuple<long, T1...> const &t1)
- -> decltype(tuple_push_head(
- std::get<0>(t1),
- merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}
- .template run<I + 1>(s, tuple_tail(t0), tuple_tail(t1))))
+ auto run(S const &s, std::tuple<S0, T0...> const &t0, std::tuple<long, T1...> const &t1)
+ -> decltype(tuple_push_head(std::get<0>(t1),
+ merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}
+ .template run<I + 1>(s, tuple_tail(t0), tuple_tail(t1))))
{
return tuple_push_head(
std::get<0>(t1) * std::get<0>(t0).step + std::get<0>(t0).lower,
- merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}
- .template run<I + 1>(s, tuple_tail(t0), tuple_tail(t1)));
+ merge_gexpr<std::tuple<T0...>, std::tuple<T1...>>{}.template run<I + 1>(
+ s, tuple_tail(t0), tuple_tail(t1)));
}
};
template <class... T0, class... T1>
struct merge_gexpr<std::tuple<long, T0...>, std::tuple<long, T1...>> {
template <size_t I, class S>
- auto run(S const &s, std::tuple<long, T0...> const &t0,
- std::tuple<long, T1...> const &t1)
- -> decltype(tuple_push_head(
- std::get<0>(t0),
- merge_gexpr<std::tuple<T0...>, std::tuple<long, T1...>>{}
- .template run<I>(s, tuple_tail(t0), t1)))
+ auto run(S const &s, std::tuple<long, T0...> const &t0, std::tuple<long, T1...> const &t1)
+ -> decltype(tuple_push_head(std::get<0>(t0),
+ merge_gexpr<std::tuple<T0...>, std::tuple<long, T1...>>{}
+ .template run<I>(s, tuple_tail(t0), t1)))
{
return tuple_push_head(
std::get<0>(t0),
- merge_gexpr<std::tuple<T0...>, std::tuple<long, T1...>>{}
- .template run<I>(s, tuple_tail(t0), t1));
+ merge_gexpr<std::tuple<T0...>, std::tuple<long, T1...>>{}.template run<I>(
+ s, tuple_tail(t0), t1));
}
};
template <class Arg, class... Sp>
- typename std::enable_if<count_new_axis<Sp...>::value == 0,
- numpy_gexpr<Arg, Sp...>>::type
+ std::enable_if_t<count_new_axis<Sp...>::value == 0, numpy_gexpr<Arg, Sp...>>
_make_gexpr(Arg arg, std::tuple<Sp...> const &t);
template <class Arg, class S, size_t... Is>
- numpy_gexpr<Arg, typename to_normalized_slice<
- typename std::tuple_element<Is, S>::type>::type...>
- _make_gexpr_helper(Arg arg, S const &s, utils::index_sequence<Is...>);
+ numpy_gexpr<Arg, typename to_normalized_slice<std::tuple_element_t<Is, S>>::type...>
+ _make_gexpr_helper(Arg arg, S const &s, std::index_sequence<Is...>);
template <class Arg, class... Sp>
- auto _make_gexpr(Arg arg, std::tuple<Sp...> const &s) ->
- typename std::enable_if<
- count_new_axis<Sp...>::value != 0,
- decltype(_make_gexpr_helper(
- arg.reshape(make_reshape<count_new_axis<Sp...>::value>(
- arg, std::tuple<std::integral_constant<
- bool, to_slice<Sp>::is_new_axis>...>())),
- s, utils::make_index_sequence<sizeof...(Sp)>()))>::type;
+ auto _make_gexpr(Arg arg, std::tuple<Sp...> const &s) -> std::enable_if_t<
+ count_new_axis<Sp...>::value != 0,
+ decltype(_make_gexpr_helper(
+ arg.reshape(make_reshape<count_new_axis<Sp...>::value>(
+ arg, std::tuple<std::integral_constant<bool, to_slice<Sp>::is_new_axis>...>())),
+ s, std::make_index_sequence<sizeof...(Sp)>()))>;
template <class Arg, class... S>
struct make_gexpr {
template <size_t... Is>
- numpy_gexpr<Arg, normalize_t<S>...>
- operator()(Arg arg, std::tuple<S...>, utils::index_sequence<Is...>);
+ numpy_gexpr<Arg, normalize_t<S>...> operator()(Arg arg, std::tuple<S...>,
+ std::index_sequence<Is...>);
numpy_gexpr<Arg, normalize_t<S>...> operator()(Arg arg, S const &...s);
};
// this specialization is in charge of merging gexpr
template <class Arg, class... S, class... Sp>
struct make_gexpr<numpy_gexpr<Arg, S...> const &, Sp...> {
- auto operator()(numpy_gexpr<Arg, S...> const &arg, Sp const &...s)
- -> decltype(_make_gexpr(
- std::declval<Arg>(),
- merge_gexpr<std::tuple<S...>, std::tuple<Sp...>>{}
- .template run<0>(arg, std::tuple<S...>(),
- std::tuple<Sp...>())))
+ auto operator()(numpy_gexpr<Arg, S...> const &arg, Sp const &...s) -> decltype(_make_gexpr(
+ std::declval<Arg>(), merge_gexpr<std::tuple<S...>, std::tuple<Sp...>>{}.template run<0>(
+ arg, std::tuple<S...>(), std::tuple<Sp...>())))
{
- return _make_gexpr(
- arg.arg,
- merge_gexpr<std::tuple<S...>, std::tuple<Sp...>>{}.template run<0>(
- arg, arg.slices, std::make_tuple(s...)));
+ return _make_gexpr(arg.arg,
+ merge_gexpr<std::tuple<S...>, std::tuple<Sp...>>{}.template run<0>(
+ arg, arg.slices, std::make_tuple(s...)));
}
};
} // namespace details
template <class Arg, class... S>
auto make_gexpr(Arg &&arg, S const &...s)
- -> decltype(details::make_gexpr<Arg, S...>{}(std::forward<Arg>(arg),
- s...));
+ -> decltype(details::make_gexpr<Arg, S...>{}(std::forward<Arg>(arg), s...));
/* type-based compile time overlapping detection: detect if a type may
*overlap with another
@@ -494,8 +452,7 @@ namespace types
};
template <class E>
- struct may_overlap_gexpr<list<E>>
- : std::integral_constant<bool, !is_dtype<E>::value> {
+ struct may_overlap_gexpr<list<E>> : std::integral_constant<bool, !is_dtype<E>::value> {
};
template <class E, size_t N, class V>
@@ -526,18 +483,14 @@ namespace types
};
template <class... Tys, class... oTys, class... S, long stride>
- struct gexpr_shape<pshape<Tys...>,
- pshape<std::integral_constant<long, 1>, oTys...>,
+ struct gexpr_shape<pshape<Tys...>, pshape<std::integral_constant<long, 1>, oTys...>,
cstride_normalized_slice<stride>, S...>
- : gexpr_shape<pshape<Tys..., std::integral_constant<long, 1>>,
- pshape<oTys...>, S...> {
+ : gexpr_shape<pshape<Tys..., std::integral_constant<long, 1>>, pshape<oTys...>, S...> {
};
template <class... Tys, class... oTys, class... S>
- struct gexpr_shape<pshape<Tys...>,
- pshape<std::integral_constant<long, 1>, oTys...>,
+ struct gexpr_shape<pshape<Tys...>, pshape<std::integral_constant<long, 1>, oTys...>,
normalized_slice, S...>
- : gexpr_shape<pshape<Tys..., std::integral_constant<long, 1>>,
- pshape<oTys...>, S...> {
+ : gexpr_shape<pshape<Tys..., std::integral_constant<long, 1>>, pshape<oTys...>, S...> {
};
template <class... Tys, class oT, class... oTys, class... S>
@@ -564,14 +517,12 @@ namespace types
*/
template <class Arg, class... S>
struct numpy_gexpr {
+ static_assert(utils::all_of<std::is_same<S, normalize_t<S>>::value...>::value,
+ "all slices are normalized");
static_assert(
- utils::all_of<std::is_same<S, normalize_t<S>>::value...>::value,
- "all slices are normalized");
- static_assert(utils::all_of<(std::is_same<S, long>::value ||
- is_normalized_slice<S>::value)...>::value,
- "all slices are valid");
- static_assert(std::decay<Arg>::type::value >= sizeof...(S),
- "slicing respects array shape");
+ utils::all_of<(std::is_same<S, long>::value || is_normalized_slice<S>::value)...>::value,
+ "all slices are valid");
+ static_assert(std::decay_t<Arg>::value >= sizeof...(S), "slicing respects array shape");
// numpy_gexpr is a wrapper for extended sliced array around a numpy
// expression.
@@ -582,19 +533,14 @@ namespace types
// through the S... template
// && compacted values as we know that first S is a slice.
- static_assert(
- utils::all_of<
- std::is_same<S, typename std::decay<S>::type>::value...>::value,
- "no modifiers on slices");
+ static_assert(utils::all_of<std::is_same<S, std::decay_t<S>>::value...>::value,
+ "no modifiers on slices");
- using dtype = typename std::remove_reference<Arg>::type::dtype;
- static constexpr size_t value =
- std::remove_reference<Arg>::type::value - count_long<S...>::value;
+ using dtype = typename std::remove_reference_t<Arg>::dtype;
+ static constexpr size_t value = std::remove_reference_t<Arg>::value - count_long<S...>::value;
- using last_arg_stride_t =
- decltype(std::declval<Arg>().template strides<sizeof...(S) - 1>());
- using last_slice_t =
- typename std::tuple_element<sizeof...(S) - 1, std::tuple<S...>>::type;
+ using last_arg_stride_t = decltype(std::declval<Arg>().template strides<sizeof...(S) - 1>());
+ using last_slice_t = std::tuple_element_t<sizeof...(S) - 1, std::tuple<S...>>;
// It is not possible to vectorize everything. We only vectorize if the
// last dimension is contiguous, which happens if
@@ -602,36 +548,29 @@ namespace types
// 2. the size of the gexpr is lower than the dim of arg, || it's the
// same, but the last slice is contiguous
static const bool is_vectorizable =
- std::remove_reference<Arg>::type::is_vectorizable &&
- (sizeof...(S) < std::remove_reference<Arg>::type::value ||
+ std::remove_reference_t<Arg>::is_vectorizable &&
+ (sizeof...(S) < std::remove_reference_t<Arg>::value ||
std::is_same<cstride_normalized_slice<1>, last_slice_t>::value);
static const bool is_flat =
- std::remove_reference<Arg>::type::is_flat && value == 1 &&
- utils::all_of<
- std::is_same<cstride_normalized_slice<1>, S>::value...>::value;
+ std::remove_reference_t<Arg>::is_flat && value == 1 &&
+ utils::all_of<std::is_same<cstride_normalized_slice<1>, S>::value...>::value;
static const bool is_strided =
- std::remove_reference<Arg>::type::is_strided ||
+ std::remove_reference_t<Arg>::is_strided ||
(((sizeof...(S) - count_long<S...>::value) == value) &&
!std::is_same<cstride_normalized_slice<1>, last_slice_t>::value);
using value_type =
- typename std::decay<decltype(numpy_iexpr_helper<value>::get(
- std::declval<numpy_gexpr>(), 1))>::type;
+ std::decay_t<decltype(numpy_iexpr_helper<value>::get(std::declval<numpy_gexpr>(), 1))>;
- using iterator =
- typename std::conditional<is_strided || value != 1,
- nditerator<numpy_gexpr>, dtype *>::type;
+ using iterator = std::conditional_t<is_strided || value != 1, nditerator<numpy_gexpr>, dtype *>;
using const_iterator =
- typename std::conditional<is_strided || value != 1,
- const_nditerator<numpy_gexpr>,
- dtype const *>::type;
+ std::conditional_t<is_strided || value != 1, const_nditerator<numpy_gexpr>, dtype const *>;
- typename std::remove_cv<Arg>::type arg;
+ std::remove_cv_t<Arg> arg;
std::tuple<S...> slices;
- using shape_t =
- gexpr_shape_t<typename std::remove_reference<Arg>::type::shape_t, S...>;
+ using shape_t = gexpr_shape_t<typename std::remove_reference_t<Arg>::shape_t, S...>;
shape_t _shape;
dtype *buffer;
@@ -644,10 +583,9 @@ namespace types
static constexpr types::array_tuple<long, 1> last_stride(...);
sutils::concat_t<types::array_tuple<long, value - 1>,
- typename std::conditional<
- sizeof...(S) == std::decay<Arg>::type::value,
- decltype(last_stride(std::declval<last_slice_t>())),
- types::array_tuple<long, 1>>::type>
+ std::conditional_t<sizeof...(S) == std::decay_t<Arg>::value,
+ decltype(last_stride(std::declval<last_slice_t>())),
+ types::array_tuple<long, 1>>>
_strides; // strides
template <size_t I>
@@ -671,11 +609,11 @@ namespace types
numpy_gexpr(numpy_gexpr<Argp, S...> const &other);
template <size_t J, class Slice>
- typename std::enable_if<is_normalized_slice<Slice>::value, void>::type
+ std::enable_if_t<is_normalized_slice<Slice>::value, void>
init_shape(Slice const &s, utils::int_<1>, utils::int_<J>);
template <size_t I, size_t J, class Slice>
- typename std::enable_if<is_normalized_slice<Slice>::value, void>::type
+ std::enable_if_t<is_normalized_slice<Slice>::value, void>
init_shape(Slice const &s, utils::int_<I>, utils::int_<J>);
template <size_t J>
@@ -691,16 +629,13 @@ namespace types
friend struct array_base_slicer;
template <class _Arg, class... _other_classes>
- friend
- typename std::enable_if<count_new_axis<_other_classes...>::value == 0,
- numpy_gexpr<_Arg, _other_classes...>>::type
- details::_make_gexpr(_Arg arg, std::tuple<_other_classes...> const &t);
+ friend std::enable_if_t<count_new_axis<_other_classes...>::value == 0,
+ numpy_gexpr<_Arg, _other_classes...>>
+ details::_make_gexpr(_Arg arg, std::tuple<_other_classes...> const &t);
template <class _Arg, class _other_classes, size_t... Is>
- friend numpy_gexpr<_Arg,
- typename to_normalized_slice<typename std::tuple_element<
- Is, _other_classes>::type>::type...>
- details::_make_gexpr_helper(_Arg arg, _other_classes const &s,
- utils::index_sequence<Is...>);
+ friend numpy_gexpr<
+ _Arg, typename to_normalized_slice<std::tuple_element_t<Is, _other_classes>>::type...>
+ details::_make_gexpr_helper(_Arg arg, _other_classes const &s, std::index_sequence<Is...>);
template <size_t C>
friend struct extended_slice;
@@ -736,12 +671,10 @@ namespace types
}
template <class E>
- typename std::enable_if<may_overlap_gexpr<E>::value, numpy_gexpr &>::type
- _copy(E const &expr);
+ std::enable_if_t<may_overlap_gexpr<E>::value, numpy_gexpr &> _copy(E const &expr);
template <class E>
- typename std::enable_if<!may_overlap_gexpr<E>::value, numpy_gexpr &>::type
- _copy(E const &expr);
+ std::enable_if_t<!may_overlap_gexpr<E>::value, numpy_gexpr &> _copy(E const &expr);
template <class E>
numpy_gexpr &_copy_restrict(E const &expr);
@@ -755,12 +688,10 @@ namespace types
numpy_gexpr &operator=(numpy_gexpr<Argp, S...> const &expr);
template <class Op, class E>
- typename std::enable_if<may_overlap_gexpr<E>::value, numpy_gexpr &>::type
- update_(E const &expr);
+ std::enable_if_t<may_overlap_gexpr<E>::value, numpy_gexpr &> update_(E const &expr);
template <class Op, class E>
- typename std::enable_if<!may_overlap_gexpr<E>::value, numpy_gexpr &>::type
- update_(E const &expr);
+ std::enable_if_t<!may_overlap_gexpr<E>::value, numpy_gexpr &> update_(E const &expr);
template <class E>
numpy_gexpr &operator+=(E const &expr);
@@ -803,8 +734,7 @@ namespace types
iterator begin();
iterator end();
- auto fast(long i) const & -> decltype(numpy_iexpr_helper<value>::get(*this,
- i))
+ auto fast(long i) const & -> decltype(numpy_iexpr_helper<value>::get(*this, i))
{
return numpy_iexpr_helper<value>::get(*this, i);
}
@@ -818,22 +748,19 @@ namespace types
void store(E elt, Indices... indices)
{
static_assert(is_dtype<E>::value, "valid store");
- *(buffer +
- noffset<value>{}(*this, array_tuple<long, value>{{indices...}})) =
+ *(buffer + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})) =
static_cast<E>(elt);
}
template <class... Indices>
dtype load(Indices... indices) const
{
- return *(buffer +
- noffset<value>{}(*this, array_tuple<long, value>{{indices...}}));
+ return *(buffer + noffset<value>{}(*this, array_tuple<long, value>{{indices...}}));
}
template <class Op, class E, class... Indices>
void update(E elt, Indices... indices) const
{
static_assert(is_dtype<E>::value, "valid store");
- Op{}(*(buffer +
- noffset<value>{}(*this, array_tuple<long, value>{{indices...}})),
+ Op{}(*(buffer + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})),
static_cast<E>(elt));
}
@@ -850,58 +777,52 @@ namespace types
auto operator()(Sp const &...s) const -> decltype(make_gexpr(*this, s...));
template <class Sp>
- auto operator[](Sp const &s) const ->
- typename std::enable_if<is_slice<Sp>::value,
- decltype(make_gexpr(*this,
- (s.lower, s)))>::type;
+ auto operator[](Sp const &s) const
+ -> std::enable_if_t<is_slice<Sp>::value, decltype(make_gexpr(*this, (s.lower, s)))>;
template <size_t M>
- auto fast(array_tuple<long, M> const &indices)
- const & -> decltype(nget<M - 1>().fast(*this, indices));
+ auto fast(array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>().fast(*this,
+ indices));
template <size_t M>
- auto fast(array_tuple<long, M> const &indices)
- && -> decltype(nget<M - 1>().fast(std::move(*this), indices));
+ auto
+ fast(array_tuple<long, M> const &indices) && -> decltype(nget<M - 1>().fast(std::move(*this),
+ indices));
template <size_t M>
- auto operator[](array_tuple<long, M> const &indices)
- const & -> decltype(nget<M - 1>()(*this, indices));
+ auto operator[](
+ array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>()(*this, indices));
template <size_t M>
- auto operator[](array_tuple<long, M> const &indices)
- && -> decltype(nget<M - 1>()(std::move(*this), indices));
+ auto
+ operator[](array_tuple<long, M> const &indices) && -> decltype(nget<M - 1>()(std::move(*this),
+ indices));
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_gexpr, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_gexpr, F>>
operator[](F const &filter) const
{
return {*this, filter};
}
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_gexpr, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_gexpr, F>>
fast(F const &filter) const
{
return {*this, filter};
}
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_gexpr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_gexpr, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_gexpr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_gexpr, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
auto operator[](long i) const -> decltype(this->fast(i));
auto operator[](long i) -> decltype(this->fast(i));
@@ -934,21 +855,16 @@ namespace types
}
template <class Tp, size_t... Is>
- auto recast(utils::index_sequence<Is...>)
- -> decltype(make_gexpr(
- arg.template recast<Tp>(),
- recast_slice<sizeof(dtype), sizeof(Tp)>(std::get<Is>(slices))...))
+ auto recast(std::index_sequence<Is...>)
{
- return make_gexpr(
- arg.template recast<Tp>(),
- recast_slice<sizeof(dtype), sizeof(Tp)>(std::get<Is>(slices))...);
+ return make_gexpr(arg.template recast<Tp>(),
+ recast_slice<sizeof(dtype), sizeof(Tp)>(std::get<Is>(slices))...);
}
template <class Tp>
- auto
- recast() -> decltype(recast<Tp>(utils::make_index_sequence<sizeof...(S)>()))
+ auto recast()
{
- return recast<Tp>(utils::make_index_sequence<sizeof...(S)>());
+ return recast<Tp>(std::make_index_sequence<sizeof...(S)>());
}
};
} // namespace types
@@ -974,8 +890,7 @@ struct assignable<types::numpy_gexpr<Arg, S...>> {
};
template <class Arg, class... S>
-struct lazy<types::numpy_gexpr<Arg, S...>>
- : assignable<types::numpy_gexpr<Arg, S...>> {
+struct lazy<types::numpy_gexpr<Arg, S...>> : assignable<types::numpy_gexpr<Arg, S...>> {
};
PYTHONIC_NS_END
@@ -994,10 +909,8 @@ struct __combined<pythonic::types::numpy_gexpr<Arg, S...>,
using t0 = pythonic::types::numpy_gexpr<Arg, S...>;
using t1 = pythonic::types::numpy_gexpr<Argp, Sp...>;
using type =
- pythonic::types::ndarray <
- typename __combined<typename t0::dtype, typename t1::dtype>::type,
- pythonic::types::array_tuple<
- long, t0::value<t1::value ? t1::value : t0::value>>;
+ pythonic::types::ndarray < typename __combined<typename t0::dtype, typename t1::dtype>::type,
+ pythonic::types::array_tuple<long, t0::value<t1::value ? t1::value : t0::value>>;
};
template <class Arg, class... S, class O>
@@ -1005,20 +918,17 @@ struct __combined<pythonic::types::numpy_gexpr<Arg, S...>, O> {
using type = pythonic::types::numpy_gexpr<Arg, S...>;
};
template <class Arg, class... S, class T>
-struct __combined<pythonic::types::list<T>,
- pythonic::types::numpy_gexpr<Arg, S...>> {
- using type = pythonic::types::list<typename __combined<
- typename pythonic::types::numpy_gexpr<Arg, S...>::value_type, T>::type>;
+struct __combined<pythonic::types::list<T>, pythonic::types::numpy_gexpr<Arg, S...>> {
+ using type = pythonic::types::list<
+ typename __combined<typename pythonic::types::numpy_gexpr<Arg, S...>::value_type, T>::type>;
};
template <class Arg, class... S, class T>
-struct __combined<pythonic::types::numpy_gexpr<Arg, S...>,
- pythonic::types::list<T>> {
- using type = pythonic::types::list<typename __combined<
- typename pythonic::types::numpy_gexpr<Arg, S...>::value_type, T>::type>;
+struct __combined<pythonic::types::numpy_gexpr<Arg, S...>, pythonic::types::list<T>> {
+ using type = pythonic::types::list<
+ typename __combined<typename pythonic::types::numpy_gexpr<Arg, S...>::value_type, T>::type>;
};
template <class Arg, class... S>
-struct __combined<pythonic::types::numpy_gexpr<Arg, S...>,
- pythonic::types::none_type> {
+struct __combined<pythonic::types::numpy_gexpr<Arg, S...>, pythonic::types::none_type> {
using type = pythonic::types::none<pythonic::types::numpy_gexpr<Arg, S...>>;
};
@@ -1033,21 +943,18 @@ struct __combined<O &, pythonic::types::numpy_gexpr<Arg, S...>> {
};
template <class Arg, class... S>
-struct __combined<pythonic::types::none_type,
- pythonic::types::numpy_gexpr<Arg, S...>> {
+struct __combined<pythonic::types::none_type, pythonic::types::numpy_gexpr<Arg, S...>> {
using type = pythonic::types::none<pythonic::types::numpy_gexpr<Arg, S...>>;
};
/* combined are sorted such that the assigned type comes first */
template <class Arg, class... S, class T, class pS>
-struct __combined<pythonic::types::numpy_gexpr<Arg, S...>,
- pythonic::types::ndarray<T, pS>> {
+struct __combined<pythonic::types::numpy_gexpr<Arg, S...>, pythonic::types::ndarray<T, pS>> {
using type = pythonic::types::ndarray<T, pS>;
};
template <class Arg, class... S, class T, class pS>
-struct __combined<pythonic::types::ndarray<T, pS>,
- pythonic::types::numpy_gexpr<Arg, S...>> {
+struct __combined<pythonic::types::ndarray<T, pS>, pythonic::types::numpy_gexpr<Arg, S...>> {
using type = pythonic::types::ndarray<T, pS>;
};
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp
index 99f19d12bdf..c956b5e8806 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_iexpr.hpp
@@ -16,8 +16,7 @@ namespace types
template <class S, class Ty, size_t M>
long operator()(S const &strides, array_tuple<Ty, M> const &indices) const;
template <class S, class Ty, size_t M, class pS>
- long operator()(S const &strides, array_tuple<Ty, M> const &indices,
- pS const &shape) const;
+ long operator()(S const &strides, array_tuple<Ty, M> const &indices, pS const &shape) const;
};
template <class Arg, class... S>
@@ -33,30 +32,22 @@ namespace types
struct numpy_iexpr {
// wrapper around another numpy expression to skip first dimension using a
// given value.
- static constexpr size_t value = std::remove_reference<Arg>::type::value - 1;
- static const bool is_vectorizable =
- std::remove_reference<Arg>::type::is_vectorizable;
- static const bool is_flat = std::remove_reference<Arg>::type::is_flat;
- using dtype = typename std::remove_reference<Arg>::type::dtype;
- using value_type =
- typename std::remove_reference<decltype(numpy_iexpr_helper<value>::get(
- std::declval<numpy_iexpr>(), 0L))>::type;
+ static constexpr size_t value = std::remove_reference_t<Arg>::value - 1;
+ static const bool is_vectorizable = std::remove_reference_t<Arg>::is_vectorizable;
+ static const bool is_flat = std::remove_reference_t<Arg>::is_flat;
+ using dtype = typename std::remove_reference_t<Arg>::dtype;
+ using value_type = std::remove_reference_t<decltype(numpy_iexpr_helper<value>::get(
+ std::declval<numpy_iexpr>(), 0L))>;
- static constexpr bool is_strided =
- std::remove_reference<Arg>::type::is_strided;
+ static constexpr bool is_strided = std::remove_reference_t<Arg>::is_strided;
- using iterator =
- typename std::conditional<is_strided || value != 1,
- nditerator<numpy_iexpr>, dtype *>::type;
+ using iterator = std::conditional_t<is_strided || value != 1, nditerator<numpy_iexpr>, dtype *>;
using const_iterator =
- typename std::conditional<is_strided || value != 1,
- const_nditerator<numpy_iexpr>,
- dtype const *>::type;
+ std::conditional_t<is_strided || value != 1, const_nditerator<numpy_iexpr>, dtype const *>;
Arg arg;
dtype *buffer;
- using shape_t =
- sutils::pop_head_t<typename std::remove_reference<Arg>::type::shape_t>;
+ using shape_t = sutils::pop_head_t<typename std::remove_reference_t<Arg>::shape_t>;
numpy_iexpr();
numpy_iexpr(numpy_iexpr const &) = default;
@@ -73,22 +64,21 @@ namespace types
long size() const;
template <class E0, class E1>
- struct is_almost_same : std::is_same<typename std::decay<E0>::type, typename std::decay<E1>::type> {
+ struct is_almost_same : std::is_same<std::decay_t<E0>, std::decay_t<E1>> {
};
template <class A0, class A1>
struct is_almost_same<numpy_iexpr<A0>, numpy_iexpr<A1>> : is_almost_same<A0, A1> {
};
template <class T, class S0, class S1>
- struct is_almost_same<ndarray<T, S0>, ndarray<T, S1>> : std::integral_constant<bool, (std::tuple_size<S0>::value == std::tuple_size<S1>::value)> {
+ struct is_almost_same<ndarray<T, S0>, ndarray<T, S1>>
+ : std::integral_constant<bool, (std::tuple_size<S0>::value == std::tuple_size<S1>::value)> {
};
- template <class E, class Requires = typename std::enable_if<
- !is_almost_same<numpy_iexpr, E>::value, void>::type>
+ template <class E,
+ class Requires = std::enable_if_t<!is_almost_same<numpy_iexpr, E>::value, void>>
numpy_iexpr &operator=(E const &expr);
- template <class Argp,
- class Requires = typename std::enable_if<
- is_almost_same<Arg, Argp>::value, void>::type>
+ template <class Argp, class Requires = std::enable_if_t<is_almost_same<Arg, Argp>::value, void>>
numpy_iexpr &operator=(numpy_iexpr<Argp> const &expr);
numpy_iexpr &operator=(numpy_iexpr const &expr);
@@ -157,8 +147,7 @@ namespace types
*reference is bound to
* the buffer of ``a`` that is ! temp.
*/
- auto fast(long i) const & -> decltype(numpy_iexpr_helper<value>::get(*this,
- i))
+ auto fast(long i) const & -> decltype(numpy_iexpr_helper<value>::get(*this, i))
{
return numpy_iexpr_helper<value>::get(*this, i);
}
@@ -168,9 +157,7 @@ namespace types
return numpy_iexpr_helper<value>::get(*this, i);
}
- auto
- fast(long i) && -> decltype(numpy_iexpr_helper<value>::get(std::move(*this),
- i))
+ auto fast(long i) && -> decltype(numpy_iexpr_helper<value>::get(std::move(*this), i))
{
return numpy_iexpr_helper<value>::get(std::move(*this), i);
}
@@ -179,17 +166,14 @@ namespace types
dtype &fast(array_tuple<long, value> const &indices);
template <size_t M>
- auto fast(array_tuple<long, M> const &indices) const
- -> decltype(nget<M - 1>()(*this, indices))
+ auto fast(array_tuple<long, M> const &indices) const -> decltype(nget<M - 1>()(*this, indices))
{
return nget<M - 1>()(*this, indices);
}
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_iexpr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_iexpr, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class E, class... Indices>
@@ -197,24 +181,21 @@ namespace types
{
static_assert(is_dtype<E>::value, "valid store");
assert(buffer);
- *(buffer +
- noffset<value>{}(*this, array_tuple<long, value>{{indices...}})) =
+ *(buffer + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})) =
static_cast<E>(elt);
}
template <class... Indices>
dtype load(Indices... indices) const
{
assert(buffer);
- return *(buffer +
- noffset<value>{}(*this, array_tuple<long, value>{{indices...}}));
+ return *(buffer + noffset<value>{}(*this, array_tuple<long, value>{{indices...}}));
}
template <class Op, class E, class... Indices>
void update(E elt, Indices... indices) const
{
static_assert(is_dtype<E>::value, "valid store");
assert(buffer);
- Op{}(*(buffer +
- noffset<value>{}(*this, array_tuple<long, value>{{indices...}})),
+ Op{}(*(buffer + noffset<value>{}(*this, array_tuple<long, value>{{indices...}})),
static_cast<E>(elt));
}
@@ -228,9 +209,8 @@ namespace types
#endif
template <class Sp, class... S>
- typename std::enable_if<
- is_slice<Sp>::value,
- numpy_gexpr<numpy_iexpr, normalize_t<Sp>, normalize_t<S>...>>::type
+ std::enable_if_t<is_slice<Sp>::value,
+ numpy_gexpr<numpy_iexpr, normalize_t<Sp>, normalize_t<S>...>>
operator()(Sp const &s0, S const &...s) const;
template <class... S>
@@ -246,24 +226,21 @@ namespace types
}
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_iexpr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_iexpr, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
auto operator[](long i) const & -> decltype(this->fast(i));
auto operator[](long i) & -> decltype(this->fast(i));
auto operator[](long i) && -> decltype(std::move(*this).fast(i));
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value,
- numpy_gexpr<numpy_iexpr, normalize_t<Sp>>>::type
+ std::enable_if_t<is_slice<Sp>::value, numpy_gexpr<numpy_iexpr, normalize_t<Sp>>>
operator[](Sp const &s0) const;
dtype const &operator[](array_tuple<long, value> const &indices) const;
dtype &operator[](array_tuple<long, value> const &indices);
template <size_t M>
- auto operator[](array_tuple<long, M> const &indices)
- const & -> decltype(nget<M - 1>()(*this, indices))
+ auto operator[](array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>()(*this,
+ indices))
{
return nget<M - 1>()(*this, indices);
}
@@ -282,24 +259,18 @@ namespace types
}
template <class pS>
- auto reshape(pS const &new_shape) const
- -> numpy_iexpr<decltype(std::declval<Arg>().reshape(
- std::declval<sutils::push_front_t<
- pS, typename std::tuple_element<
- 0, typename std::decay<Arg>::type::shape_t>::type>>()))>
+ auto reshape(pS const &new_shape) const -> numpy_iexpr<decltype(std::declval<Arg>().reshape(
+ std::declval<sutils::push_front_t<
+ pS, std::tuple_element_t<0, typename std::decay_t<Arg>::shape_t>>>()))>
{
assert(buffer);
- sutils::push_front_t<
- pS, typename std::tuple_element<
- 0, typename std::decay<Arg>::type::shape_t>::type>
+ sutils::push_front_t<pS, std::tuple_element_t<0, typename std::decay_t<Arg>::shape_t>>
fixed_new_shape;
- sutils::scopy_shape<1, -1>(
- fixed_new_shape, new_shape,
- utils::make_index_sequence<std::tuple_size<pS>::value>{});
+ sutils::scopy_shape<1, -1>(fixed_new_shape, new_shape,
+ std::make_index_sequence<std::tuple_size<pS>::value>{});
sutils::assign(std::get<0>(fixed_new_shape), arg.template shape<0>());
return numpy_iexpr<decltype(arg.reshape(fixed_new_shape))>(
- arg.reshape(fixed_new_shape),
- (buffer - arg.buffer) / arg.template strides<0>());
+ arg.reshape(fixed_new_shape), (buffer - arg.buffer) / arg.template strides<0>());
}
ndarray<dtype, shape_t> copy() const
@@ -316,35 +287,29 @@ namespace types
auto recast() -> decltype(arg.template recast<Tp>().fast(0))
{
long former_index = (buffer - arg.buffer) / arg.template strides<0>();
- return arg.template recast<Tp>().fast(former_index * sizeof(dtype) /
- sizeof(Tp));
+ return arg.template recast<Tp>().fast(former_index * sizeof(dtype) / sizeof(Tp));
}
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_iexpr, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_iexpr, F>>
operator[](F const &filter) const
{
return {*this, filter};
}
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_iexpr, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_iexpr, F>>
operator[](F const &filter)
{
return {*this, filter};
}
template <class Ty>
- auto operator[](std::tuple<Ty> const &index) const
- -> decltype((*this)[std::get<0>(index)])
+ auto operator[](std::tuple<Ty> const &index) const -> decltype((*this)[std::get<0>(index)])
{
return (*this)[std::get<0>(index)];
}
@@ -462,18 +427,16 @@ struct __combined<pythonic::types::numpy_iexpr<E>, container<K>> {
using type = pythonic::types::numpy_iexpr<E>;
};
-template <class E, class Arg, class...S>
+template <class E, class Arg, class... S>
struct __combined<pythonic::types::numpy_iexpr<E>, pythonic::types::numpy_gexpr<Arg, S...>> {
using type = pythonic::types::numpy_iexpr<E>;
};
template <class E0, class E1>
-struct __combined<pythonic::types::numpy_iexpr<E0>,
- pythonic::types::numpy_iexpr<E1>> {
+struct __combined<pythonic::types::numpy_iexpr<E0>, pythonic::types::numpy_iexpr<E1>> {
using type = pythonic::types::numpy_iexpr<typename __combined<E0, E1>::type>;
};
template <class E, class T, class pS>
-struct __combined<pythonic::types::numpy_iexpr<E>,
- pythonic::types::ndarray<T, pS>> {
+struct __combined<pythonic::types::numpy_iexpr<E>, pythonic::types::ndarray<T, pS>> {
using type = pythonic::types::ndarray<T, pS>;
};
/*}*/
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp
index dd42278b3ba..2e307efe941 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_nary_expr.hpp
@@ -26,18 +26,14 @@ namespace functor
NUMPY_NARY_EXTRA_METHOD
template <typename... T>
- auto operator()(T &&...args) const ->
- typename std::enable_if<
- !types::valid_numexpr_parameters<
- typename std::decay<T>::type...>::value,
- decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>::type;
+ auto operator()(T &&...args) const
+ -> std::enable_if_t<!types::valid_numexpr_parameters<std::decay_t<T>...>::value,
+ decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>;
template <class... E>
- typename std::enable_if<
- types::valid_numexpr_parameters<typename std::decay<E>::type...>::value,
- types::numpy_expr<
- NUMPY_NARY_FUNC_NAME,
- typename types::NUMPY_NARY_RESHAPE_MODE<E, E...>::type...>>::type
+ std::enable_if_t<types::valid_numexpr_parameters<std::decay_t<E>...>::value,
+ types::numpy_expr<NUMPY_NARY_FUNC_NAME,
+ typename types::NUMPY_NARY_RESHAPE_MODE<E, E...>::type...>>
operator()(E &&...args) const;
friend std::ostream &operator<<(std::ostream &os, NUMPY_NARY_FUNC_NAME)
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp
index d61e0b875bf..1f556c1f4bd 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_op_helper.hpp
@@ -11,21 +11,18 @@ namespace types
template <class T0, class... Types>
struct all_valid_arg {
- static constexpr bool value =
- all_valid_arg<T0>::value && all_valid_arg<Types...>::value;
+ static constexpr bool value = all_valid_arg<T0>::value && all_valid_arg<Types...>::value;
};
template <class T>
struct all_valid_arg<T> {
static constexpr bool value =
- (is_numexpr_arg<T>::value || is_complex<T>::value ||
- std::is_scalar<T>::value);
+ (is_numexpr_arg<T>::value || is_complex<T>::value || std::is_scalar<T>::value);
};
template <class T0, class... Types>
struct any_numexpr_arg {
- static constexpr bool value =
- any_numexpr_arg<T0>::value || any_numexpr_arg<Types...>::value;
+ static constexpr bool value = any_numexpr_arg<T0>::value || any_numexpr_arg<Types...>::value;
};
template <class T>
@@ -44,8 +41,7 @@ namespace types
template <class T0, class... Types>
struct any_numop_arg {
- static constexpr bool value =
- any_numop_arg<T0>::value || any_numop_arg<Types...>::value;
+ static constexpr bool value = any_numop_arg<T0>::value || any_numop_arg<Types...>::value;
};
template <class T>
@@ -75,22 +71,17 @@ namespace types
template <class... Types>
struct valid_numop_parameters {
- static constexpr bool value =
- any_numop_arg<Types...>::value && all_valid_arg<Types...>::value;
+ static constexpr bool value = any_numop_arg<Types...>::value && all_valid_arg<Types...>::value;
};
template <>
struct valid_numop_parameters<> : std::false_type {
};
- template <class T0, class T1,
- bool numexprarg = valid_numexpr_parameters<T0, T1>::value,
- bool T0_number = is_dtype<T0>::value,
- bool T1_number = is_dtype<T1>::value>
+ template <class T0, class T1, bool numexprarg = valid_numexpr_parameters<T0, T1>::value,
+ bool T0_number = is_dtype<T0>::value, bool T1_number = is_dtype<T1>::value>
struct the_common_type {
- using type =
- typename std::conditional <
- std::decay<T0>::type::value<std::decay<T1>::type::value, T1, T0>::type;
+ using type = std::conditional_t < std::decay_t<T0>::value<std::decay_t<T1>::value, T1, T0>;
};
template <class T0, class T1>
@@ -124,9 +115,8 @@ namespace types
template <class T0, class T1, class... Types>
struct common_type<T0, T1, Types...> {
- using type =
- typename common_type<typename common_type<T0, T1>::type,
- typename common_type<Types...>::type>::type;
+ using type = typename common_type<typename common_type<T0, T1>::type,
+ typename common_type<Types...>::type>::type;
};
/* An adapted type creates a type that has the same shape as C and the same
@@ -144,8 +134,7 @@ namespace types
template <class T, class C>
struct adapted_type<T, C, false, true> {
- using type = broadcast<typename std::decay<C>::type::dtype,
- typename std::decay<T>::type>;
+ using type = broadcast<typename std::decay_t<C>::dtype, std::decay_t<T>>;
};
template <class T, size_t N>
@@ -166,20 +155,16 @@ namespace types
template <class T, class C>
struct adapted_type<T, C, false, false> {
- using type = typename broadcasted_n<
- T, absdiff(std::remove_reference<T>::type::value,
- std::remove_reference<C>::type::value)>::type;
+ using type = typename broadcasted_n<T, absdiff(std::remove_reference_t<T>::value,
+ std::remove_reference_t<C>::value)>::type;
};
template <class T, class... OtherTypes>
struct adapt_type {
- using ctype =
- typename common_type<typename std::decay<T>::type, OtherTypes...>::type;
- static constexpr bool isdtype =
- is_dtype<typename std::decay<T>::type>::value;
- using type = typename adapted_type<
- T, ctype, std::is_same<typename std::decay<T>::type, ctype>::value,
- isdtype>::type;
+ using ctype = typename common_type<std::decay_t<T>, OtherTypes...>::type;
+ static constexpr bool isdtype = is_dtype<std::decay_t<T>>::value;
+ using type =
+ typename adapted_type<T, ctype, std::is_same<std::decay_t<T>, ctype>::value, isdtype>::type;
};
template <class T, class Tp, class... OtherTypes>
struct adapt_type<broadcast<T, Tp>, OtherTypes...> {
@@ -200,8 +185,7 @@ namespace types
template <class T, class C>
struct reshaped_type<T, C, false, true> {
- using type =
- broadcast<typename std::decay<T>::type, typename std::decay<T>::type>;
+ using type = broadcast<std::decay_t<T>, std::decay_t<T>>;
};
template <class T, class C>
@@ -211,13 +195,10 @@ namespace types
template <class T, class... OtherTypes>
struct reshape_type {
- using ctype =
- typename common_type<typename std::decay<T>::type, OtherTypes...>::type;
- static constexpr bool isdtype =
- is_dtype<typename std::decay<T>::type>::value;
- using type = typename reshaped_type<
- T, ctype, std::is_same<typename std::decay<T>::type, ctype>::value,
- isdtype>::type;
+ using ctype = typename common_type<std::decay_t<T>, OtherTypes...>::type;
+ static constexpr bool isdtype = is_dtype<std::decay_t<T>>::value;
+ using type = typename reshaped_type<T, ctype, std::is_same<std::decay_t<T>, ctype>::value,
+ isdtype>::type;
};
template <class T>
struct is_array_index : std::false_type {
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp
index 592bbaf76e7..83b70ff91c0 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_texpr.hpp
@@ -42,9 +42,9 @@ namespace types
Arg arg;
using shape_t = sutils::transpose_t<typename E::shape_t>;
template <size_t I>
- auto shape() const -> decltype(arg.template shape < I == 0 ? 1 : 0 > ())
+ auto shape() const -> decltype(arg.template shape<I == 0 ? 1 : 0>())
{
- return arg.template shape < I == 0 ? 1 : 0 > ();
+ return arg.template shape<I == 0 ? 1 : 0>();
}
numpy_texpr_2();
@@ -64,15 +64,13 @@ namespace types
return this->template shape<0>();
}
- auto fast(long i) const
- -> decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- i));
+ auto fast(long i) const -> decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
+ pythonic::builtins::None),
+ i));
- auto fast(long i)
- -> decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- i));
+ auto fast(long i) -> decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
+ pythonic::builtins::None),
+ i));
auto fast(array_tuple<long, value> const &indices)
-> decltype(arg.fast(array_tuple<long, 2>{{indices[1], indices[0]}}))
{
@@ -110,49 +108,37 @@ namespace types
/* element filtering */
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- F::value != 1 && !is_pod_array<F>::value,
- numpy_vexpr<ndarray<dtype, pshape<long>>,
- ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<dtype, pshape<long>>, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>
fast(F const &filter) const;
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- F::value != 1 && !is_pod_array<F>::value,
- numpy_vexpr<ndarray<dtype, pshape<long>>,
- ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<dtype, pshape<long>>, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2, ndarray<long, pshape<long>>>>
operator[](F const &filter) const;
auto operator[](long i) const -> decltype(this->fast(i));
auto operator[](long i) -> decltype(this->fast(i));
@@ -170,40 +156,29 @@ namespace types
}
template <class T0, class T1>
auto operator[](std::tuple<T0, T1> const &indices)
- -> decltype(arg[std::tuple<T1, T0>{std::get<1>(indices),
- std::get<0>(indices)}])
+ -> decltype(arg[std::tuple<T1, T0>{std::get<1>(indices), std::get<0>(indices)}])
{
- return arg[std::tuple<T1, T0>{std::get<1>(indices),
- std::get<0>(indices)}];
+ return arg[std::tuple<T1, T0>{std::get<1>(indices), std::get<0>(indices)}];
}
template <class T0, class T1>
auto operator[](std::tuple<T0, T1> const &indices) const
- -> decltype(arg[std::tuple<T1, T0>{std::get<1>(indices),
- std::get<0>(indices)}])
+ -> decltype(arg[std::tuple<T1, T0>{std::get<1>(indices), std::get<0>(indices)}])
{
- return arg[std::tuple<T1, T0>{std::get<1>(indices),
- std::get<0>(indices)}];
+ return arg[std::tuple<T1, T0>{std::get<1>(indices), std::get<0>(indices)}];
}
template <class S>
- auto operator[](S const &s0) const
- -> numpy_texpr<
- decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- (s0.step, s0)))>;
+ auto operator[](S const &s0) const -> numpy_texpr<decltype(this->arg(
+ fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), (s0.step, s0)))>;
template <class S>
- auto
- operator[](S const &s0) -> numpy_texpr<decltype(this->arg(
- fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- (s0.step, s0)))>;
+ auto operator[](S const &s0) -> numpy_texpr<decltype(this->arg(
+ fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), (s0.step, s0)))>;
template <class S, size_t... I>
- auto _reverse_index(S const &indices, utils::index_sequence<I...>) const
- -> decltype(numpy::functor::transpose{}(
- this->arg(std::get<I>(indices)...)))
+ auto _reverse_index(S const &indices, std::index_sequence<I...>) const
+ -> decltype(numpy::functor::transpose{}(this->arg(std::get<I>(indices)...)))
{
return numpy::functor::transpose{}(arg(std::get<I>(indices)...));
}
@@ -213,25 +188,20 @@ namespace types
}
template <class Tp, size_t... Is>
- auto
- recast() -> decltype(numpy::functor::transpose{}(arg.template recast<Tp>()))
+ auto recast() -> decltype(numpy::functor::transpose{}(arg.template recast<Tp>()))
{
return numpy::functor::transpose{}(arg.template recast<Tp>());
}
template <class S0, class... S>
- auto operator()(S0 const &s0, S const &...s) const ->
- typename std::enable_if<
- !is_numexpr_arg<S0>::value,
- decltype(this->_reverse_index(
- std::tuple<S0 const &, S const &...>{s0, s...},
- utils::make_reversed_index_sequence<1 + sizeof...(S)>()))>::
- type;
+ auto operator()(S0 const &s0, S const &...s) const -> std::enable_if_t<
+ !is_numexpr_arg<S0>::value,
+ decltype(this->_reverse_index(std::tuple<S0 const &, S const &...>{s0, s...},
+ utils::make_reversed_index_sequence<1 + sizeof...(S)>()))>;
template <class S0, class... S>
- auto operator()(S0 const &s0, S const &...s) const ->
- typename std::enable_if<is_numexpr_arg<S0>::value,
- decltype(this->copy()(s0, s...))>::type;
+ auto operator()(S0 const &s0, S const &...s) const
+ -> std::enable_if_t<is_numexpr_arg<S0>::value, decltype(this->copy()(s0, s...))>;
explicit operator bool() const;
long flat_size() const;
@@ -271,8 +241,7 @@ namespace types
// only implemented for N = 2
template <class T, class S0, class S1>
- struct numpy_texpr<ndarray<T, pshape<S0, S1>>>
- : numpy_texpr_2<ndarray<T, pshape<S0, S1>>> {
+ struct numpy_texpr<ndarray<T, pshape<S0, S1>>> : numpy_texpr_2<ndarray<T, pshape<S0, S1>>> {
numpy_texpr() = default;
numpy_texpr(numpy_texpr const &) = default;
numpy_texpr(numpy_texpr &&) = default;
@@ -296,15 +265,13 @@ namespace types
};
template <class E, class... S>
- struct numpy_texpr<numpy_gexpr<E, S...>>
- : numpy_texpr_2<numpy_gexpr<E, S...>> {
+ struct numpy_texpr<numpy_gexpr<E, S...>> : numpy_texpr_2<numpy_gexpr<E, S...>> {
numpy_texpr() = default;
numpy_texpr(numpy_texpr const &) = default;
numpy_texpr(numpy_texpr &&) = default;
numpy_texpr(numpy_gexpr<E, S...> const &arg);
template <class F>
- numpy_texpr(numpy_texpr<F> const &other)
- : numpy_texpr(numpy_gexpr<E, S...>(other.arg))
+ numpy_texpr(numpy_texpr<F> const &other) : numpy_texpr(numpy_gexpr<E, S...>(other.arg))
{
}
@@ -353,7 +320,7 @@ namespace types
template <size_t I>
long shape() const
{
- return arg.template shape < I == 0 ? 1 : 0 > ();
+ return arg.template shape<I == 0 ? 1 : 0>();
}
auto load(long i, long j) const -> decltype(arg.ref.load(i))
{
@@ -408,13 +375,11 @@ PYTHONIC_NS_END
/* type inference stuff {*/
#include "pythonic/include/types/combined.hpp"
template <class E>
-struct __combined<pythonic::types::numpy_texpr<E>,
- pythonic::types::numpy_texpr<E>> {
+struct __combined<pythonic::types::numpy_texpr<E>, pythonic::types::numpy_texpr<E>> {
using type = pythonic::types::numpy_texpr<E>;
};
template <class E0, class E1>
-struct __combined<pythonic::types::numpy_texpr<E0>,
- pythonic::types::numpy_texpr<E1>> {
+struct __combined<pythonic::types::numpy_texpr<E0>, pythonic::types::numpy_texpr<E1>> {
using type = pythonic::types::numpy_texpr<typename __combined<E0, E1>::type>;
};
@@ -424,21 +389,18 @@ struct __combined<pythonic::types::numpy_texpr<E>, K> {
};
template <class E0, class E1, class... S>
-struct __combined<pythonic::types::numpy_texpr<E0>,
- pythonic::types::numpy_gexpr<E1, S...>> {
+struct __combined<pythonic::types::numpy_texpr<E0>, pythonic::types::numpy_gexpr<E1, S...>> {
using type = pythonic::types::numpy_texpr<E0>;
};
template <class E, class O>
struct __combined<pythonic::types::numpy_texpr<E>, pythonic::types::none<O>> {
- using type = pythonic::types::none<
- typename __combined<pythonic::types::numpy_texpr<E>, O>::type>;
+ using type = pythonic::types::none<typename __combined<pythonic::types::numpy_texpr<E>, O>::type>;
};
template <class E, class O>
struct __combined<pythonic::types::none<O>, pythonic::types::numpy_texpr<E>> {
- using type = pythonic::types::none<
- typename __combined<O, pythonic::types::numpy_texpr<E>>::type>;
+ using type = pythonic::types::none<typename __combined<O, pythonic::types::numpy_texpr<E>>::type>;
};
template <class E>
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_ufunc.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_ufunc.hpp
index 6c97ea92c1c..298a0622831 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_ufunc.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_ufunc.hpp
@@ -10,28 +10,25 @@ namespace types
namespace detail
{
template <class F, typename ResType, typename... ArgTypes, size_t... Is>
- void ufunc_wrapper(char *output, char **inputs, npy_intp n,
- npy_intp output_step, const npy_intp *inputs_steps,
- utils::index_sequence<Is...>)
+ void ufunc_wrapper(char *output, char **inputs, npy_intp n, npy_intp output_step,
+ const npy_intp *inputs_steps, std::index_sequence<Is...>)
{
for (npy_intp i = 0; i < n; ++i) {
*(ResType *)output =
- F{}(*(typename std::tuple_element<Is, std::tuple<ArgTypes...>>::type
- *)(inputs[Is])...);
+ F{}(*(std::tuple_element_t<Is, std::tuple<ArgTypes...>> *)(inputs[Is])...);
output += output_step;
- (void)std::initializer_list<int>{
- ((inputs[Is] += inputs_steps[Is]), 0)...};
+ (void)std::initializer_list<int>{((inputs[Is] += inputs_steps[Is]), 0)...};
}
}
} // namespace detail
template <class F, typename ResType, typename... ArgTypes>
- void ufunc_wrapper(char **args, npy_intp const *dimensions,
- npy_intp const *steps, void * /*extra*/)
+ void ufunc_wrapper(char **args, npy_intp const *dimensions, npy_intp const *steps,
+ void * /*extra*/)
{
npy_intp output_step = steps[sizeof...(ArgTypes)];
return detail::ufunc_wrapper<F, ResType, ArgTypes...>(
args[sizeof...(ArgTypes)], args, dimensions[0], output_step, steps,
- utils::make_index_sequence<sizeof...(ArgTypes)>());
+ std::make_index_sequence<sizeof...(ArgTypes)>());
}
} // namespace types
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_unary_op.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_unary_op.hpp
index 544c05eb1e7..b14e73495fc 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_unary_op.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_unary_op.hpp
@@ -6,9 +6,8 @@
#endif
template <class E>
-typename std::enable_if<
- types::valid_numop_parameters<typename std::decay<E>::type>::value,
- types::numpy_expr<NUMPY_UNARY_FUNC_SYM, E>>::type
+std::enable_if_t<types::valid_numop_parameters<std::decay_t<E>>::value,
+ types::numpy_expr<NUMPY_UNARY_FUNC_SYM, E>>
NUMPY_UNARY_FUNC_NAME(E &&self);
#undef NUMPY_UNARY_FUNC_NAME
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp b/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp
index a58d796f910..7f6f945308d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/numpy_vexpr.hpp
@@ -40,11 +40,9 @@ namespace types
}
template <class E>
- typename std::enable_if<is_iterable<E>::value, numpy_vexpr &>::type
- operator=(E const &);
+ std::enable_if_t<is_iterable<E>::value, numpy_vexpr &> operator=(E const &);
template <class E>
- typename std::enable_if<!is_iterable<E>::value, numpy_vexpr &>::type
- operator=(E const &expr);
+ std::enable_if_t<!is_iterable<E>::value, numpy_vexpr &> operator=(E const &expr);
numpy_vexpr &operator=(numpy_vexpr const &);
@@ -106,9 +104,8 @@ namespace types
}
template <class S>
- typename std::enable_if<
- is_slice<S>::value,
- numpy_gexpr<numpy_vexpr, decltype(std::declval<S>().normalize(1))>>
+ std::enable_if_t<is_slice<S>::value,
+ numpy_gexpr<numpy_vexpr, decltype(std::declval<S>().normalize(1))>>
operator[](S s) const
{
return {*this, s.normalize(size())};
@@ -116,35 +113,27 @@ namespace types
/* element filtering */
template <class E> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<E>::value &&
- std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<E>::value && std::is_same<bool, typename E::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr, ndarray<long, pshape<long>>>>
fast(E const &filter) const;
template <class E> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- !is_slice<E>::value && is_numexpr_arg<E>::value &&
- std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<!is_slice<E>::value && is_numexpr_arg<E>::value &&
+ std::is_same<bool, typename E::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr, ndarray<long, pshape<long>>>>
operator[](E const &filter) const;
template <class E> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<E>::value &&
- !is_array_index<E>::value &&
- !std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr, E>>::type
+ std::enable_if_t<is_numexpr_arg<E>::value && !is_array_index<E>::value &&
+ !std::is_same<bool, typename E::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr, E>>
operator[](E const &filter) const;
template <class E> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<E>::value &&
- !is_array_index<E>::value &&
- !std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr, E>>::type
+ std::enable_if_t<is_numexpr_arg<E>::value && !is_array_index<E>::value &&
+ !std::is_same<bool, typename E::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr, E>>
fast(E const &filter) const;
template <class Op, class Expr>
@@ -175,28 +164,25 @@ namespace types
template <class T, class F>
struct assignable<types::numpy_vexpr<T, F>> {
- using type = types::ndarray<typename types::dtype_of<T>::type,
- typename types::numpy_vexpr<T, F>::shape_t>;
+ using type =
+ types::ndarray<typename types::dtype_of<T>::type, typename types::numpy_vexpr<T, F>::shape_t>;
};
template <class T, class F>
struct lazy<types::numpy_vexpr<T, F>> {
- using type =
- types::numpy_vexpr<typename lazy<T>::type, typename lazy<F>::type>;
+ using type = types::numpy_vexpr<typename lazy<T>::type, typename lazy<F>::type>;
};
PYTHONIC_NS_END
/* combined are sorted such that the assigned type comes first */
template <class E, class F, class T, class pS>
-struct __combined<pythonic::types::numpy_vexpr<E, F>,
- pythonic::types::ndarray<T, pS>> {
+struct __combined<pythonic::types::numpy_vexpr<E, F>, pythonic::types::ndarray<T, pS>> {
using type = pythonic::types::ndarray<T, pS>;
};
template <class E, class F, class T, class pS>
-struct __combined<pythonic::types::ndarray<T, pS>,
- pythonic::types::numpy_vexpr<E, F>> {
+struct __combined<pythonic::types::ndarray<T, pS>, pythonic::types::numpy_vexpr<E, F>> {
using type = pythonic::types::ndarray<T, pS>;
};
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp b/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp
index ee6fddb21cf..727922539f1 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/pointer.hpp
@@ -25,16 +25,13 @@ PYTHONIC_NS_END
namespace std
{
template <size_t I, class T>
- typename pythonic::types::pointer<T>::reference
- get(pythonic::types::pointer<T> &t);
+ typename pythonic::types::pointer<T>::reference get(pythonic::types::pointer<T> &t);
template <size_t I, class T>
- typename pythonic::types::pointer<T>::value_type
- get(pythonic::types::pointer<T> const &t);
+ typename pythonic::types::pointer<T>::value_type get(pythonic::types::pointer<T> const &t);
template <size_t I, class T>
- typename pythonic::types::pointer<T>::value_type
- get(pythonic::types::pointer<T> &&t);
+ typename pythonic::types::pointer<T>::value_type get(pythonic::types::pointer<T> &&t);
template <size_t I, class T>
struct tuple_element<I, pythonic::types::pointer<T>> {
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/set.hpp b/contrib/python/pythran/pythran/pythonic/include/types/set.hpp
index cb07955def3..ffa346d1b67 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/set.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/set.hpp
@@ -15,7 +15,7 @@
#include <algorithm>
#include <iterator>
#include <limits>
-#include <set>
+#include <unordered_set>
#include <utility>
PYTHONIC_NS_BEGIN
@@ -106,14 +106,12 @@ struct __combined<pythonic::types::set<V>, indexable<K>> {
template <class K, class V1, class V2>
struct __combined<indexable_container<K, V1>, pythonic::types::set<V2>> {
- using type =
- pythonic::types::set<decltype(std::declval<V1>() + std::declval<V2>())>;
+ using type = pythonic::types::set<decltype(std::declval<V1>() + std::declval<V2>())>;
};
template <class K, class V1, class V2>
struct __combined<pythonic::types::set<V2>, indexable_container<K, V1>> {
- using type =
- pythonic::types::set<decltype(std::declval<V1>() + std::declval<V2>())>;
+ using type = pythonic::types::set<decltype(std::declval<V1>() + std::declval<V2>())>;
};
template <class T0, class T1>
@@ -133,10 +131,9 @@ namespace types
{
// data holder
- using _type =
- typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+ using _type = std::remove_cv_t<std::remove_reference_t<T>>;
using container_type =
- std::set<_type, std::less<_type>, utils::allocator<_type>>;
+ std::unordered_set<_type, std::hash<_type>, std::equal_to<_type>, utils::allocator<_type>>;
utils::shared_ref<container_type> data;
public:
@@ -146,19 +143,14 @@ namespace types
// types
using reference = typename container_type::reference;
using const_reference = typename container_type::const_reference;
- using iterator =
- utils::comparable_iterator<typename container_type::iterator>;
- using const_iterator =
- utils::comparable_iterator<typename container_type::const_iterator>;
+ using iterator = typename container_type::iterator;
+ using const_iterator = typename container_type::const_iterator;
using size_type = typename container_type::size_type;
using difference_type = typename container_type::difference_type;
using value_type = typename container_type::value_type;
using allocator_type = typename container_type::allocator_type;
using pointer = typename container_type::pointer;
using const_pointer = typename container_type::const_pointer;
- using reverse_iterator = typename container_type::reverse_iterator;
- using const_reverse_iterator =
- typename container_type::const_reverse_iterator;
// constructors
set();
@@ -175,10 +167,6 @@ namespace types
const_iterator begin() const;
iterator end();
const_iterator end() const;
- reverse_iterator rbegin();
- const_reverse_iterator rbegin() const;
- reverse_iterator rend();
- const_reverse_iterator rend() const;
// modifiers
T pop();
@@ -213,8 +201,7 @@ namespace types
set<T> union_() const;
template <typename U, typename... Types>
- typename __combined<set<T>, U, Types...>::type
- union_(U &&other, Types &&...others) const;
+ typename __combined<set<T>, U, Types...>::type union_(U &&other, Types &&...others) const;
template <typename... Types>
none_type update(Types &&...others);
@@ -222,8 +209,8 @@ namespace types
set<T> intersection() const;
template <typename U, typename... Types>
- typename __combined<set<T>, U, Types...>::type
- intersection(U const &other, Types const &...others) const;
+ typename __combined<set<T>, U, Types...>::type intersection(U const &other,
+ Types const &...others) const;
template <typename... Types>
void intersection_update(Types const &...others);
@@ -240,12 +227,10 @@ namespace types
void difference_update(Types const &...others);
template <typename U>
- set<typename __combined<T, U>::type>
- symmetric_difference(set<U> const &other) const;
+ set<typename __combined<T, U>::type> symmetric_difference(set<U> const &other) const;
template <typename U>
- typename __combined<U, set<T>>::type
- symmetric_difference(U const &other) const;
+ typename __combined<U, set<T>>::type symmetric_difference(U const &other) const;
template <typename U>
void symmetric_difference_update(U const &other);
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/slice.hpp b/contrib/python/pythran/pythran/pythonic/include/types/slice.hpp
index 75de78d4fce..22e077afa17 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/slice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/slice.hpp
@@ -62,8 +62,7 @@ namespace types
normalized_slice operator*(normalized_slice const &other) const;
template <long stride>
- normalized_slice
- operator*(cstride_normalized_slice<stride> const &other) const;
+ normalized_slice operator*(cstride_normalized_slice<stride> const &other) const;
normalized_slice operator*(slice const &other) const;
template <long stride>
normalized_slice operator*(cstride_slice<stride> const &other) const;
@@ -112,19 +111,16 @@ namespace types
normalized_slice operator*(normalized_slice const &other) const;
template <long other_stride>
- typename std::conditional<(stride < 256 && other_stride < 256),
- cstride_normalized_slice<stride * other_stride>,
- normalized_slice>::type
+ std::conditional_t<(stride < 256 && other_stride < 256),
+ cstride_normalized_slice<stride * other_stride>, normalized_slice>
operator*(cstride_normalized_slice<other_stride> const &other) const;
normalized_slice operator*(slice const &other) const;
template <long other_stride>
- typename std::conditional<(stride < 256 && other_stride < 256),
- cstride_normalized_slice<stride * other_stride>,
- normalized_slice>::type
+ std::conditional_t<(stride < 256 && other_stride < 256),
+ cstride_normalized_slice<stride * other_stride>, normalized_slice>
operator*(cstride_slice<other_stride> const &other) const;
- cstride_normalized_slice
- operator*(fast_contiguous_slice const &other) const;
+ cstride_normalized_slice operator*(fast_contiguous_slice const &other) const;
long size() const;
inline long get(long i) const;
@@ -146,8 +142,8 @@ namespace types
slice operator*(slice const &other) const;
template <long other_stride>
- typename std::conditional<(stride < 256 && other_stride < 256),
- cstride_slice<stride * other_stride>, slice>::type
+ std::conditional_t<(stride < 256 && other_stride < 256), cstride_slice<stride * other_stride>,
+ slice>
operator*(cstride_slice<other_stride> const &other) const;
cstride_slice operator*(fast_contiguous_slice const &other) const;
@@ -231,15 +227,14 @@ namespace types
struct is_normalized_slice<normalized_slice> : std::true_type {
};
template <long stride>
- struct is_normalized_slice<cstride_normalized_slice<stride>>
- : std::true_type {
+ struct is_normalized_slice<cstride_normalized_slice<stride>> : std::true_type {
};
template <class S>
using normalize_t = typename normalized<S>::type;
template <class S>
- typename std::enable_if<!is_slice<S>::value, S>::type normalize(S s, long n)
+ std::enable_if_t<!is_slice<S>::value, S> normalize(S s, long n)
{
if (s < 0)
s += n;
@@ -286,8 +281,8 @@ namespace types
return s;
}
template <class I0, class I1>
- fast_contiguous_slice adapt_slice(fast_contiguous_slice const &s,
- I0 const &index0, I1 const &index1)
+ fast_contiguous_slice adapt_slice(fast_contiguous_slice const &s, I0 const &index0,
+ I1 const &index1)
{
if ((long)index0 != (long)index1)
return {0, 1};
@@ -296,8 +291,7 @@ namespace types
}
template <class S>
- typename std::enable_if<is_slice<S>::value, std::ostream &>::type
- operator<<(std::ostream &os, S const &s);
+ std::enable_if_t<is_slice<S>::value, std::ostream &> operator<<(std::ostream &os, S const &s);
} // namespace types
namespace builtins
{
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp b/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp
index f5cb1f7038a..66db7ff81cf 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/static_if.hpp
@@ -103,18 +103,15 @@ namespace types
StaticIfReturnHolder(StaticIfReturnHolder<T0, T1> const &) = default;
template <class Tp0, class Tp1>
- StaticIfReturnHolder(StaticIfReturnHolder<Tp0, Tp1> const &other)
- : args(other.args)
+ StaticIfReturnHolder(StaticIfReturnHolder<Tp0, Tp1> const &other) : args(other.args)
{
}
template <class Tp0>
- StaticIfReturnHolder(StaticIfReturn<Tp0> const &arg)
- : args(1, arg.arg, T1())
+ StaticIfReturnHolder(StaticIfReturn<Tp0> const &arg) : args(1, arg.arg, T1())
{
}
- StaticIfReturnHolder(StaticIfNoReturn<T1> const &arg)
- : args(0, T0(), arg.arg)
+ StaticIfReturnHolder(StaticIfNoReturn<T1> const &arg) : args(0, T0(), arg.arg)
{
}
StaticIfReturnHolder(StaticIfBreak<T1> const &arg) : args(2, T0(), arg.arg)
@@ -132,21 +129,18 @@ namespace std
{
template <size_t I, class T0, class T1>
struct tuple_element<I, pythonic::types::StaticIfReturnHolder<T0, T1>> {
- using type = typename std::conditional<
- I == 0, bool, typename std::conditional<I == 1, T0, T1>::type>::type;
+ using type = std::conditional_t<I == 0, bool, std::conditional_t<I == 1, T0, T1>>;
};
template <size_t I, class T0, class T1>
- auto get(pythonic::types::StaticIfReturnHolder<T0, T1> &t)
- -> decltype(std::get<I>(t.args))
+ auto get(pythonic::types::StaticIfReturnHolder<T0, T1> &t) -> decltype(std::get<I>(t.args))
{
return std::get<I>(t.args);
}
template <size_t I, class T>
struct tuple_element<I, pythonic::types::StaticIfNoReturn<T>> {
- using type =
- decltype(std::declval<pythonic::types::StaticIfNoReturn<T>>().get(
- std::integral_constant<size_t, I>{}));
+ using type = decltype(std::declval<pythonic::types::StaticIfNoReturn<T>>().get(
+ std::integral_constant<size_t, I>{}));
};
template <size_t I, class T>
@@ -187,104 +181,82 @@ namespace std
#include "pythonic/include/types/combined.hpp"
template <class T0, class T1>
-struct __combined<pythonic::types::StaticIfReturn<T0>,
- pythonic::types::StaticIfNoReturn<T1>> {
+struct __combined<pythonic::types::StaticIfReturn<T0>, pythonic::types::StaticIfNoReturn<T1>> {
using type = pythonic::types::StaticIfReturnHolder<T0, T1>;
};
template <class T0, class T1>
-struct __combined<pythonic::types::StaticIfReturn<T0>,
- pythonic::types::StaticIfBreak<T1>> {
+struct __combined<pythonic::types::StaticIfReturn<T0>, pythonic::types::StaticIfBreak<T1>> {
using type = pythonic::types::StaticIfReturnHolder<T0, T1>;
};
template <class T0, class T1>
-struct __combined<pythonic::types::StaticIfReturn<T0>,
- pythonic::types::StaticIfCont<T1>> {
+struct __combined<pythonic::types::StaticIfReturn<T0>, pythonic::types::StaticIfCont<T1>> {
using type = pythonic::types::StaticIfReturnHolder<T0, T1>;
};
template <class T0, class T1>
-struct __combined<pythonic::types::StaticIfNoReturn<T1>,
- pythonic::types::StaticIfReturn<T0>> {
+struct __combined<pythonic::types::StaticIfNoReturn<T1>, pythonic::types::StaticIfReturn<T0>> {
using type = pythonic::types::StaticIfReturnHolder<T0, T1>;
};
template <class T0>
-struct __combined<pythonic::types::StaticIfNoReturn<T0> &,
- pythonic::types::none_type> {
+struct __combined<pythonic::types::StaticIfNoReturn<T0> &, pythonic::types::none_type> {
using type = pythonic::types::none_type;
};
template <class T0>
-struct __combined<pythonic::types::StaticIfNoReturn<T0>,
- pythonic::types::none_type> {
+struct __combined<pythonic::types::StaticIfNoReturn<T0>, pythonic::types::none_type> {
using type = pythonic::types::none_type;
};
template <class T0>
-struct __combined<pythonic::types::none_type,
- pythonic::types::StaticIfNoReturn<T0>> {
+struct __combined<pythonic::types::none_type, pythonic::types::StaticIfNoReturn<T0>> {
using type = pythonic::types::none_type;
};
template <class T0, class T1>
-struct __combined<pythonic::types::StaticIfBreak<T1>,
- pythonic::types::StaticIfReturn<T0>> {
+struct __combined<pythonic::types::StaticIfBreak<T1>, pythonic::types::StaticIfReturn<T0>> {
using type = pythonic::types::StaticIfReturnHolder<T0, T1>;
};
template <class T0, class T1>
-struct __combined<pythonic::types::StaticIfCont<T1>,
- pythonic::types::StaticIfReturn<T0>> {
+struct __combined<pythonic::types::StaticIfCont<T1>, pythonic::types::StaticIfReturn<T0>> {
using type = pythonic::types::StaticIfReturnHolder<T0, T1>;
};
template <class T0, class T1, class T2, class T3>
struct __combined<pythonic::types::StaticIfReturnHolder<T0, T1>,
pythonic::types::StaticIfReturnHolder<T2, T3>> {
- using type =
- pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
- typename __combined<T1, T3>::type>;
+ using type = pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
+ typename __combined<T1, T3>::type>;
};
template <class T0, class T1, class T2>
struct __combined<pythonic::types::StaticIfReturnHolder<T0, T1>,
pythonic::types::StaticIfCont<T2>> {
- using type =
- pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
- T1>;
+ using type = pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type, T1>;
};
template <class T0, class T1, class T2>
struct __combined<pythonic::types::StaticIfReturnHolder<T0, T1>,
pythonic::types::StaticIfBreak<T2>> {
- using type =
- pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
- T1>;
+ using type = pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type, T1>;
};
template <class T0, class T1, class T2>
struct __combined<pythonic::types::StaticIfReturnHolder<T0, T1>,
pythonic::types::StaticIfReturn<T2>> {
- using type =
- pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
- T1>;
+ using type = pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type, T1>;
};
template <class T0, class T1, class T2>
struct __combined<pythonic::types::StaticIfCont<T2>,
pythonic::types::StaticIfReturnHolder<T0, T1>> {
- using type =
- pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
- T1>;
+ using type = pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type, T1>;
};
template <class T0, class T1, class T2>
struct __combined<pythonic::types::StaticIfBreak<T2>,
pythonic::types::StaticIfReturnHolder<T0, T1>> {
- using type =
- pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
- T1>;
+ using type = pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type, T1>;
};
template <class T0, class T1, class T2>
struct __combined<pythonic::types::StaticIfReturn<T2>,
pythonic::types::StaticIfReturnHolder<T0, T1>> {
- using type =
- pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type,
- T1>;
+ using type = pythonic::types::StaticIfReturnHolder<typename __combined<T0, T2>::type, T1>;
};
template <class T0, class T1>
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/str.hpp b/contrib/python/pythran/pythran/pythonic/include/types/str.hpp
index ca373c734fc..20514af0417 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/str.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/str.hpp
@@ -105,8 +105,7 @@ namespace types
chr operator[](long i) const;
chr fast(long i) const;
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value, sliced_str<Sp>>::type
- operator[](Sp const &s) const;
+ std::enable_if_t<is_slice<Sp>::value, sliced_str<Sp>> operator[](Sp const &s) const;
// conversion
operator long() const;
@@ -119,8 +118,7 @@ namespace types
// io
template <class SS>
- friend std::ostream &operator<<(std::ostream &os,
- types::sliced_str<SS> const &v);
+ friend std::ostream &operator<<(std::ostream &os, types::sliced_str<SS> const &v);
};
struct string_iterator;
@@ -209,15 +207,13 @@ namespace types
bool operator==(chr other) const;
template <class S>
- typename std::enable_if<is_slice<S>::value, sliced_str<S>>::type
- operator()(S const &s) const;
+ std::enable_if_t<is_slice<S>::value, sliced_str<S>> operator()(S const &s) const;
chr operator[](long i) const;
chr fast(long i) const;
template <class S>
- typename std::enable_if<is_slice<S>::value, sliced_str<S>>::type
- operator[](S const &s) const;
+ std::enable_if_t<is_slice<S>::value, sliced_str<S>> operator[](S const &s) const;
explicit operator bool() const;
long count(types::str const &sub) const;
@@ -228,8 +224,8 @@ namespace types
}
};
- struct string_iterator : std::iterator<std::random_access_iterator_tag, str,
- std::ptrdiff_t, str *, str> {
+ struct string_iterator
+ : std::iterator<std::random_access_iterator_tag, str, std::ptrdiff_t, str *, str> {
std::string::const_iterator curr;
string_iterator() = default;
string_iterator(std::string::const_iterator iter) : curr(iter)
@@ -275,14 +271,21 @@ namespace types
{
return curr != other.curr;
}
+ bool operator<(string_iterator const &other) const
+ {
+ return curr < other.curr;
+ }
+ bool operator<=(string_iterator const &other) const
+ {
+ return curr <= other.curr;
+ }
std::ptrdiff_t operator-(string_iterator const &other) const
{
return curr - other.curr;
}
};
struct const_sliced_str_iterator
- : std::iterator<std::random_access_iterator_tag, str, std::ptrdiff_t,
- str *, str> {
+ : std::iterator<std::random_access_iterator_tag, str, std::ptrdiff_t, str *, str> {
const char *data;
long step;
const_sliced_str_iterator(char const *data, long step);
@@ -328,9 +331,8 @@ namespace operator_
{
template <size_t N, class Arg>
- auto mod(const char (&fmt)[N],
- Arg &&arg) -> decltype(pythonic::types::str(fmt) %
- std::forward<Arg>(arg));
+ auto mod(const char (&fmt)[N], Arg &&arg)
+ -> decltype(pythonic::types::str(fmt) % std::forward<Arg>(arg));
pythonic::types::str add(char const *self, char const *other);
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp b/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp
index c14ca8fce6f..d3e3a4b2487 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/traits.hpp
@@ -20,36 +20,31 @@ namespace types
template <class T>
struct is_dtype {
- static constexpr bool value =
- std::is_scalar<T>::value || is_complex<T>::value;
+ static constexpr bool value = std::is_scalar<T>::value || is_complex<T>::value;
};
-#define MEMBER_TYPE_TRAIT(check_struct, member) \
- template <typename T> \
- struct check_struct { \
- using yes = char; \
- using no = struct { \
- char _[2]; \
- }; \
- template <class C> \
- static yes _test(typename C::member *); \
- template <class C> \
- static no _test(...); \
- static const bool value = \
- sizeof(_test<typename std::remove_reference<T>::type>(nullptr)) == \
- sizeof(yes); \
+#define MEMBER_TYPE_TRAIT(check_struct, member) \
+ template <typename T> \
+ struct check_struct { \
+ using yes = char; \
+ using no = struct { \
+ char _[2]; \
+ }; \
+ template <class C> \
+ static yes _test(typename C::member *); \
+ template <class C> \
+ static no _test(...); \
+ static const bool value = sizeof(_test<std::remove_reference_t<T>>(nullptr)) == sizeof(yes); \
};
-#define MEMBER_ATTR_TRAIT(check_struct, member) \
- template <typename T> \
- struct check_struct { \
- template <class C> \
- static std::integral_constant<bool, true> _test(decltype(&C::member)); \
- template <class C> \
- static std::integral_constant<bool, false> _test(...); \
- static const bool value = \
- decltype(_test<typename std::remove_reference<T>::type>( \
- nullptr))::value; \
+#define MEMBER_ATTR_TRAIT(check_struct, member) \
+ template <typename T> \
+ struct check_struct { \
+ template <class C> \
+ static std::integral_constant<bool, true> _test(decltype(&C::member)); \
+ template <class C> \
+ static std::integral_constant<bool, false> _test(...); \
+ static const bool value = decltype(_test<std::remove_reference_t<T>>(nullptr))::value; \
};
/* trait to check if a type is iterable*/
@@ -74,8 +69,8 @@ namespace types
template <typename T, class V>
struct has_contains {
template <class C>
- static auto _test(C *t) -> decltype(t->contains(std::declval<V>()),
- std::integral_constant<bool, true>());
+ static auto _test(C *t)
+ -> decltype(t->contains(std::declval<V>()), std::integral_constant<bool, true>());
static std::integral_constant<bool, false> _test(...);
static const bool value = decltype(_test((T *)nullptr))::value;
};
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp b/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp
index a8f072cafba..33b8ef6894b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/tuple.hpp
@@ -42,8 +42,7 @@ std::tuple<Types0..., Types1...> operator+(std::tuple<Types0...> const &t0,
std::tuple<Types1...> &&t1);
template <class... Types0, class... Types1>
-std::tuple<Types0..., Types1...> operator+(std::tuple<Types0...> &&t0,
- std::tuple<Types1...> &&t1);
+std::tuple<Types0..., Types1...> operator+(std::tuple<Types0...> &&t0, std::tuple<Types1...> &&t1);
PYTHONIC_NS_BEGIN
@@ -92,7 +91,7 @@ namespace types
/* helper to extract the tail of a tuple, && pop the head */
template <int Offset, class T, size_t... N>
- auto make_tuple_tail(T const &t, utils::index_sequence<N...>)
+ auto make_tuple_tail(T const &t, std::index_sequence<N...>)
-> decltype(std::make_tuple(std::get<Offset + 1 + N>(t)...))
{
return std::make_tuple(std::get<Offset + 1 + N>(t)...);
@@ -113,17 +112,14 @@ namespace types
template <class S, class... Stail>
auto tuple_pop(std::tuple<S, Stail...> const &t)
-> decltype(make_tuple_tail<count_trailing_long<Stail...>::value>(
- t,
- utils::make_index_sequence<sizeof...(Stail) -
- count_trailing_long<Stail...>::value>{}))
+ t, std::make_index_sequence<sizeof...(Stail) - count_trailing_long<Stail...>::value>{}))
{
return make_tuple_tail<count_trailing_long<Stail...>::value>(
- t, utils::make_index_sequence<sizeof...(Stail) -
- count_trailing_long<Stail...>::value>{});
+ t, std::make_index_sequence<sizeof...(Stail) - count_trailing_long<Stail...>::value>{});
}
template <class A, size_t... I, class... Types>
- std::tuple<Types...> array_to_tuple(A const &a, utils::index_sequence<I...>,
+ std::tuple<Types...> array_to_tuple(A const &a, std::index_sequence<I...>,
utils::type_sequence<Types...>)
{
return std::tuple<Types...>(a[I]...);
@@ -155,8 +151,7 @@ namespace types
return {};
}
template <long N>
- std::integral_constant<long, N> check_type(std::integral_constant<long, N>,
- long v)
+ std::integral_constant<long, N> check_type(std::integral_constant<long, N>, long v)
{
assert(N == v && "consistent init");
return {};
@@ -171,55 +166,49 @@ namespace types
template <class... Tys>
struct pshape {
- static_assert(utils::all_of<is_pshape_element<Tys>::value...>::value,
- "valid pshape");
+ static_assert(utils::all_of<is_pshape_element<Tys>::value...>::value, "valid pshape");
std::tuple<Tys...> values;
template <class... Args, size_t... Is>
- pshape(std::tuple<Args...> const &v, utils::index_sequence<Is...>)
+ pshape(std::tuple<Args...> const &v, std::index_sequence<Is...>)
: values{check_type(std::get<Is>(values), std::get<Is>(v))...}
{
}
template <class... Args>
- pshape(std::tuple<Args...> const &v)
- : pshape(v, utils::make_index_sequence<sizeof...(Args)>())
+ pshape(std::tuple<Args...> const &v) : pshape(v, std::make_index_sequence<sizeof...(Args)>())
{
}
template <class... Args>
pshape(long arg, Args... args)
- : pshape(std::make_tuple(arg, args...),
- utils::make_index_sequence<1 + sizeof...(args)>())
+ : pshape(std::make_tuple(arg, args...), std::make_index_sequence<1 + sizeof...(args)>())
{
}
template <class T, T N, class... Args>
pshape(std::integral_constant<T, N> arg, Args... args)
- : pshape(std::make_tuple(arg, args...),
- utils::make_index_sequence<1 + sizeof...(args)>())
+ : pshape(std::make_tuple(arg, args...), std::make_index_sequence<1 + sizeof...(args)>())
{
}
template <class S, size_t... Is>
- pshape(S const *buffer, utils::index_sequence<Is...>)
+ pshape(S const *buffer, std::index_sequence<Is...>)
: values{check_type(std::get<Is>(values), buffer[Is])...}
{
}
template <class S>
- pshape(S const *buffer)
- : pshape(buffer, utils::make_index_sequence<sizeof...(Tys)>())
+ pshape(S const *buffer) : pshape(buffer, std::make_index_sequence<sizeof...(Tys)>())
{
}
template <class... TyOs>
pshape(pshape<TyOs...> other)
- : pshape(other.values, utils::make_index_sequence<sizeof...(TyOs)>())
+ : pshape(other.values, std::make_index_sequence<sizeof...(TyOs)>())
{
static_assert(sizeof...(TyOs) == sizeof...(Tys), "compatible sizes");
}
template <class S, class V>
- pshape(pythonic::types::array_base<S, sizeof...(Tys), V> data)
- : pshape(data.data())
+ pshape(pythonic::types::array_base<S, sizeof...(Tys), V> data) : pshape(data.data())
{
}
@@ -230,15 +219,14 @@ namespace types
pshape &operator=(pshape &&) = default;
template <size_t... Is>
- types::array_tuple<long, sizeof...(Tys)>
- array(utils::index_sequence<Is...>) const
+ types::array_tuple<long, sizeof...(Tys)> array(std::index_sequence<Is...>) const
{
return {{get<Is>()...}};
}
types::array_tuple<long, sizeof...(Tys)> array() const
{
- return array(utils::make_index_sequence<sizeof...(Tys)>());
+ return array(std::make_index_sequence<sizeof...(Tys)>());
}
operator types::array_tuple<long, sizeof...(Tys)>() const
{
@@ -270,8 +258,7 @@ namespace types
};
template <class P, size_t M, class... Ss>
- struct shape_builder
- : shape_builder<typename P::value_type, M - 1, Ss..., long> {
+ struct shape_builder : shape_builder<typename P::value_type, M - 1, Ss..., long> {
};
struct array_base_slicer {
@@ -279,16 +266,14 @@ namespace types
dynamic_tuple<T> operator()(array_tuple<T, N> const &b, slice const &s);
template <class T, size_t N, long stride>
- dynamic_tuple<T> operator()(array_tuple<T, N> const &b,
- cstride_slice<stride> const &s);
+ dynamic_tuple<T> operator()(array_tuple<T, N> const &b, cstride_slice<stride> const &s);
template <class T, size_t N>
- dynamic_tuple<T> operator()(array_tuple<T, N> const &b,
- fast_contiguous_slice const &s);
+ dynamic_tuple<T> operator()(array_tuple<T, N> const &b, fast_contiguous_slice const &s);
template <class T, size_t N, class S>
- typename std::enable_if<is_slice<S>::value, sliced_list<T, S>>::type
- operator()(static_list<T, N> const &b, S const &s)
+ std::enable_if_t<is_slice<S>::value, sliced_list<T, S>> operator()(static_list<T, N> const &b,
+ S const &s)
{
return {b, s};
}
@@ -326,8 +311,7 @@ namespace types
// minimal ndarray interface
using dtype = typename utils::nested_container_value_type<array_base>::type;
- static const size_t value =
- utils::nested_container_depth<array_base>::value;
+ static const size_t value = utils::nested_container_depth<array_base>::value;
static const bool is_vectorizable = true;
static const bool is_flat = true;
static const bool is_strided = false;
@@ -405,8 +389,7 @@ namespace types
const_reference operator[](long __n) const noexcept;
template <class S>
- auto operator[](S s) const -> decltype(array_base_slicer{}(*this,
- (s.lower, s)))
+ auto operator[](S s) const -> decltype(array_base_slicer{}(*this, (s.lower, s)))
{
return array_base_slicer{}(*this, s);
}
@@ -426,8 +409,7 @@ namespace types
template <class K, class V>
operator std::pair<const K, V>() const
{
- static_assert(std::is_same<K, T>::value && std::is_same<V, T>::value &&
- N == 2,
+ static_assert(std::is_same<K, T>::value && std::is_same<V, T>::value && N == 2,
"compatible conversion");
return {data()[0], data()[1]};
}
@@ -452,10 +434,9 @@ namespace types
template <class Tp>
operator array_base<Tp, N, Version>() const;
- auto to_tuple() const
- -> decltype(array_to_tuple(*this, utils::make_index_sequence<N>{},
+ auto to_tuple() const -> decltype(array_to_tuple(*this, std::make_index_sequence<N>{},
- utils::make_repeated_type<T, N>()));
+ utils::make_repeated_type<T, N>()));
template <class W>
array_base<T, N, W> to_array() const;
@@ -479,13 +460,11 @@ namespace types
/* array */
template <class T1, size_t N1, class Version1>
- friend std::ostream &
- operator<<(std::ostream &os, types::array_base<T1, N1, Version1> const &v);
+ friend std::ostream &operator<<(std::ostream &os, types::array_base<T1, N1, Version1> const &v);
using shape_t = typename shape_builder<array_base, value>::type;
template <size_t I>
- auto shape() const -> decltype(details::extract_shape(*this,
- utils::int_<I>{}))
+ auto shape() const -> decltype(details::extract_shape(*this, utils::int_<I>{}))
{
return details::extract_shape(*this, utils::int_<I>{});
}
@@ -509,8 +488,7 @@ namespace types
template <class T>
struct alike<T> {
static bool const value = true;
- using type = typename std::remove_cv<
- typename std::remove_reference<T>::type>::type;
+ using type = std::remove_cv_t<std::remove_reference_t<T>>;
};
template <class A, class... S>
struct alike<numpy_gexpr<A, S...>, numpy_gexpr<A const &, S...>> {
@@ -521,7 +499,7 @@ namespace types
template <class T0, class T1>
struct alike<T0, T1> {
static bool const value = std::is_same<T0, T1>::value;
- using type = typename std::conditional<value, T0, void>::type;
+ using type = std::conditional_t<value, T0, void>;
};
// specialization to make static string alike types::str
@@ -547,14 +525,10 @@ namespace types
struct alike<std::tuple<Types...>, array_base<T, N, V>> {
static bool const value =
sizeof...(Types) == N &&
- alike<T, typename std::remove_cv<typename std::remove_reference<
- Types>::type>::type...>::value;
- using type = typename std::conditional<
- value,
- typename alike<T,
- typename std::remove_cv<typename std::remove_reference<
- Types>::type>::type...>::type,
- void>::type;
+ alike<T, std::remove_cv_t<std::remove_reference_t<Types>>...>::value;
+ using type = std::conditional_t<
+ value, typename alike<T, std::remove_cv_t<std::remove_reference_t<Types>>...>::type,
+ void>;
};
template <class T, size_t N, class V, class... Types>
@@ -564,23 +538,21 @@ namespace types
template <class T, class... Types>
struct alike<T, Types...> {
- static bool const value = alike<Types...>::value &&
- alike<T, typename alike<Types...>::type>::value;
+ static bool const value =
+ alike<Types...>::value && alike<T, typename alike<Types...>::type>::value;
using type = typename alike<T, typename alike<Types...>::type>::type;
};
} // namespace details
template <class... Types>
- struct alike : details::alike<typename std::remove_cv<
- typename std::remove_reference<Types>::type>::type...> {
+ struct alike : details::alike<std::remove_cv_t<std::remove_reference_t<Types>>...> {
};
// Pythonic implementation for make_tuple to have the best return type
// (static array for sames types || real tuple otherwise)
template <bool Same, class... Types>
struct _make_tuple {
- auto operator()(Types &&...types)
- -> decltype(std::make_tuple(std::forward<Types>(types)...))
+ auto operator()(Types &&...types) -> decltype(std::make_tuple(std::forward<Types>(types)...))
{
return std::make_tuple(std::forward<Types>(types)...);
}
@@ -598,20 +570,17 @@ namespace types
template <class... Types>
auto make_tuple(Types &&...types)
#if !_MSC_VER || __clang__
- -> decltype(_make_tuple<alike<Types...>::value, Types...>()(
- std::forward<Types>(types)...))
+ -> decltype(_make_tuple<alike<Types...>::value, Types...>()(std::forward<Types>(types)...))
#endif
{
- return _make_tuple<alike<Types...>::value, Types...>()(
- std::forward<Types>(types)...);
+ return _make_tuple<alike<Types...>::value, Types...>()(std::forward<Types>(types)...);
}
template <class... Tys>
using make_tuple_t = decltype(types::make_tuple(std::declval<Tys>()...));
template <class T, class Tuple, size_t... S>
- types::array_tuple<T, sizeof...(S)> _to_array(Tuple const &t,
- utils::index_sequence<S...>)
+ types::array_tuple<T, sizeof...(S)> _to_array(Tuple const &t, std::index_sequence<S...>)
{
return {{static_cast<T>(std::get<S>(t))...}};
}
@@ -619,18 +588,16 @@ namespace types
template <class T, class... Tys>
types::array_tuple<T, sizeof...(Tys)> to_array(std::tuple<Tys...> const &t)
{
- return _to_array<T>(t, utils::make_index_sequence<sizeof...(Tys)>());
+ return _to_array<T>(t, std::make_index_sequence<sizeof...(Tys)>());
}
// Tuple concatenation for array && tuple
template <class T, size_t N, class V, class... Types>
- auto operator+(std::tuple<Types...> const &t,
- types::array_base<T, N, V> const &lt)
+ auto operator+(std::tuple<Types...> const &t, types::array_base<T, N, V> const &lt)
-> decltype(std::tuple_cat(t, lt.to_tuple()));
template <class T, size_t N, class V, class... Types>
- auto operator+(types::array_base<T, N, V> const &lt,
- std::tuple<Types...> const &t)
+ auto operator+(types::array_base<T, N, V> const &lt, std::tuple<Types...> const &t)
-> decltype(std::tuple_cat(lt.to_tuple(), t));
} // namespace types
@@ -736,34 +703,27 @@ struct __combined<std::tuple<Types...>, indexable<K>> {
};
template <class T, size_t N>
-struct __combined<pythonic::types::static_list<T, N>,
- pythonic::types::static_list<T, N>> {
+struct __combined<pythonic::types::static_list<T, N>, pythonic::types::static_list<T, N>> {
using type = pythonic::types::static_list<T, N>;
};
template <class T, size_t N>
-struct __combined<pythonic::types::array_tuple<T, N>,
- pythonic::types::array_tuple<T, N>> {
+struct __combined<pythonic::types::array_tuple<T, N>, pythonic::types::array_tuple<T, N>> {
using type = pythonic::types::array_tuple<T, N>;
};
template <class T0, class T1, size_t N, class V>
-struct __combined<pythonic::types::array_base<T0, N, V>,
- pythonic::types::array_base<T1, N, V>> {
- using type =
- pythonic::types::array_base<typename __combined<T0, T1>::type, N, V>;
+struct __combined<pythonic::types::array_base<T0, N, V>, pythonic::types::array_base<T1, N, V>> {
+ using type = pythonic::types::array_base<typename __combined<T0, T1>::type, N, V>;
};
template <class T0, class T1, size_t N>
-struct __combined<pythonic::types::static_list<T0, N>,
- pythonic::types::static_list<T1, N>> {
- using type =
- pythonic::types::static_list<typename __combined<T0, T1>::type, N>;
+struct __combined<pythonic::types::static_list<T0, N>, pythonic::types::static_list<T1, N>> {
+ using type = pythonic::types::static_list<typename __combined<T0, T1>::type, N>;
};
template <class T0, class T1, size_t N0, size_t N1>
-struct __combined<pythonic::types::static_list<T0, N0>,
- pythonic::types::static_list<T1, N1>> {
+struct __combined<pythonic::types::static_list<T0, N0>, pythonic::types::static_list<T1, N1>> {
using type = pythonic::types::list<typename __combined<T0, T1>::type>;
};
@@ -779,28 +739,22 @@ struct __combined<pythonic::types::array_base<T, N, V>, indexable<K>> {
template <class K, class T, size_t N, class V>
struct __combined<container<K>, pythonic::types::array_base<T, N, V>> {
- using type =
- pythonic::types::array_base<typename __combined<T, K>::type, N, V>;
+ using type = pythonic::types::array_base<typename __combined<T, K>::type, N, V>;
};
template <class K, class T, size_t N, class V>
struct __combined<pythonic::types::array_base<T, N, V>, container<K>> {
- using type =
- pythonic::types::array_base<typename __combined<T, K>::type, N, V>;
+ using type = pythonic::types::array_base<typename __combined<T, K>::type, N, V>;
};
template <class K, class V, class T, size_t N, class AV>
-struct __combined<indexable_container<K, V>,
- pythonic::types::array_base<T, N, AV>> {
- using type =
- pythonic::types::array_base<typename __combined<V, T>::type, N, AV>;
+struct __combined<indexable_container<K, V>, pythonic::types::array_base<T, N, AV>> {
+ using type = pythonic::types::array_base<typename __combined<V, T>::type, N, AV>;
};
template <class K, class V, class T, size_t N, class AV>
-struct __combined<pythonic::types::array_base<T, N, AV>,
- indexable_container<K, V>> {
- using type =
- pythonic::types::array_base<typename __combined<T, V>::type, N, AV>;
+struct __combined<pythonic::types::array_base<T, N, AV>, indexable_container<K, V>> {
+ using type = pythonic::types::array_base<typename __combined<T, V>::type, N, AV>;
};
template <class... t0, class... t1>
@@ -835,16 +789,13 @@ namespace details
PYTHONIC_NS_END
template <long I, class t, class... t0>
-struct __combined<std::tuple<t0...>,
- indexable_container<std::integral_constant<long, I>, t>> {
+struct __combined<std::tuple<t0...>, indexable_container<std::integral_constant<long, I>, t>> {
using holder = std::tuple<t0...>;
template <size_t... Is>
- static std::tuple<typename pythonic::details::pick_combined<
- typename std::tuple_element<Is, holder>::type, t, I == Is>::type...>
- make_type(pythonic::utils::index_sequence<Is...>);
- static auto
- make_type() -> decltype(make_type(
- pythonic::utils::make_index_sequence<sizeof...(t0)>()));
+ static std::tuple<typename pythonic::details::pick_combined<std::tuple_element_t<Is, holder>, t,
+ I == Is>::type...>
+ make_type(std::index_sequence<Is...>);
+ static auto make_type() -> decltype(make_type(std::make_index_sequence<sizeof...(t0)>()));
using type = decltype(make_type());
};
@@ -859,13 +810,11 @@ struct __combined<pythonic::types::array_tuple<t, n>, std::tuple<types...>> {
};
template <class t, size_t n, class... types>
-struct __combined<pythonic::types::array_tuple<t, n>,
- pythonic::types::pshape<types...>> {
+struct __combined<pythonic::types::array_tuple<t, n>, pythonic::types::pshape<types...>> {
using type = pythonic::types::array_tuple<t, n>;
};
template <class t, size_t n, class... types>
-struct __combined<pythonic::types::pshape<types...>,
- pythonic::types::array_tuple<t, n>> {
+struct __combined<pythonic::types::pshape<types...>, pythonic::types::array_tuple<t, n>> {
using type = pythonic::types::array_tuple<t, n>;
};
@@ -875,9 +824,8 @@ struct __combined<std::tuple<types...>, pythonic::types::array_tuple<t, n>> {
};
template <class t00, class t01, class t10, class t11>
struct __combined<std::pair<t00, t01>, std::pair<t10, t11>> {
- using type =
- std::pair<typename __combined<t00, t10>::type,
- typename __combined<t01, t11>::type>; // no further combination
+ using type = std::pair<typename __combined<t00, t10>::type,
+ typename __combined<t01, t11>::type>; // no further combination
};
/* } */
@@ -941,8 +889,7 @@ namespace std
template <size_t I, class... Tys>
struct tuple_element<I, pythonic::types::pshape<Tys...>> {
- using type = typename std::tuple_element <
- I<sizeof...(Tys) ? I : 0, std::tuple<Tys...>>::type;
+ using type = std::tuple_element_t < I<sizeof...(Tys) ? I : 0, std::tuple<Tys...>>;
};
} // namespace std
PYTHONIC_NS_BEGIN
@@ -960,8 +907,7 @@ namespace sutils
};
template <class T>
- using shape_t = typename std::enable_if<!std::is_integral<T>::value,
- typename make_shape<T>::type>::type;
+ using shape_t = std::enable_if_t<!std::is_integral<T>::value, typename make_shape<T>::type>;
template <class Curr, class... Ss>
struct shape_merger;
@@ -975,8 +921,7 @@ namespace sutils
using type = long;
};
template <long N0, long N1, class... Ss>
- struct shape_merger<std::integral_constant<long, N0>,
- std::integral_constant<long, N1>, Ss...>
+ struct shape_merger<std::integral_constant<long, N0>, std::integral_constant<long, N1>, Ss...>
: shape_merger<std::integral_constant<long, (N0 > N1 ? N0 : N1)>, Ss...> {
};
template <long N, class... Ss>
@@ -986,32 +931,28 @@ namespace sutils
template <size_t I, class Ss>
struct shape_selecter
- : std::conditional<
- (I < std::tuple_size<Ss>::value),
- typename std::tuple_element<
- (I < std::tuple_size<Ss>::value ? I : 0L), Ss>::type,
- std::integral_constant<long, 1>> {
+ : std::conditional<(I < std::tuple_size<Ss>::value),
+ std::tuple_element_t<(I < std::tuple_size<Ss>::value ? I : 0L), Ss>,
+ std::integral_constant<long, 1>> {
};
template <size_t I, class Ss>
struct merge_shape;
template <size_t I, class... Ss>
struct merge_shape<I, std::tuple<Ss...>> {
- using type =
- typename shape_merger<typename shape_selecter<I, Ss>::type...>::type;
+ using type = typename shape_merger<typename shape_selecter<I, Ss>::type...>::type;
};
template <class Ss, class T>
struct merged_shapes;
template <class Ss, size_t... Is>
- struct merged_shapes<Ss, utils::index_sequence<Is...>> {
+ struct merged_shapes<Ss, std::index_sequence<Is...>> {
using type = types::pshape<typename merge_shape<Is, Ss>::type...>;
};
template <size_t N, class... Ss>
using merged_shapes_t =
- typename merged_shapes<std::tuple<Ss...>,
- utils::make_index_sequence<N>>::type;
+ typename merged_shapes<std::tuple<Ss...>, std::make_index_sequence<N>>::type;
template <class... Ss>
struct shape_commonifier;
@@ -1028,34 +969,29 @@ namespace sutils
using type = long;
};
template <long N0, long N1, class... Ss>
- struct shape_commonifier<std::integral_constant<long, N0>,
- std::integral_constant<long, N1>, Ss...> {
- using type = typename std::conditional<
- N0 == N1,
- typename shape_commonifier<std::integral_constant<long, N0>,
- Ss...>::type,
- long>::type;
+ struct shape_commonifier<std::integral_constant<long, N0>, std::integral_constant<long, N1>,
+ Ss...> {
+ using type = std::conditional_t<
+ N0 == N1, typename shape_commonifier<std::integral_constant<long, N0>, Ss...>::type, long>;
};
template <size_t I, class Ss>
struct common_shape;
template <size_t I, class... Ss>
struct common_shape<I, std::tuple<Ss...>> {
- using type = typename shape_commonifier<
- typename std::tuple_element<I, Ss>::type...>::type;
+ using type = typename shape_commonifier<std::tuple_element_t<I, Ss>...>::type;
};
template <class Ss, class T>
struct common_shapes;
template <class Ss, size_t... Is>
- struct common_shapes<Ss, utils::index_sequence<Is...>> {
+ struct common_shapes<Ss, std::index_sequence<Is...>> {
using type = types::pshape<typename common_shape<Is, Ss>::type...>;
};
template <size_t N, class... Ss>
using common_shapes_t =
- typename common_shapes<std::tuple<Ss...>,
- utils::make_index_sequence<N>>::type;
+ typename common_shapes<std::tuple<Ss...>, std::make_index_sequence<N>>::type;
template <class T>
struct transpose;
@@ -1083,28 +1019,22 @@ namespace sutils
}
template <size_t Start, ssize_t Offset, class T0, class T1, size_t... Is>
- void copy_shape(T0 &shape0, T1 const &shape1, utils::index_sequence<Is...>)
+ void copy_shape(T0 &shape0, T1 const &shape1, std::index_sequence<Is...>)
{
(void)std::initializer_list<int>{
- (assign(std::get<Start + Is>(shape0),
- shape1.template shape<Is + Start + Offset>()),
- 1)...};
+ (assign(std::get<Start + Is>(shape0), shape1.template shape<Is + Start + Offset>()), 1)...};
}
template <size_t Start, ssize_t Offset, class T0, class T1, size_t... Is>
- void scopy_shape(T0 &shape0, T1 const &shape1, utils::index_sequence<Is...>)
+ void scopy_shape(T0 &shape0, T1 const &shape1, std::index_sequence<Is...>)
{
(void)std::initializer_list<int>{
- (assign(std::get<Start + Is>(shape0),
- std::get<Is + Start + Offset>(shape1)),
- 1)...};
+ (assign(std::get<Start + Is>(shape0), std::get<Is + Start + Offset>(shape1)), 1)...};
}
template <size_t Start, ssize_t Offset, class T0, class T1, size_t... Is>
- void copy_strides(T0 &stride0, T1 const &stride1,
- utils::index_sequence<Is...>)
+ void copy_strides(T0 &stride0, T1 const &stride1, std::index_sequence<Is...>)
{
(void)std::initializer_list<int>{
- (assign(std::get<Start + Is>(stride0),
- stride1.template strides<Is + Start + Offset>()),
+ (assign(std::get<Start + Is>(stride0), stride1.template strides<Is + Start + Offset>()),
1)...};
}
template <class P, class... Tys>
@@ -1115,8 +1045,7 @@ namespace sutils
using type = types::pshape<Ps...>;
};
template <class... Ps, class Ty, class... Tys>
- struct pop_type<types::pshape<Ps...>, Ty, Tys...>
- : pop_type<types::pshape<Ps..., Ty>, Tys...> {
+ struct pop_type<types::pshape<Ps...>, Ty, Tys...> : pop_type<types::pshape<Ps..., Ty>, Tys...> {
};
template <class T>
@@ -1165,8 +1094,7 @@ namespace sutils
using head_t = typename head<T>::type;
template <class... Tys>
- types::array_tuple<long, sizeof...(Tys)>
- array(types::pshape<Tys...> const &pS)
+ types::array_tuple<long, sizeof...(Tys)> array(types::pshape<Tys...> const &pS)
{
return pS.array();
}
@@ -1177,16 +1105,14 @@ namespace sutils
return pS;
}
template <class E, size_t... Is>
- types::array_tuple<long, sizeof...(Is)> getshape(E const &e,
- utils::index_sequence<Is...>)
+ types::array_tuple<long, sizeof...(Is)> getshape(E const &e, std::index_sequence<Is...>)
{
return {(long)(e.template shape<Is>())...};
}
template <class E>
- auto getshape(E const &e)
- -> decltype(getshape(e, utils::make_index_sequence<E::value>()))
+ auto getshape(E const &e) -> decltype(getshape(e, std::make_index_sequence<E::value>()))
{
- return getshape(e, utils::make_index_sequence<E::value>());
+ return getshape(e, std::make_index_sequence<E::value>());
}
inline std::tuple<> getshape(...)
@@ -1233,19 +1159,16 @@ namespace sutils
using push_front_t = concat_t<types::pshape<T>, P>;
template <class S>
- long find(S &s, long v, std::integral_constant<size_t, 0>, long start,
- bool comp(long, long))
+ long find(S &s, long v, std::integral_constant<size_t, 0>, long start, bool comp(long, long))
{
return comp(s.template shape<0>(), v) && 0 < start ? 0 : -1;
}
template <class S, size_t I>
- long find(S &s, long v, std::integral_constant<size_t, I>, long start,
- bool comp(long, long))
+ long find(S &s, long v, std::integral_constant<size_t, I>, long start, bool comp(long, long))
{
return comp(s.template shape<I>(), v) && I < start
? I
- : find(s, v, std::integral_constant<size_t, I - 1>(), start,
- comp);
+ : find(s, v, std::integral_constant<size_t, I - 1>(), start, comp);
}
template <class S>
@@ -1253,23 +1176,19 @@ namespace sutils
S &s, long v, long start = S::value,
bool comp(long, long) = [](long a, long b) { return (a == b); })
{
- return find(s, v, std::integral_constant<size_t, S::value - 1>(), start,
- comp);
+ return find(s, v, std::integral_constant<size_t, S::value - 1>(), start, comp);
}
template <class S>
- long sfind(S &s, long v, std::integral_constant<size_t, 0>, long start,
- bool comp(long, long))
+ long sfind(S &s, long v, std::integral_constant<size_t, 0>, long start, bool comp(long, long))
{
return comp(std::get<0>(s), v) && 0 < start ? 0 : -1;
}
template <class S, size_t I>
- long sfind(S &s, long v, std::integral_constant<size_t, I>, long start,
- bool comp(long, long))
+ long sfind(S &s, long v, std::integral_constant<size_t, I>, long start, bool comp(long, long))
{
return comp(std::get<I>(s), v) && (long)I < start
? (long)I
- : sfind(s, v, std::integral_constant<size_t, I - 1>(), start,
- comp);
+ : sfind(s, v, std::integral_constant<size_t, I - 1>(), start, comp);
}
template <class S>
@@ -1277,9 +1196,8 @@ namespace sutils
S &s, long v, long start = std::tuple_size<S>::value,
bool comp(long, long) = [](long a, long b) { return (a == b); })
{
- return sfind(
- s, v, std::integral_constant<size_t, std::tuple_size<S>::value - 1>(),
- start, comp);
+ return sfind(s, v, std::integral_constant<size_t, std::tuple_size<S>::value - 1>(), start,
+ comp);
}
template <class S, class B>
@@ -1295,14 +1213,12 @@ namespace sutils
}
template <class S, class B>
- typename std::enable_if<S::value == std::tuple_size<B>::value, bool>::type
- equals(S const &s, B const &other)
+ std::enable_if_t<S::value == std::tuple_size<B>::value, bool> equals(S const &s, B const &other)
{
return equals(s, other, std::integral_constant<size_t, S::value - 1>());
}
template <class S, class B>
- typename std::enable_if<
- std::tuple_size<S>::value != std::tuple_size<B>::value, bool>::type
+ std::enable_if_t<std::tuple_size<S>::value != std::tuple_size<B>::value, bool>
equals(S const &s, B const &other)
{
return false;
@@ -1337,8 +1253,7 @@ namespace sutils
template <class S, class P, size_t I>
bool any_of(S const &s, P pred, std::integral_constant<size_t, I>)
{
- return pred(s.template shape<I>()) ||
- any_of(s, pred, std::integral_constant<size_t, I - 1>());
+ return pred(s.template shape<I>()) || any_of(s, pred, std::integral_constant<size_t, I - 1>());
}
template <class S, class Pred>
bool any_of(S const &s, Pred pred)
@@ -1354,14 +1269,12 @@ namespace sutils
template <class S, size_t I>
long min(long curr, S const &s, std::integral_constant<size_t, I>)
{
- return min(std::min(curr, s.template shape<I>()), s,
- std::integral_constant<size_t, I - 1>());
+ return min(std::min(curr, s.template shape<I>()), s, std::integral_constant<size_t, I - 1>());
}
template <class S>
long min(S const &s)
{
- return min(s.template shape<S::value - 1>(), s,
- std::integral_constant<size_t, S::value - 1>());
+ return min(s.template shape<S::value - 1>(), s, std::integral_constant<size_t, S::value - 1>());
}
template <class S>
@@ -1372,8 +1285,7 @@ namespace sutils
template <class S, size_t I>
long prod(S const &s, std::integral_constant<size_t, I>)
{
- return s.template shape<I>() *
- prod(s, std::integral_constant<size_t, I - 1>());
+ return s.template shape<I>() * prod(s, std::integral_constant<size_t, I - 1>());
}
template <class S>
long prod(S const &s)
@@ -1393,8 +1305,7 @@ namespace sutils
template <class S>
long sprod(S const &s)
{
- return sprod(
- s, std::integral_constant<size_t, std::tuple_size<S>::value - 1>());
+ return sprod(s, std::integral_constant<size_t, std::tuple_size<S>::value - 1>());
}
template <class S>
@@ -1405,8 +1316,7 @@ namespace sutils
template <class S, size_t I>
long prod_tail(S const &s, std::integral_constant<size_t, I>)
{
- return s.template shape<I>() *
- prod_tail(s, std::integral_constant<size_t, I - 1>());
+ return s.template shape<I>() * prod_tail(s, std::integral_constant<size_t, I - 1>());
}
template <class S>
long prod_tail(S const &s)
@@ -1432,9 +1342,7 @@ namespace sutils
template <size_t I, class P>
struct safe_tuple_element {
- using type =
- typename std::tuple_element<(I < std::tuple_size<P>::value ? I : 0),
- P>::type;
+ using type = std::tuple_element_t<(I < std::tuple_size<P>::value ? I : 0), P>;
};
template <size_t I>
@@ -1443,111 +1351,80 @@ namespace sutils
template <>
struct copy_new_axis_helper<0> {
template <class S0, class S1, class S2, size_t J>
- typename std::enable_if<
- (0 != std::tuple_size<S2>::value) &&
- std::tuple_element<0, S2>::type::value,
- sutils::push_front_t<S0, std::integral_constant<long, 1>>>::type
- doit(S0 s, S1 const &shape, S2 const &new_axis,
- std::integral_constant<size_t, J>)
+ std::enable_if_t<(0 != std::tuple_size<S2>::value) && std::tuple_element_t<0, S2>::value,
+ sutils::push_front_t<S0, std::integral_constant<long, 1>>>
+ doit(S0 s, S1 const &shape, S2 const &new_axis, std::integral_constant<size_t, J>)
{
- return {std::tuple_cat(std::tuple<std::integral_constant<long, 1>>(),
- s.values)};
+ return {std::tuple_cat(std::tuple<std::integral_constant<long, 1>>(), s.values)};
}
template <class S0, class S1, class S2, size_t J>
- typename std::enable_if<
- (0 != std::tuple_size<S2>::value) &&
- !std::tuple_element<0, S2>::type::value,
- sutils::push_front_t<S0, typename std::tuple_element<
- 0, typename S1::shape_t>::type>>::type
- doit(S0 s, S1 const &shape, S2 const &new_axis,
- std::integral_constant<size_t, J>)
+ std::enable_if_t<(0 != std::tuple_size<S2>::value) && !std::tuple_element_t<0, S2>::value,
+ sutils::push_front_t<S0, std::tuple_element_t<0, typename S1::shape_t>>>
+ doit(S0 s, S1 const &shape, S2 const &new_axis, std::integral_constant<size_t, J>)
{
- return {
- std::tuple_cat(std::make_tuple(shape.template shape<0>()), s.values)};
+ return {std::tuple_cat(std::make_tuple(shape.template shape<0>()), s.values)};
}
template <class S0, class S1, class S2, size_t J>
- typename std::enable_if<
- (0 == std::tuple_size<S2>::value),
- sutils::push_front_t<S0, typename std::tuple_element<
- J, typename S1::shape_t>::type>>::type
- doit(S0 s, S1 const &shape, S2 const &new_axis,
- std::integral_constant<size_t, J>)
+ std::enable_if_t<(0 == std::tuple_size<S2>::value),
+ sutils::push_front_t<S0, std::tuple_element_t<J, typename S1::shape_t>>>
+ doit(S0 s, S1 const &shape, S2 const &new_axis, std::integral_constant<size_t, J>)
{
- return {
- std::tuple_cat(std::make_tuple(shape.template shape<J>()), s.values)};
+ return {std::tuple_cat(std::make_tuple(shape.template shape<J>()), s.values)};
}
};
template <size_t I>
struct copy_new_axis_helper {
template <class S0, class S1, class S2, size_t J>
- auto doit(S0 s, S1 const &shape, S2 const &new_axis,
- std::integral_constant<size_t, J>) ->
- typename std::enable_if<
- (I < std::tuple_size<S2>::value) &&
- safe_tuple_element<I, S2>::type::value,
- decltype(copy_new_axis_helper<I - 1>{}.doit(
- sutils::push_front_t<S0, std::integral_constant<long, 1>>(),
- shape, new_axis, std::integral_constant<size_t, J>()))>::type
+ auto doit(S0 s, S1 const &shape, S2 const &new_axis, std::integral_constant<size_t, J>)
+ -> std::enable_if_t<(I < std::tuple_size<S2>::value) &&
+ safe_tuple_element<I, S2>::type::value,
+ decltype(copy_new_axis_helper<I - 1>{}.doit(
+ sutils::push_front_t<S0, std::integral_constant<long, 1>>(), shape,
+ new_axis, std::integral_constant<size_t, J>()))>
{
return copy_new_axis_helper<I - 1>{}.doit(
sutils::push_front_t<S0, std::integral_constant<long, 1>>(
- std::tuple_cat(std::tuple<std::integral_constant<long, 1>>(),
- s.values)),
+ std::tuple_cat(std::tuple<std::integral_constant<long, 1>>(), s.values)),
shape, new_axis, std::integral_constant<size_t, J>());
}
template <class S0, class S1, class S2, size_t J>
- auto doit(S0 s, S1 const &shape, S2 const &new_axis,
- std::integral_constant<size_t, J>) ->
- typename std::enable_if<
+ auto doit(S0 s, S1 const &shape, S2 const &new_axis, std::integral_constant<size_t, J>)
+ -> std::enable_if_t<
(I >= std::tuple_size<S2>::value),
decltype(copy_new_axis_helper<I - 1>{}.doit(
- sutils::push_front_t<S0, typename std::tuple_element<
- J, typename S1::shape_t>::type>(),
- shape, new_axis,
- std::integral_constant<size_t, J == 0 ? J : J - 1>()))>::type
+ sutils::push_front_t<S0, std::tuple_element_t<J, typename S1::shape_t>>(), shape,
+ new_axis, std::integral_constant<size_t, J == 0 ? J : J - 1>()))>
{
return copy_new_axis_helper<I - 1>{}.doit(
- sutils::push_front_t<
- S0, typename std::tuple_element<J, typename S1::shape_t>::type>(
- std::tuple_cat(std::make_tuple(shape.template shape<J>()),
- s.values)),
- shape, new_axis, std::integral_constant < size_t,
- J == 0 ? J : J - 1 > ());
+ sutils::push_front_t<S0, std::tuple_element_t<J, typename S1::shape_t>>(
+ std::tuple_cat(std::make_tuple(shape.template shape<J>()), s.values)),
+ shape, new_axis, std::integral_constant<size_t, J == 0 ? J : J - 1>());
}
template <class S0, class S1, class S2, size_t J>
- auto doit(S0 s, S1 const &shape, S2 const &new_axis,
- std::integral_constant<size_t, J>) ->
- typename std::enable_if<
- (I < std::tuple_size<S2>::value) &&
- !safe_tuple_element<I, S2>::type::value,
+ auto doit(S0 s, S1 const &shape, S2 const &new_axis, std::integral_constant<size_t, J>)
+ -> std::enable_if_t<
+ (I < std::tuple_size<S2>::value) && !safe_tuple_element<I, S2>::type::value,
decltype(copy_new_axis_helper<I - 1>{}.doit(
- sutils::push_front_t<S0, typename std::tuple_element<
- J, typename S1::shape_t>::type>(),
- shape, new_axis,
- std::integral_constant<size_t, J == 0 ? J : J - 1>()))>::type
+ sutils::push_front_t<S0, std::tuple_element_t<J, typename S1::shape_t>>(), shape,
+ new_axis, std::integral_constant<size_t, J == 0 ? J : J - 1>()))>
{
return copy_new_axis_helper<I - 1>{}.doit(
- sutils::push_front_t<
- S0, typename std::tuple_element<J, typename S1::shape_t>::type>(
- std::tuple_cat(std::make_tuple(shape.template shape<J>()),
- s.values)),
- shape, new_axis, std::integral_constant < size_t,
- J == 0 ? J : J - 1 > ());
+ sutils::push_front_t<S0, std::tuple_element_t<J, typename S1::shape_t>>(
+ std::tuple_cat(std::make_tuple(shape.template shape<J>()), s.values)),
+ shape, new_axis, std::integral_constant<size_t, J == 0 ? J : J - 1>());
}
};
template <size_t N, class S1, class S2>
auto copy_new_axis(S1 const &shape, S2 const &new_axis)
-> decltype(copy_new_axis_helper<N - 1>{}.doit(
- types::pshape<>(), shape, new_axis,
- std::integral_constant<size_t, S1::value - 1>()))
+ types::pshape<>(), shape, new_axis, std::integral_constant<size_t, S1::value - 1>()))
{
- return copy_new_axis_helper<N - 1>{}.doit(
- types::pshape<>(), shape, new_axis,
- std::integral_constant<size_t, S1::value - 1>());
+ return copy_new_axis_helper<N - 1>{}.doit(types::pshape<>(), shape, new_axis,
+ std::integral_constant<size_t, S1::value - 1>());
}
} // namespace sutils
@@ -1623,8 +1500,7 @@ template <typename... Types>
struct to_python<std::tuple<Types...>> {
template <size_t... S>
- static PyObject *do_convert(std::tuple<Types...> const &t,
- utils::index_sequence<S...>);
+ static PyObject *do_convert(std::tuple<Types...> const &t, std::index_sequence<S...>);
static PyObject *convert(std::tuple<Types...> const &t);
};
@@ -1632,8 +1508,7 @@ struct to_python<std::tuple<Types...>> {
template <typename T, size_t N>
struct to_python<types::array_tuple<T, N>> {
template <size_t... S>
- static PyObject *do_convert(types::array_tuple<T, N> const &t,
- utils::index_sequence<S...>);
+ static PyObject *do_convert(types::array_tuple<T, N> const &t, std::index_sequence<S...>);
static PyObject *convert(types::array_tuple<T, N> const &t);
};
@@ -1641,8 +1516,7 @@ struct to_python<types::array_tuple<T, N>> {
template <typename T, size_t N>
struct to_python<types::static_list<T, N>> {
template <size_t... S>
- static PyObject *do_convert(types::static_list<T, N> const &t,
- utils::index_sequence<S...>);
+ static PyObject *do_convert(types::static_list<T, N> const &t, std::index_sequence<S...>);
static PyObject *convert(types::static_list<T, N> const &t);
};
@@ -1651,14 +1525,12 @@ template <typename... Types>
struct from_python<std::tuple<Types...>> {
template <size_t... S>
- static bool do_is_convertible(PyObject *obj,
- typename utils::index_sequence<S...>);
+ static bool do_is_convertible(PyObject *obj, typename std::index_sequence<S...>);
static bool is_convertible(PyObject *obj);
template <size_t... S>
- static std::tuple<Types...> do_convert(PyObject *obj,
- typename utils::index_sequence<S...>);
+ static std::tuple<Types...> do_convert(PyObject *obj, typename std::index_sequence<S...>);
static std::tuple<Types...> convert(PyObject *obj);
};
@@ -1668,8 +1540,7 @@ struct from_python<types::array_tuple<T, N>> {
static bool is_convertible(PyObject *obj);
template <size_t... S>
- static types::array_tuple<T, N>
- do_convert(PyObject *obj, typename utils::index_sequence<S...>);
+ static types::array_tuple<T, N> do_convert(PyObject *obj, typename std::index_sequence<S...>);
static types::array_tuple<T, N> convert(PyObject *obj);
};
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/type.hpp b/contrib/python/pythran/pythran/pythonic/include/types/type.hpp
new file mode 100644
index 00000000000..fbc4c2353fc
--- /dev/null
+++ b/contrib/python/pythran/pythran/pythonic/include/types/type.hpp
@@ -0,0 +1,17 @@
+#ifndef PYTHONIC_INCLUDE_TYPES_TYPE_HPP
+#define PYTHONIC_INCLUDE_TYPES_TYPE_HPP
+
+PYTHONIC_NS_BEGIN
+
+namespace types
+{
+ template <class T>
+ struct type_functor;
+
+ template <class T>
+ using type_t = typename type_functor<T>::type;
+} // namespace types
+
+PYTHONIC_NS_END
+
+#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp b/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp
index 46df29576d8..c22e205bf56 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/variant_functor.hpp
@@ -46,12 +46,10 @@ namespace types
variant_functor_impl(char mem[], variant_functor_impl<Type> const &t);
template <class... OtherTypes>
- variant_functor_impl(char mem[],
- variant_functor_impl<Type, OtherTypes...> const &t);
+ variant_functor_impl(char mem[], variant_functor_impl<Type, OtherTypes...> const &t);
template <class OtherType, class... OtherTypes>
- variant_functor_impl(
- char mem[], variant_functor_impl<OtherType, OtherTypes...> const &t);
+ variant_functor_impl(char mem[], variant_functor_impl<OtherType, OtherTypes...> const &t);
template <class OtherType>
variant_functor_impl(char mem[], OtherType const &t);
@@ -67,8 +65,7 @@ namespace types
void assign(char mem[], OtherType const &);
template <class OT0, class OT1, class... OtherTypes>
- void assign(char mem[],
- variant_functor_impl<OT0, OT1, OtherTypes...> const &);
+ void assign(char mem[], variant_functor_impl<OT0, OT1, OtherTypes...> const &);
template <class OT0, class OT1, class... OtherTypes>
void assign(char mem[], variant_functor<OT0, OT1, OtherTypes...> const &);
@@ -101,8 +98,7 @@ namespace types
variant_functor_impl(char mem[], OtherTypes const &...t);
template <class... OtherTypes>
- variant_functor_impl(char mem[],
- variant_functor_impl<OtherTypes...> const &t);
+ variant_functor_impl(char mem[], variant_functor_impl<OtherTypes...> const &t);
variant_functor_impl &operator=(variant_functor_impl const &) = delete;
@@ -112,18 +108,14 @@ namespace types
void assign(char mem[], OtherType const &);
template <class... Args>
- auto operator()(Args &&...args) ->
- typename __combined<
- decltype(std::declval<Type>()(std::forward<Args>(args)...)),
- decltype(std::declval<Types>()(
- std::forward<Args>(args)...))...>::type;
+ auto operator()(Args &&...args) -> typename __combined<
+ decltype(std::declval<Type>()(std::forward<Args>(args)...)),
+ decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type;
template <class... Args>
- auto operator()(Args &&...args) const ->
- typename __combined<
- decltype(std::declval<Type>()(std::forward<Args>(args)...)),
- decltype(std::declval<Types>()(
- std::forward<Args>(args)...))...>::type;
+ auto operator()(Args &&...args) const -> typename __combined<
+ decltype(std::declval<Type>()(std::forward<Args>(args)...)),
+ decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type;
};
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp b/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp
index e8a3f773426..adbdc565c38 100644
--- a/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/types/vectorizable_type.hpp
@@ -14,14 +14,12 @@ namespace types
};
struct vectorizer {
template <class E>
- static auto
- vbegin(E &&expr) -> decltype(std::forward<E>(expr).vbegin(vectorize{}))
+ static auto vbegin(E &&expr) -> decltype(std::forward<E>(expr).vbegin(vectorize{}))
{
return std::forward<E>(expr).vbegin(vectorize{});
}
template <class E>
- static auto
- vend(E &&expr) -> decltype(std::forward<E>(expr).vend(vectorize{}))
+ static auto vend(E &&expr) -> decltype(std::forward<E>(expr).vend(vectorize{}))
{
return std::forward<E>(expr).vend(vectorize{});
}
@@ -30,14 +28,12 @@ namespace types
};
struct vectorizer_nobroadcast {
template <class E>
- static auto vbegin(E &&expr)
- -> decltype(std::forward<E>(expr).vbegin(vectorize_nobroadcast{}))
+ static auto vbegin(E &&expr) -> decltype(std::forward<E>(expr).vbegin(vectorize_nobroadcast{}))
{
return std::forward<E>(expr).vbegin(vectorize_nobroadcast{});
}
template <class E>
- static auto vend(E &&expr)
- -> decltype(std::forward<E>(expr).vend(vectorize_nobroadcast{}))
+ static auto vend(E &&expr) -> decltype(std::forward<E>(expr).vend(vectorize_nobroadcast{}))
{
return std::forward<E>(expr).vend(vectorize_nobroadcast{});
}
@@ -45,10 +41,9 @@ namespace types
template <class T>
struct is_vectorizable_dtype {
- static const bool value =
- is_dtype<T>::value && !std::is_same<T, bool>::value &&
- !std::is_same<T, long double>::value &&
- !std::is_same<T, std::complex<long double>>::value;
+ static const bool value = is_dtype<T>::value && !std::is_same<T, bool>::value &&
+ !std::is_same<T, long double>::value &&
+ !std::is_same<T, std::complex<long double>>::value;
};
/* trait to check if is T is an array-like type that supports vectorization
@@ -67,9 +62,8 @@ namespace types
template <class T>
struct is_vectorizable {
- static const bool value =
- std::conditional<is_dtype<T>::value, is_vectorizable_dtype<T>,
- is_vectorizable_array<T>>::type::value;
+ static const bool value = std::conditional_t<is_dtype<T>::value, is_vectorizable_dtype<T>,
+ is_vectorizable_array<T>>::value;
};
template <class O, class... Args>
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/allocate.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/allocate.hpp
index 3af878d4685..731f55d5dd7 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/allocate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/allocate.hpp
@@ -14,10 +14,9 @@ namespace utils
#ifdef PYTHRAN_TRACE_ALLOCATION
extern size_t pythran_allocation_site;
#define pythran_trace_lineno(n) pythonic::utils::pythran_allocation_site = n;
-#define pythran_trace_allocation(n) \
- do { \
- fprintf(stderr, ":%d: Allocating %d bytes\n", \
- pythonic::utils::pythran_allocation_site, n); \
+#define pythran_trace_allocation(n) \
+ do { \
+ fprintf(stderr, ":%d: Allocating %d bytes\n", pythonic::utils::pythran_allocation_site, n); \
} while (0)
#else
#define pythran_trace_lineno(s)
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/broadcast_copy.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/broadcast_copy.hpp
index 1e43648925b..38250787715 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/broadcast_copy.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/broadcast_copy.hpp
@@ -22,15 +22,14 @@ namespace utils
};
template <class T>
- struct dim_of<T,
- typename std::enable_if<std::is_fundamental<T>::value>::type> {
+ struct dim_of<T, std::enable_if_t<std::is_fundamental<T>::value>> {
static const size_t value = 0;
};
-#define SPECIALIZE_DIM_OF(TYPE) \
- template <> \
- struct dim_of<TYPE> { \
- static const size_t value = 0; \
+#define SPECIALIZE_DIM_OF(TYPE) \
+ template <> \
+ struct dim_of<TYPE> { \
+ static const size_t value = 0; \
}
SPECIALIZE_DIM_OF(std::complex<float>);
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp
index 260e4d597a4..b4a9f229a1a 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/functor.hpp
@@ -5,32 +5,31 @@
// create a function named `name' using function `f'
-#define DEFINE_FUNCTOR_2(name, f) \
- namespace functor \
- { \
- struct name { \
- using callable = void; \
- template <typename... Types> \
- auto operator()(Types &&...types) const \
- -> decltype(f(std::forward<Types>(types)...)) \
- { \
- return f(std::forward<Types>(types)...); \
- } \
- \
- friend std::ostream &operator<<(std::ostream &os, name) \
- { \
- return os << #name; \
- } \
- }; \
+#define DEFINE_FUNCTOR_2(name, f) \
+ namespace functor \
+ { \
+ struct name { \
+ using callable = void; \
+ template <typename... Types> \
+ auto operator()(Types &&...types) const -> decltype(f(std::forward<Types>(types)...)) \
+ { \
+ return f(std::forward<Types>(types)...); \
+ } \
+ \
+ friend std::ostream &operator<<(std::ostream &os, name) \
+ { \
+ return os << #name; \
+ } \
+ }; \
}
// create a functor named `f' using function `ns::f'
#define DEFINE_FUNCTOR(ns, f) DEFINE_FUNCTOR_2(f, ns::f)
-#define USING_FUNCTOR(f, alias) \
- namespace functor \
- { \
- using f = alias; \
+#define USING_FUNCTOR(f, alias) \
+ namespace functor \
+ { \
+ using f = alias; \
}
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp
index 306d96376a5..49d7c3579f5 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/iterator.hpp
@@ -55,10 +55,10 @@ namespace utils
template <typename T, typename... Iters>
struct iterator_min<T, Iters...> {
- using type = typename std::conditional<
- std::is_same<typename std::iterator_traits<T>::iterator_category,
- std::forward_iterator_tag>::value,
- std::forward_iterator_tag, typename iterator_min<Iters...>::type>::type;
+ using type =
+ std::conditional_t<std::is_same<typename std::iterator_traits<T>::iterator_category,
+ std::forward_iterator_tag>::value,
+ std::forward_iterator_tag, typename iterator_min<Iters...>::type>;
};
} // namespace utils
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp
index e53703a1ce3..ff4ea9a8f34 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/nested_container.hpp
@@ -41,8 +41,7 @@ namespace utils
template <class T>
struct nested_container_depth {
- static const int value =
- nested_container_depth_helper<T, types::is_array<T>::value>::value;
+ static const int value = nested_container_depth_helper<T, types::is_array<T>::value>::value;
};
template <class T>
@@ -82,12 +81,11 @@ namespace utils
/* Get the size of a container, using recursion on inner container if any
* FIXME: should be a constexpr?
- * FIXME: why a class && ! a function?
+ * FIXME: why a class and not a function?
*/
template <class T>
struct nested_container_size {
- using Type =
- typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+ using Type = std::remove_cv_t<std::remove_reference_t<T>>;
static long flat_size(T const &t);
};
@@ -115,8 +113,7 @@ namespace utils
template <class T>
struct nested_container_value_type {
- using type = typename nested_container_value_type_helper<
- T, types::is_array<T>::value>::type;
+ using type = typename nested_container_value_type_helper<T, types::is_array<T>::value>::type;
};
template <class T>
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp
index 21eecd2b8d7..88dfd1a8c46 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/neutral.hpp
@@ -50,8 +50,7 @@ namespace utils
};
template <class T>
- T const neutral<operator_::functor::imax, T>::value =
- std::numeric_limits<T>::lowest();
+ T const neutral<operator_::functor::imax, T>::value = std::numeric_limits<T>::lowest();
template <class T>
struct neutral<operator_::functor::imin, T> {
@@ -59,8 +58,7 @@ namespace utils
};
template <class T>
- T const neutral<operator_::functor::imin, T>::value =
- std::numeric_limits<T>::max();
+ T const neutral<operator_::functor::imin, T>::value = std::numeric_limits<T>::max();
template <class T>
struct neutral<operator_::functor::ixor, T> {
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp
index 8fafd52d791..b5f3c1bec8d 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_conversion.hpp
@@ -6,20 +6,18 @@
#include <utility>
#if _MSC_VER && !__clang__
-#define NUMPY_EXPR_TO_NDARRAY0_DECL(fname) \
- template <class E, class... Types, \
- typename std::enable_if<!types::is_ndarray<E>::value && \
- types::is_numexpr_arg<E>::value, \
- E>::type * = nullptr> \
+#define NUMPY_EXPR_TO_NDARRAY0_DECL(fname) \
+ template <class E, class... Types, \
+ std::enable_if_t<!types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, E> \
+ * = nullptr> \
auto fname(E const &expr, Types &&...others);
#else
-#define NUMPY_EXPR_TO_NDARRAY0_DECL(fname) \
- template <class E, class... Types> \
- auto fname(E const &expr, Types &&...others) -> \
- typename std::enable_if< \
- !types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, \
- decltype(fname( \
- types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
- std::forward<Types>(others)...))>::type;
+#define NUMPY_EXPR_TO_NDARRAY0_DECL(fname) \
+ template <class E, class... Types> \
+ auto fname(E const &expr, Types &&...others) \
+ -> std::enable_if_t<!types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, \
+ decltype(fname( \
+ types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
+ std::forward<Types>(others)...))>;
#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp
index 2ab8e72f66c..4ae52bdc011 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/numpy_traits.hpp
@@ -131,8 +131,7 @@ namespace types
template <class T>
struct is_numexpr_arg<list<T>> {
- static constexpr bool value =
- is_numexpr_arg<T>::value || is_dtype<T>::value;
+ static constexpr bool value = is_numexpr_arg<T>::value || is_dtype<T>::value;
};
template <class T, class S>
@@ -149,32 +148,27 @@ namespace types
};
template <class T, class S>
- struct is_numexpr_arg<sliced_array<T, S>>
- : is_numexpr_arg<sliced_list<T, S>> {
+ struct is_numexpr_arg<sliced_array<T, S>> : is_numexpr_arg<sliced_list<T, S>> {
};
template <class T>
struct is_numexpr_arg<broadcasted<T>> {
- static constexpr bool value =
- is_numexpr_arg<T>::value || is_dtype<T>::value;
+ static constexpr bool value = is_numexpr_arg<T>::value || is_dtype<T>::value;
};
template <class T, class Tp>
struct is_numexpr_arg<broadcast<T, Tp>> {
- static constexpr bool value =
- is_numexpr_arg<T>::value || is_dtype<T>::value;
+ static constexpr bool value = is_numexpr_arg<T>::value || is_dtype<T>::value;
};
template <class T, size_t N, class V>
struct is_numexpr_arg<array_base<T, N, V>> {
- static constexpr bool value =
- is_numexpr_arg<T>::value || is_dtype<T>::value;
+ static constexpr bool value = is_numexpr_arg<T>::value || is_dtype<T>::value;
};
template <class T>
struct is_numexpr_arg<dynamic_tuple<T>> {
- static constexpr bool value =
- is_numexpr_arg<T>::value || is_dtype<T>::value;
+ static constexpr bool value = is_numexpr_arg<T>::value || is_dtype<T>::value;
};
template <class E>
@@ -197,7 +191,7 @@ namespace types
};
template <class A>
- struct has_buffer<numpy_iexpr<A>> : has_buffer<A>{
+ struct has_buffer<numpy_iexpr<A>> : has_buffer<A> {
};
template <class A, class... S>
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp
index 576141cb7ef..1fb1e866b32 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/seq.hpp
@@ -1,76 +1,27 @@
#ifndef PYTHONIC_INCLUDE_UTILS_SEQ_HPP
#define PYTHONIC_INCLUDE_UTILS_SEQ_HPP
+#include <utility>
+
PYTHONIC_NS_BEGIN
namespace utils
{
- // make_integer_sequence<N>() = integer_sequence<0, ..., N-1>
-
- template <class T, T...>
- struct integer_sequence {
- };
-
- template <std::size_t... S>
- using index_sequence = integer_sequence<std::size_t, S...>;
-
namespace details
{
- template <class Left, class Right>
- struct make_integer_sequence_join;
- template <class T, T... Left, T... Right>
- struct make_integer_sequence_join<integer_sequence<T, Left...>,
- integer_sequence<T, Right...>> {
- using type = integer_sequence<T, Left..., (sizeof...(Left) + Right)...>;
- };
-
- template <class T, std::size_t N, T... S>
- struct make_integer_sequence
- : make_integer_sequence_join<
- typename make_integer_sequence<T, N / 2>::type,
- typename make_integer_sequence<T, N - N / 2>::type> {
- };
- template <class T>
- struct make_integer_sequence<T, 0> {
- using type = integer_sequence<T>;
- };
- template <class T>
- struct make_integer_sequence<T, 1> {
- using type = integer_sequence<T, 0>;
- };
- } // namespace details
+ template <class T, T... Is>
+ constexpr std::integer_sequence<T, (sizeof...(Is) - 1 - Is)...>
+ reverse_integer_sequence(std::integer_sequence<T, Is...>);
- template <class T, std::size_t N>
- using make_integer_sequence =
- typename details::make_integer_sequence<T, N>::type;
- template <std::size_t N>
- using make_index_sequence =
- typename details::make_integer_sequence<std::size_t, N>::type;
-
- // make_reversed_integer_sequence<T, N>() = integer_sequence<T, N-1, ..., 0>
-
- namespace details
- {
-
- template <class T, std::size_t N, T... S>
- struct make_reversed_integer_sequence
- : make_reversed_integer_sequence<T, N - 1, sizeof...(S), S...> {
- };
-
- template <class T, T... S>
- struct make_reversed_integer_sequence<T, 0, S...> {
- using type = integer_sequence<T, S...>;
- };
} // namespace details
template <class T, std::size_t N>
using make_reversed_integer_sequence =
- typename details::make_reversed_integer_sequence<T, N>::type;
+ decltype(details::reverse_integer_sequence(std::make_integer_sequence<T, N>()));
template <std::size_t N>
- using make_reversed_index_sequence =
- typename details::make_reversed_integer_sequence<std::size_t, N>::type;
+ using make_reversed_index_sequence = make_reversed_integer_sequence<std::size_t, N>;
// make_repeated_type<A, 3>() => type_sequence<A, A, A>
template <class... Tys>
diff --git a/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp b/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp
index 593bfcdbd1d..f9e764b4e1b 100644
--- a/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp
+++ b/contrib/python/pythran/pythran/pythonic/include/utils/tags.hpp
@@ -16,9 +16,7 @@ namespace purity
template <class T>
struct purity_of {
- using type =
- typename std::conditional<types::is_pure<T>::value, purity::pure_tag,
- purity::unknown_tag>::type;
+ using type = std::conditional_t<types::is_pure<T>::value, purity::pure_tag, purity::unknown_tag>;
};
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/itertools/combinations.hpp b/contrib/python/pythran/pythran/pythonic/itertools/combinations.hpp
index b64e5780e17..c8a074a3875 100644
--- a/contrib/python/pythran/pythran/pythonic/itertools/combinations.hpp
+++ b/contrib/python/pythran/pythran/pythonic/itertools/combinations.hpp
@@ -17,8 +17,7 @@ namespace itertools
template <class T>
template <class Iter>
combination_iterator<T>::combination_iterator(Iter &&pool, long r)
- : pool(pool.begin(), pool.end()), indices(r), r(r),
- stopped(r > long(this->pool.size()))
+ : pool(pool.begin(), pool.end()), indices(r), r(r), stopped(r > long(this->pool.size()))
{
assert(r >= 0 && "r must be non-negative");
if (!stopped) {
@@ -33,8 +32,7 @@ namespace itertools
}
template <class T>
- types::dynamic_tuple<typename T::value_type>
- combination_iterator<T>::operator*() const
+ types::dynamic_tuple<typename T::value_type> combination_iterator<T>::operator*() const
{
assert(!stopped && "! stopped");
return {result.begin(), result.end()};
@@ -72,24 +70,21 @@ namespace itertools
}
template <class T>
- bool
- combination_iterator<T>::operator!=(combination_iterator const &other) const
+ bool combination_iterator<T>::operator!=(combination_iterator const &other) const
{
assert(stopped || other.stopped);
return !(*this == other);
}
template <class T>
- bool
- combination_iterator<T>::operator==(combination_iterator const &other) const
+ bool combination_iterator<T>::operator==(combination_iterator const &other) const
{
assert(stopped || other.stopped);
return other.stopped == stopped;
}
template <class T>
- bool
- combination_iterator<T>::operator<(combination_iterator const &other) const
+ bool combination_iterator<T>::operator<(combination_iterator const &other) const
{
return stopped != other.stopped;
}
@@ -121,9 +116,8 @@ namespace itertools
} // namespace details
template <typename T0>
- details::combination<
- typename std::remove_cv<typename std::remove_reference<T0>::type>::type>
- combinations(T0 &&iter, long num_elts)
+ details::combination<std::remove_cv_t<std::remove_reference_t<T0>>> combinations(T0 &&iter,
+ long num_elts)
{
return {std::forward<T0>(iter), num_elts};
}
diff --git a/contrib/python/pythran/pythran/pythonic/itertools/count.hpp b/contrib/python/pythran/pythran/pythonic/itertools/count.hpp
index c549bb46152..1c90256b481 100644
--- a/contrib/python/pythran/pythran/pythonic/itertools/count.hpp
+++ b/contrib/python/pythran/pythran/pythonic/itertools/count.hpp
@@ -13,8 +13,7 @@ namespace itertools
namespace details
{
template <class T>
- count_iterator<T>::count_iterator(T value, T step)
- : value(value), step(step)
+ count_iterator<T>::count_iterator(T value, T step) : value(value), step(step)
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/itertools/ifilter.hpp b/contrib/python/pythran/pythran/pythonic/itertools/ifilter.hpp
index b0fe9ab46ff..87ba185e98d 100644
--- a/contrib/python/pythran/pythran/pythonic/itertools/ifilter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/itertools/ifilter.hpp
@@ -10,10 +10,8 @@ namespace itertools
{
template <typename Operator, typename List0>
- details::filter<typename std::remove_cv<
- typename std::remove_reference<Operator>::type>::type,
- typename std::remove_cv<
- typename std::remove_reference<List0>::type>::type>
+ details::filter<std::remove_cv_t<std::remove_reference_t<Operator>>,
+ std::remove_cv_t<std::remove_reference_t<List0>>>
ifilter(Operator &&_op, List0 &&_seq)
{
return {std::forward<Operator>(_op), std::forward<List0>(_seq)};
diff --git a/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp b/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp
index 5220c0f15da..75889b5cbff 100644
--- a/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/itertools/islice.hpp
@@ -17,20 +17,18 @@ namespace itertools
}
template <typename Iterable>
- islice_iterator<Iterable>::islice_iterator(Iterable const &iterable,
- builtins::range const &xr)
- : iterable_ref(iterable), iterable(iterable_ref.begin()), xr_ref(xr),
- state(xr_ref.begin()), prev(*state)
+ islice_iterator<Iterable>::islice_iterator(Iterable const &iterable, builtins::range const &xr)
+ : iterable_ref(iterable), iterable(iterable_ref.begin()), xr_ref(xr), state(xr_ref.begin()),
+ prev(*state)
{
std::advance(this->iterable, *state);
}
template <typename Iterable>
- islice_iterator<Iterable>::islice_iterator(npos const &n,
- Iterable const &iterable,
+ islice_iterator<Iterable>::islice_iterator(npos const &n, Iterable const &iterable,
builtins::range const &xr)
- : iterable_ref(iterable), iterable(iterable_ref.begin()), xr_ref(xr),
- state(xr_ref.end()), prev(0)
+ : iterable_ref(iterable), iterable(iterable_ref.begin()), xr_ref(xr), state(xr_ref.end()),
+ prev(0)
{
}
@@ -50,29 +48,25 @@ namespace itertools
}
template <typename Iterable>
- bool islice_iterator<Iterable>::operator==(
- islice_iterator<Iterable> const &other) const
+ bool islice_iterator<Iterable>::operator==(islice_iterator<Iterable> const &other) const
{
return (state == other.state);
}
template <typename Iterable>
- bool islice_iterator<Iterable>::operator!=(
- islice_iterator<Iterable> const &other) const
+ bool islice_iterator<Iterable>::operator!=(islice_iterator<Iterable> const &other) const
{
return state != other.state;
}
template <typename Iterable>
- bool islice_iterator<Iterable>::operator<(
- islice_iterator<Iterable> const &other) const
+ bool islice_iterator<Iterable>::operator<(islice_iterator<Iterable> const &other) const
{
return state != other.state;
}
template <typename Iterable>
- int islice_iterator<Iterable>::operator-(
- islice_iterator<Iterable> const &other) const
+ int islice_iterator<Iterable>::operator-(islice_iterator<Iterable> const &other) const
{
return state - other.state;
}
@@ -83,8 +77,7 @@ namespace itertools
}
template <typename Iterable>
- _islice<Iterable>::_islice(Iterable const &iterable,
- builtins::range const &xr)
+ _islice<Iterable>::_islice(Iterable const &iterable, builtins::range const &xr)
: iterator(iterable, xr), end_iter(npos(), iterable, xr)
{
}
@@ -108,17 +101,15 @@ namespace itertools
}
template <typename Iterable>
- _islice<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>
+ _islice<std::remove_cv_t<std::remove_reference_t<Iterable>>>
islice(Iterable &&iterable, long start, long stop, long step)
{
return {iterable, builtins::range(start, stop, step)};
}
template <typename Iterable>
- _islice<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type>
- islice(Iterable &&iterable, long stop)
+ _islice<std::remove_cv_t<std::remove_reference_t<Iterable>>> islice(Iterable &&iterable,
+ long stop)
{
return {iterable, builtins::range(0, stop, 1)};
}
diff --git a/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp b/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp
index cba48890fde..c6114545879 100644
--- a/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp
+++ b/contrib/python/pythran/pythran/pythonic/itertools/permutations.hpp
@@ -19,8 +19,8 @@ namespace itertools
}
template <class T, class H>
- permutations_iterator<T, H>::permutations_iterator(pool_type const &iter,
- size_t num_elts, bool end)
+ permutations_iterator<T, H>::permutations_iterator(pool_type const &iter, size_t num_elts,
+ bool end)
: pool(iter), curr_permut(pool.size()), _size(num_elts), end(end)
{
std::iota(curr_permut.begin(), curr_permut.end(), 0);
@@ -37,8 +37,7 @@ namespace itertools
return res;
}
template <class T, size_t N>
- types::array_tuple<T, N> init_permut_from(size_t n,
- types::array_tuple<T, N> *)
+ types::array_tuple<T, N> init_permut_from(size_t n, types::array_tuple<T, N> *)
{
assert(N == n && "consistent init");
return {};
@@ -55,14 +54,12 @@ namespace itertools
}
template <class T, class I>
- types::dynamic_tuple<T> init_permut_from(I begin, I end,
- types::dynamic_tuple<T> *)
+ types::dynamic_tuple<T> init_permut_from(I begin, I end, types::dynamic_tuple<T> *)
{
return {begin, end};
}
template <class T, size_t N, class I>
- types::array_tuple<T, N> init_permut_from(I begin, I end,
- types::array_tuple<T, N> *)
+ types::array_tuple<T, N> init_permut_from(I begin, I end, types::array_tuple<T, N> *)
{
types::array_tuple<T, N> res;
std::copy(begin, end, res.begin());
@@ -77,14 +74,13 @@ namespace itertools
// than the the pool size
// FIXME a better implementation would be to avoid
// std::next_permutation, but only in the slow path
- H prev_permut = init_permut_from(
- curr_permut.begin(), curr_permut.begin() + _size, (H *)nullptr);
- while ((end = std::next_permutation(curr_permut.begin(),
- curr_permut.end()))) {
+ H prev_permut =
+ init_permut_from(curr_permut.begin(), curr_permut.begin() + _size, (H *)nullptr);
+ while ((end = std::next_permutation(curr_permut.begin(), curr_permut.end()))) {
// Check if the prefix of the new permutation is
// different of the previous one
- H new_permut = init_permut_from(
- curr_permut.begin(), curr_permut.begin() + _size, (H *)nullptr);
+ H new_permut =
+ init_permut_from(curr_permut.begin(), curr_permut.begin() + _size, (H *)nullptr);
if (!(prev_permut == new_permut))
break;
}
@@ -94,25 +90,21 @@ namespace itertools
}
template <class T, class H>
- bool permutations_iterator<T, H>::operator!=(
- permutations_iterator<T, H> const &other) const
+ bool permutations_iterator<T, H>::operator!=(permutations_iterator<T, H> const &other) const
{
return !(*this == other);
}
template <class T, class H>
- bool permutations_iterator<T, H>::operator==(
- permutations_iterator<T, H> const &other) const
+ bool permutations_iterator<T, H>::operator==(permutations_iterator<T, H> const &other) const
{
if (other.end != end)
return false;
- return std::equal(curr_permut.begin(), curr_permut.end(),
- other.curr_permut.begin());
+ return std::equal(curr_permut.begin(), curr_permut.end(), other.curr_permut.begin());
}
template <class T, class H>
- bool permutations_iterator<T, H>::operator<(
- permutations_iterator<T, H> const &other) const
+ bool permutations_iterator<T, H>::operator<(permutations_iterator<T, H> const &other) const
{
if (end != other.end)
return end > other.end;
@@ -136,8 +128,7 @@ namespace itertools
}
template <class T, class H>
- typename _permutations<T, H>::iterator const &
- _permutations<T, H>::begin() const
+ typename _permutations<T, H>::iterator const &_permutations<T, H>::begin() const
{
return *this;
}
@@ -155,15 +146,14 @@ namespace itertools
}
template <typename T0>
- _permutations<T0, types::dynamic_tuple<typename T0::value_type>>
- permutations(T0 iter, long num_elts)
+ _permutations<T0, types::dynamic_tuple<typename T0::value_type>> permutations(T0 iter,
+ long num_elts)
{
return {iter, num_elts};
}
template <typename T0>
- _permutations<T0, types::dynamic_tuple<typename T0::value_type>>
- permutations(T0 iter)
+ _permutations<T0, types::dynamic_tuple<typename T0::value_type>> permutations(T0 iter)
{
return {iter, std::distance(iter.begin(), iter.end())};
}
diff --git a/contrib/python/pythran/pythran/pythonic/itertools/product.hpp b/contrib/python/pythran/pythran/pythonic/itertools/product.hpp
index 7572ed249f5..3265b778f4a 100644
--- a/contrib/python/pythran/pythran/pythonic/itertools/product.hpp
+++ b/contrib/python/pythran/pythran/pythonic/itertools/product.hpp
@@ -19,20 +19,18 @@ namespace itertools
template <typename... Iters>
template <size_t... I>
- product_iterator<Iters...>::product_iterator(
- std::tuple<Iters...> &_iters, utils::index_sequence<I...> const &)
- : it_begin(std::get<I>(_iters).begin()...),
- it_end(std::get<I>(_iters).end()...),
+ product_iterator<Iters...>::product_iterator(std::tuple<Iters...> &_iters,
+ std::index_sequence<I...> const &)
+ : it_begin(std::get<I>(_iters).begin()...), it_end(std::get<I>(_iters).end()...),
it(std::get<I>(_iters).begin()...), end(it_begin == it_end)
{
}
template <typename... Iters>
template <size_t... I>
- product_iterator<Iters...>::product_iterator(
- npos, std::tuple<Iters...> &_iters, utils::index_sequence<I...> const &)
- : it_begin(std::get<I>(_iters).end()...),
- it_end(std::get<I>(_iters).end()...),
+ product_iterator<Iters...>::product_iterator(npos, std::tuple<Iters...> &_iters,
+ std::index_sequence<I...> const &)
+ : it_begin(std::get<I>(_iters).end()...), it_end(std::get<I>(_iters).end()...),
it(std::get<I>(_iters).end()...), end(true)
{
}
@@ -40,17 +38,15 @@ namespace itertools
template <typename... Iters>
template <size_t... I>
types::make_tuple_t<typename Iters::value_type...>
- product_iterator<Iters...>::get_value(
- utils::index_sequence<I...> const &) const
+ product_iterator<Iters...>::get_value(std::index_sequence<I...> const &) const
{
return types::make_tuple(*std::get<I>(it)...);
}
template <typename... Iters>
- types::make_tuple_t<typename Iters::value_type...>
- product_iterator<Iters...>::operator*() const
+ types::make_tuple_t<typename Iters::value_type...> product_iterator<Iters...>::operator*() const
{
- return get_value(utils::make_index_sequence<sizeof...(Iters)>{});
+ return get_value(std::make_index_sequence<sizeof...(Iters)>{});
}
template <typename... Iters>
@@ -78,22 +74,19 @@ namespace itertools
}
template <typename... Iters>
- bool product_iterator<Iters...>::operator==(
- product_iterator<Iters...> const &other) const
+ bool product_iterator<Iters...>::operator==(product_iterator<Iters...> const &other) const
{
return end == other.end;
}
template <typename... Iters>
- bool product_iterator<Iters...>::operator!=(
- product_iterator<Iters...> const &other) const
+ bool product_iterator<Iters...>::operator!=(product_iterator<Iters...> const &other) const
{
return end != other.end;
}
template <typename... Iters>
- bool product_iterator<Iters...>::operator<(
- product_iterator<Iters...> const &other) const
+ bool product_iterator<Iters...>::operator<(product_iterator<Iters...> const &other) const
{
return end != other.end;
}
@@ -105,10 +98,8 @@ namespace itertools
template <typename... Iters>
product<Iters...>::product(Iters const &..._iters)
: utils::iterator_reminder<true, Iters...>(_iters...),
- iterator(this->values,
- utils::make_index_sequence<sizeof...(Iters)>{}),
- end_iter(npos(), this->values,
- utils::make_index_sequence<sizeof...(Iters)>{})
+ iterator(this->values, std::make_index_sequence<sizeof...(Iters)>{}),
+ end_iter(npos(), this->values, std::make_index_sequence<sizeof...(Iters)>{})
{
}
@@ -132,9 +123,7 @@ namespace itertools
} // namespace details
template <typename... Iter>
- details::product<typename std::remove_cv<
- typename std::remove_reference<Iter>::type>::type...>
- product(Iter &&...iters)
+ details::product<std::remove_cv_t<std::remove_reference_t<Iter>>...> product(Iter &&...iters)
{
return {std::forward<Iter>(iters)...};
}
diff --git a/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp b/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp
index 7e9f3ab6743..e5347254791 100644
--- a/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp
+++ b/contrib/python/pythran/pythran/pythonic/itertools/repeat.hpp
@@ -11,8 +11,7 @@ namespace itertools
{
template <class T, bool Endless>
- repeat_iterator<T, Endless>::repeat_iterator(T value, long count)
- : value_(value), count_(count)
+ repeat_iterator<T, Endless>::repeat_iterator(T value, long count) : value_(value), count_(count)
{
}
@@ -30,27 +29,23 @@ namespace itertools
}
template <class T, bool Endless>
- bool repeat_iterator<T, Endless>::operator!=(
- repeat_iterator<T, Endless> const &other) const
+ bool repeat_iterator<T, Endless>::operator!=(repeat_iterator<T, Endless> const &other) const
{
return Endless || count_ != other.count_;
}
template <class T, bool Endless>
- bool repeat_iterator<T, Endless>::operator==(
- repeat_iterator<T, Endless> const &other) const
+ bool repeat_iterator<T, Endless>::operator==(repeat_iterator<T, Endless> const &other) const
{
return !Endless && count_ == other.count_;
}
template <class T, bool Endless>
- bool repeat_iterator<T, Endless>::operator<(
- repeat_iterator<T, Endless> const &other) const
+ bool repeat_iterator<T, Endless>::operator<(repeat_iterator<T, Endless> const &other) const
{
return !Endless && count_ < other.count_;
}
template <class T, bool Endless>
- _repeat<T, Endless>::_repeat(T value, long count)
- : repeat_iterator<T, Endless>(value, count)
+ _repeat<T, Endless>::_repeat(T value, long count) : repeat_iterator<T, Endless>(value, count)
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/all.hpp b/contrib/python/pythran/pythran/pythonic/numpy/all.hpp
index 516e0dff9d3..13dfec2276b 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/all.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/all.hpp
@@ -15,10 +15,8 @@ namespace numpy
template <class E>
bool _all(E begin, E end, utils::int_<1>)
{
- return std::all_of(
- begin, end, [](typename std::iterator_traits<E>::value_type e) -> bool {
- return e;
- });
+ return std::all_of(begin, end,
+ [](typename std::iterator_traits<E>::value_type e) -> bool { return e; });
}
template <class E, size_t N>
@@ -31,25 +29,22 @@ namespace numpy
}
template <class E>
- typename std::enable_if<types::is_numexpr_arg<E>::value, bool>::type
- all(E const &expr, types::none_type)
+ std::enable_if_t<types::is_numexpr_arg<E>::value, bool> all(E const &expr, types::none_type)
{
return _all(expr.begin(), expr.end(), utils::int_<E::value>());
}
template <class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, bool>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, bool>
all(E const &expr, types::none_type)
{
return expr;
}
template <class E>
- auto all(E const &array, long axis) ->
- typename std::enable_if<std::is_scalar<E>::value ||
- types::is_complex<E>::value,
- decltype(all(array))>::type
+ auto all(E const &array, long axis)
+ -> std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value,
+ decltype(all(array))>
{
if (axis != 0)
throw types::ValueError("axis out of bounds");
@@ -57,8 +52,7 @@ namespace numpy
}
template <class E>
- auto all(E const &array, long axis) ->
- typename std::enable_if<E::value == 1, decltype(all(array))>::type
+ auto all(E const &array, long axis) -> std::enable_if_t<E::value == 1, decltype(all(array))>
{
if (axis != 0)
throw types::ValueError("axis out of bounds");
@@ -66,10 +60,8 @@ namespace numpy
}
template <class E>
- typename std::enable_if<
- E::value != 1,
- types::ndarray<typename E::dtype,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<E::value != 1,
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value - 1>>>
all(E const &array, long axis)
{
constexpr long N = E::value;
@@ -78,20 +70,17 @@ namespace numpy
throw types::ValueError("axis out of bounds");
if (axis == 0) {
types::array_tuple<long, N - 1> shp;
- sutils::copy_shape<0, 1>(shp, array, utils::make_index_sequence<N - 1>());
+ sutils::copy_shape<0, 1>(shp, array, std::make_index_sequence<N - 1>());
types::ndarray<bool, types::array_tuple<long, N - 1>> out(shp, true);
- return std::accumulate(array.begin(), array.end(), out,
- functor::multiply());
+ return std::accumulate(array.begin(), array.end(), out, functor::multiply());
} else {
types::array_tuple<long, N - 1> shp;
- sutils::copy_shape<0, 0>(shp, array, utils::make_index_sequence<N - 1>());
- types::ndarray<bool, types::array_tuple<long, N - 1>> ally(
- shp, builtins::None);
- std::transform(
- array.begin(), array.end(), ally.begin(),
- [=](types::ndarray<T, types::array_tuple<long, N - 1>> const &other) {
- return all(other, axis - 1);
- });
+ sutils::copy_shape<0, 0>(shp, array, std::make_index_sequence<N - 1>());
+ types::ndarray<bool, types::array_tuple<long, N - 1>> ally(shp, builtins::None);
+ std::transform(array.begin(), array.end(), ally.begin(),
+ [=](types::ndarray<T, types::array_tuple<long, N - 1>> const &other) {
+ return all(other, axis - 1);
+ });
return ally;
}
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp b/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp
index d630a99ba2f..ad5e808a62c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/allclose.hpp
@@ -15,8 +15,7 @@ namespace numpy
namespace
{
template <class I0, class I1>
- bool _allclose(I0 begin, I0 end, I1 ibegin, double rtol, double atol,
- utils::int_<1>)
+ bool _allclose(I0 begin, I0 end, I1 ibegin, double rtol, double atol, utils::int_<1>)
{
for (; begin != end; ++begin, ++ibegin) {
auto u = *begin;
@@ -31,12 +30,11 @@ namespace numpy
}
template <class I0, class I1, size_t N>
- bool _allclose(I0 begin, I0 end, I1 ibegin, double rtol, double atol,
- utils::int_<N>)
+ bool _allclose(I0 begin, I0 end, I1 ibegin, double rtol, double atol, utils::int_<N>)
{
for (; begin != end; ++begin, ++ibegin)
- if (!_allclose((*begin).begin(), (*begin).end(), (*ibegin).begin(),
- rtol, atol, utils::int_<N - 1>()))
+ if (!_allclose((*begin).begin(), (*begin).end(), (*ibegin).begin(), rtol, atol,
+ utils::int_<N - 1>()))
return false;
return true;
}
@@ -45,8 +43,7 @@ namespace numpy
template <class U, class V>
bool allclose(U const &u, V const &v, double rtol, double atol)
{
- return _allclose(u.begin(), u.end(), v.begin(), rtol, atol,
- utils::int_<U::value>());
+ return _allclose(u.begin(), u.end(), v.begin(), rtol, atol, utils::int_<U::value>());
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp b/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp
index 5bcbfc39d8b..1fe20860090 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/angle_in_rad.hpp
@@ -20,8 +20,7 @@ namespace numpy
namespace wrapper
{
template <class T>
- auto angle_in_rad(T const &t) -> decltype(std::atan2(std::imag(t),
- std::real(t)))
+ auto angle_in_rad(T const &t) -> decltype(std::atan2(std::imag(t), std::real(t)))
{
return std::atan2(std::imag(t), std::real(t));
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/any.hpp b/contrib/python/pythran/pythran/pythonic/numpy/any.hpp
index a234db5b37e..8032677234a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/any.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/any.hpp
@@ -15,8 +15,7 @@ namespace numpy
template <class E>
bool _any(E const &e, utils::int_<1>)
{
- return std::any_of(e.begin(), e.end(),
- [](typename E::dtype elt) -> bool { return elt; });
+ return std::any_of(e.begin(), e.end(), [](typename E::dtype elt) -> bool { return elt; });
}
template <class E, size_t N>
@@ -30,25 +29,22 @@ namespace numpy
}
template <class E>
- typename std::enable_if<types::is_numexpr_arg<E>::value, bool>::type
- any(E const &expr, types::none_type)
+ std::enable_if_t<types::is_numexpr_arg<E>::value, bool> any(E const &expr, types::none_type)
{
return _any(expr, utils::int_<E::value>());
}
template <class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, bool>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, bool>
any(E const &expr, types::none_type)
{
return expr;
}
template <class E>
- auto any(E const &array, long axis) ->
- typename std::enable_if<std::is_scalar<E>::value ||
- types::is_complex<E>::value,
- decltype(any(array))>::type
+ auto any(E const &array, long axis)
+ -> std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value,
+ decltype(any(array))>
{
if (axis != 0)
throw types::ValueError("axis out of bounds");
@@ -56,8 +52,7 @@ namespace numpy
}
template <class E>
- auto any(E const &array, long axis) ->
- typename std::enable_if<E::value == 1, decltype(any(array))>::type
+ auto any(E const &array, long axis) -> std::enable_if_t<E::value == 1, decltype(any(array))>
{
if (axis != 0)
throw types::ValueError("axis out of bounds");
@@ -65,10 +60,8 @@ namespace numpy
}
template <class E>
- typename std::enable_if<
- E::value != 1,
- types::ndarray<typename E::dtype,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<E::value != 1,
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value - 1>>>
any(E const &array, long axis)
{
constexpr long N = E::value;
@@ -78,20 +71,17 @@ namespace numpy
if (axis == 0) {
types::array_tuple<long, N> shp;
shp[0] = 1;
- sutils::copy_shape<1, 0>(shp, array, utils::make_index_sequence<N - 1>());
+ sutils::copy_shape<1, 0>(shp, array, std::make_index_sequence<N - 1>());
types::ndarray<bool, types::array_tuple<long, N>> out(shp, false);
- return std::accumulate(array.begin(), array.end(), *out.begin(),
- numpy::functor::add());
+ return std::accumulate(array.begin(), array.end(), *out.begin(), numpy::functor::add());
} else {
types::array_tuple<long, N - 1> shp;
- sutils::copy_shape<0, 0>(shp, array, utils::make_index_sequence<N - 1>());
- types::ndarray<bool, types::array_tuple<long, N - 1>> anyy(
- shp, builtins::None);
- std::transform(
- array.begin(), array.end(), anyy.begin(),
- [=](types::ndarray<T, types::array_tuple<long, N - 1>> const &other) {
- return any(other, axis - 1);
- });
+ sutils::copy_shape<0, 0>(shp, array, std::make_index_sequence<N - 1>());
+ types::ndarray<bool, types::array_tuple<long, N - 1>> anyy(shp, builtins::None);
+ std::transform(array.begin(), array.end(), anyy.begin(),
+ [=](types::ndarray<T, types::array_tuple<long, N - 1>> const &other) {
+ return any(other, axis - 1);
+ });
return anyy;
}
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/append.hpp b/contrib/python/pythran/pythran/pythonic/numpy/append.hpp
index 82779af5521..6f15f8ef9b7 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/append.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/append.hpp
@@ -12,35 +12,29 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS, class F>
- typename std::enable_if<
- !types::is_dtype<F>::value,
- types::ndarray<
- typename __combined<T, typename types::dtype_of<F>::type>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<!types::is_dtype<F>::value,
+ types::ndarray<typename __combined<T, typename types::dtype_of<F>::type>::type,
+ types::pshape<long>>>
append(types::ndarray<T, pS> const &nto, F const &data)
{
auto ndata = numpy::functor::asarray{}(data);
long nsize = nto.flat_size() + ndata.flat_size();
- types::ndarray<
- typename __combined<T, typename types::dtype_of<F>::type>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<T, typename types::dtype_of<F>::type>::type,
+ types::pshape<long>>
out(types::pshape<long>(nsize), builtins::None);
auto out_back = std::copy(nto.fbegin(), nto.fend(), out.fbegin());
std::copy(ndata.fbegin(), ndata.fend(), out_back);
return out;
}
template <class T, class pS, class F>
- typename std::enable_if<
- types::is_dtype<F>::value,
- types::ndarray<
- typename __combined<T, typename types::dtype_of<F>::type>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<types::is_dtype<F>::value,
+ types::ndarray<typename __combined<T, typename types::dtype_of<F>::type>::type,
+ types::pshape<long>>>
append(types::ndarray<T, pS> const &nto, F const &data)
{
long nsize = nto.flat_size() + 1;
- types::ndarray<
- typename __combined<T, typename types::dtype_of<F>::type>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<T, typename types::dtype_of<F>::type>::type,
+ types::pshape<long>>
out(types::pshape<long>(nsize), builtins::None);
auto out_back = std::copy(nto.fbegin(), nto.fend(), out.fbegin());
*out_back = data;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp b/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp
index a483e1dba3c..fe1ff2fb780 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/arange.hpp
@@ -12,8 +12,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class U, class S, class dtype>
- types::numpy_expr<pythonic::operator_::functor::pos,
- details::arange_index<typename dtype::type>>
+ types::numpy_expr<pythonic::operator_::functor::pos, details::arange_index<typename dtype::type>>
arange(T begin, U end, S step, dtype d)
{
using R = typename dtype::type;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp
index 4be4ce60447..8189a7c5d10 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/argmax.hpp
@@ -36,8 +36,7 @@ namespace numpy
}
template <class E>
- types::ndarray<long, types::array_tuple<long, E::value - 1>>
- argmax(E const &expr, long axis)
+ types::ndarray<long, types::array_tuple<long, E::value - 1>> argmax(E const &expr, long axis)
{
return argminmax<argmax_op<E>>(expr, axis);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp
index e146da20d82..055e310b0cc 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/argmin.hpp
@@ -37,8 +37,7 @@ namespace numpy
}
template <class E>
- types::ndarray<long, types::array_tuple<long, E::value - 1>>
- argmin(E const &expr, long axis)
+ types::ndarray<long, types::array_tuple<long, E::value - 1>> argmin(E const &expr, long axis)
{
return argminmax<argmin_op<E>>(expr, axis);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp
index 11aca63b3ac..8d667afd815 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/argminmax.hpp
@@ -13,7 +13,7 @@ namespace numpy
namespace details
{
template <class P, size_t... Is>
- P iota(utils::index_sequence<Is...>)
+ P iota(std::index_sequence<Is...>)
{
return {static_cast<typename P::value_type>(Is)...};
}
@@ -21,7 +21,7 @@ namespace numpy
template <class P>
P iota()
{
- return iota<P>(utils::make_index_sequence<P::size>());
+ return iota<P>(std::make_index_sequence<P::size>());
}
} // namespace details
template <class Op, class E, class T>
@@ -41,11 +41,9 @@ namespace numpy
}
template <class Op, class E, class T>
#ifdef USE_XSIMD
- typename std::enable_if<
- !E::is_vectorizable ||
- !types::is_vector_op<typename Op::op, T, T>::value ||
- std::is_same<typename E::dtype, bool>::value,
- long>::type
+ std::enable_if_t<!E::is_vectorizable || !types::is_vector_op<typename Op::op, T, T>::value ||
+ std::is_same<typename E::dtype, bool>::value,
+ long>
#else
long
#endif
@@ -55,12 +53,11 @@ namespace numpy
}
template <class Op, class E, class T, class... Indices>
- std::tuple<long, long> _argminmax_fast(E const &elts, T &minmax_elts,
- long current_pos, utils::int_<1>,
- Indices... indices)
+ std::tuple<long, long> _argminmax_fast(E const &elts, T &minmax_elts, long current_pos,
+ utils::int_<1>, Indices... indices)
{
long res = -1;
- long n = elts.template shape<std::decay<E>::type::value - 1>();
+ long n = elts.template shape<std::decay_t<E>::value - 1>();
for (long i = 0; i < n; ++i) {
auto elt = elts.load(indices..., i);
if (Op::value(elt, minmax_elts)) {
@@ -74,10 +71,9 @@ namespace numpy
#ifdef USE_XSIMD
template <class Op, class E, class T>
- typename std::enable_if<
- E::is_vectorizable && types::is_vector_op<typename Op::op, T, T>::value &&
- !std::is_same<typename E::dtype, bool>::value,
- long>::type
+ std::enable_if_t<E::is_vectorizable && types::is_vector_op<typename Op::op, T, T>::value &&
+ !std::is_same<typename E::dtype, bool>::value,
+ long>
_argminmax(E const &elts, T &minmax_elts, utils::int_<1>)
{
using vT = xsimd::batch<T>;
@@ -151,16 +147,15 @@ namespace numpy
return current_minmaxarg;
}
template <class Op, class E, size_t N, class T, class... Indices>
- typename std::enable_if<N != 1, std::tuple<long, long>>::type
- _argminmax_fast(E const &elts, T &minmax_elts, long current_pos,
- utils::int_<N>, Indices... indices)
+ std::enable_if_t<N != 1, std::tuple<long, long>> _argminmax_fast(E const &elts, T &minmax_elts,
+ long current_pos, utils::int_<N>,
+ Indices... indices)
{
long current_minmaxarg = 0;
- for (long i = 0, n = elts.template shape<std::decay<E>::type::value - N>();
- i < n; ++i) {
+ for (long i = 0, n = elts.template shape<std::decay_t<E>::value - N>(); i < n; ++i) {
long v;
- std::tie(v, current_pos) = _argminmax_fast<Op>(
- elts, minmax_elts, current_pos, utils::int_<N - 1>(), indices..., i);
+ std::tie(v, current_pos) =
+ _argminmax_fast<Op>(elts, minmax_elts, current_pos, utils::int_<N - 1>(), indices..., i);
if (v >= 0)
current_minmaxarg = v;
}
@@ -176,8 +171,7 @@ namespace numpy
elt_type argminmax_value = Op::limit();
#ifndef USE_XSIMD
if (utils::no_broadcast_ex(expr)) {
- return std::get<0>(_argminmax_fast<Op>(expr, argminmax_value, 0,
- utils::int_<E::value>()));
+ return std::get<0>(_argminmax_fast<Op>(expr, argminmax_value, 0, utils::int_<E::value>()));
} else
#endif
return _argminmax<Op>(expr, argminmax_value, utils::int_<E::value>());
@@ -193,73 +187,65 @@ namespace numpy
}
}
- template <class Op, size_t Dim, size_t Axis, class T, class E, class V,
- size_t N>
- typename std::enable_if<Axis != (Dim - N), void>::type
- _argminmax_tail(T &&out, E const &expr, long curr, V &&curr_minmax,
- std::integral_constant<size_t, N>)
+ template <class Op, size_t Dim, size_t Axis, class T, class E, class V, size_t N>
+ std::enable_if_t<Axis != (Dim - N), void> _argminmax_tail(T &&out, E const &expr, long curr,
+ V &&curr_minmax,
+ std::integral_constant<size_t, N>)
{
static_assert(N >= 1, "specialization ok");
long i = 0;
for (auto &&elt : expr) {
- _argminmax_tail<Op, Dim, Axis>(out.fast(i), elt, curr,
- curr_minmax.fast(i),
+ _argminmax_tail<Op, Dim, Axis>(out.fast(i), elt, curr, curr_minmax.fast(i),
std::integral_constant<size_t, N - 1>());
++i;
}
}
template <class Op, size_t Dim, size_t Axis, class T, class E>
- typename std::enable_if<Axis == (Dim - 1), void>::type
- _argminmax_head(T &&out, E const &expr, std::integral_constant<size_t, 1>)
+ std::enable_if_t<Axis == (Dim - 1), void> _argminmax_head(T &&out, E const &expr,
+ std::integral_constant<size_t, 1>)
{
typename E::dtype val = Op::limit();
long i = 0;
for (auto &&elt : expr)
- _argminmax_tail<Op, Dim, Axis>(out, elt, i++, val,
- std::integral_constant<size_t, 0>());
+ _argminmax_tail<Op, Dim, Axis>(out, elt, i++, val, std::integral_constant<size_t, 0>());
}
template <class Op, size_t Dim, size_t Axis, class T, class E, size_t N>
- typename std::enable_if<Axis == (Dim - N), void>::type
- _argminmax_head(T &&out, E const &expr, std::integral_constant<size_t, N>)
+ std::enable_if_t<Axis == (Dim - N), void> _argminmax_head(T &&out, E const &expr,
+ std::integral_constant<size_t, N>)
{
static_assert(N > 1, "specialization ok");
- types::ndarray<typename E::dtype, types::array_tuple<long, N - 1>> val{
- sutils::getshape(out), Op::limit()};
+ types::ndarray<typename E::dtype, types::array_tuple<long, N - 1>> val{sutils::getshape(out),
+ Op::limit()};
long i = 0;
for (auto &&elt : expr) {
- _argminmax_tail<Op, Dim, Axis>(out, elt, i++, val,
- std::integral_constant<size_t, N - 1>());
+ _argminmax_tail<Op, Dim, Axis>(out, elt, i++, val, std::integral_constant<size_t, N - 1>());
}
}
template <class Op, size_t Dim, size_t Axis, class T, class E, size_t N>
- typename std::enable_if<Axis != (Dim - N), void>::type
- _argminmax_head(T &&out, E const &expr, std::integral_constant<size_t, N>)
+ std::enable_if_t<Axis != (Dim - N), void> _argminmax_head(T &&out, E const &expr,
+ std::integral_constant<size_t, N>)
{
static_assert(N >= 1, "specialization ok");
auto out_iter = out.begin();
for (auto &&elt : expr) {
- _argminmax_head<Op, Dim, Axis>(*out_iter, elt,
- std::integral_constant<size_t, N - 1>());
+ _argminmax_head<Op, Dim, Axis>(*out_iter, elt, std::integral_constant<size_t, N - 1>());
++out_iter;
}
}
template <class Op, size_t N, class T, class E, size_t... Axis>
- void _argminmax_pick_axis(long axis, T &&out, E const &expr,
- utils::index_sequence<Axis...>)
+ void _argminmax_pick_axis(long axis, T &&out, E const &expr, std::index_sequence<Axis...>)
{
(void)std::initializer_list<bool>{
- ((Axis == axis) && (_argminmax_head<Op, N, Axis>(
- out, expr, std::integral_constant<size_t, N>()),
- true))...};
+ ((Axis == axis) &&
+ (_argminmax_head<Op, N, Axis>(out, expr, std::integral_constant<size_t, N>()), true))...};
}
template <class Op, class E>
- types::ndarray<long, types::array_tuple<long, E::value - 1>>
- argminmax(E const &array, long axis)
+ types::ndarray<long, types::array_tuple<long, E::value - 1>> argminmax(E const &array, long axis)
{
if (axis < 0)
axis += E::value;
@@ -269,10 +255,8 @@ namespace numpy
types::array_tuple<long, E::value - 1> shp;
auto next = std::copy(shape.begin(), shape.begin() + axis, shp.begin());
std::copy(shape.begin() + axis + 1, shape.end(), next);
- types::ndarray<long, types::array_tuple<long, E::value - 1>> out{
- shp, builtins::None};
- _argminmax_pick_axis<Op, E::value>(axis, out, array,
- utils::make_index_sequence<E::value>());
+ types::ndarray<long, types::array_tuple<long, E::value - 1>> out{shp, builtins::None};
+ _argminmax_pick_axis<Op, E::value>(axis, out, array, std::make_index_sequence<E::value>());
return out;
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp
index 68bf4b76fba..9416327c164 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/argsort.hpp
@@ -9,16 +9,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::ndarray<long, types::array_tuple<long, 1>>
- argsort(E const &expr, types::none_type, types::none_type)
+ types::ndarray<long, types::array_tuple<long, 1>> argsort(E const &expr, types::none_type,
+ types::none_type)
{
auto out = functor::array{}(expr).flat();
return argsort(out);
}
template <class T, class pS, class Sorter>
- types::ndarray<long, pS> _argsort(types::ndarray<T, pS> const &a, long axis,
- Sorter sorter)
+ types::ndarray<long, pS> _argsort(types::ndarray<T, pS> const &a, long axis, Sorter sorter)
{
constexpr auto N = std::tuple_size<pS>::value;
if (axis < 0)
@@ -30,8 +29,7 @@ namespace numpy
size_t step = a.template shape<N - 1>();
auto a_base = a.fbegin();
- for (long *iter_indices = indices.buffer,
- *end_indices = indices.buffer + flat_size;
+ for (long *iter_indices = indices.buffer, *end_indices = indices.buffer + flat_size;
iter_indices != end_indices; iter_indices += step, a_base += step) {
// fill with the original indices
std::iota(iter_indices, iter_indices + step, 0L);
@@ -42,8 +40,7 @@ namespace numpy
} else {
auto out_shape = sutils::getshape(a);
const long step =
- std::accumulate(out_shape.begin() + axis, out_shape.end(), 1L,
- std::multiplies<long>());
+ std::accumulate(out_shape.begin() + axis, out_shape.end(), 1L, std::multiplies<long>());
long const buffer_size = out_shape[axis];
const long stepper = step / out_shape[axis];
const long n = flat_size / out_shape[axis];
@@ -54,10 +51,9 @@ namespace numpy
std::iota(buffer_start, buffer_end, 0L);
for (long i = 0; i < n; i++) {
auto a_base = a.fbegin() + ith;
- sorter(buffer, buffer + buffer_size,
- [a_base, stepper](long i1, long i2) {
- return a_base[i1 * stepper] < a_base[i2 * stepper];
- });
+ sorter(buffer, buffer + buffer_size, [a_base, stepper](long i1, long i2) {
+ return a_base[i1 * stepper] < a_base[i2 * stepper];
+ });
for (long j = 0; j < buffer_size; ++j)
indices.buffer[ith + j * stepper] = buffer[j];
@@ -73,8 +69,7 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis,
- types::none_type)
+ types::ndarray<long, pS> argsort(types::ndarray<T, pS> const &a, long axis, types::none_type)
{
return _argsort(a, axis, ndarray::quicksorter());
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp b/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp
index 0a366decfb5..fa483aea92d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/argwhere.hpp
@@ -12,16 +12,14 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- typename types::ndarray<long, types::array_tuple<long, 2>>
- argwhere(E const &expr)
+ typename types::ndarray<long, types::array_tuple<long, 2>> argwhere(E const &expr)
{
constexpr long N = E::value;
auto arr = asarray(expr);
long sz = arr.flat_size();
auto eshape = sutils::getshape(arr);
- utils::shared_ref<types::raw_array<long>> buffer(sz *
- N); // too much memory used
+ utils::shared_ref<types::raw_array<long>> buffer(sz * N); // too much memory used
long *buffer_iter = buffer->data;
long real_sz = 0;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/around.hpp b/contrib/python/pythran/pythran/pythonic/numpy/around.hpp
index 920e53e92a0..600a321aba2 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/around.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/around.hpp
@@ -23,40 +23,29 @@ namespace numpy
// generic floating point version, pure numpy_expr
template <class E>
- auto around(E &&a, long decimals) ->
- typename std::enable_if<
- !std::is_integral<typename types::dtype_of<
- typename std::decay<E>::type>::type>::value,
- decltype(functor::rint{}(functor::multiply{}(
- std::forward<E>(a),
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>())) /
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>())>::type
+ auto around(E &&a, long decimals) -> std::enable_if_t<
+ !std::is_integral<typename types::dtype_of<std::decay_t<E>>::type>::value,
+ decltype(functor::rint{}(functor::multiply{}(
+ std::forward<E>(a),
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>())) /
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>())>
{
- typename types::dtype_of<typename std::decay<E>::type>::type const fact =
- functor::power{}(10., decimals);
- return functor::rint{}(functor::multiply{}(std::forward<E>(a), fact)) /
- fact;
+ typename types::dtype_of<std::decay_t<E>>::type const fact = functor::power{}(10., decimals);
+ return functor::rint{}(functor::multiply{}(std::forward<E>(a), fact)) / fact;
}
// the integer version is only relevant when decimals < 0
template <class E>
- auto around(E &&a, long decimals) ->
- typename std::enable_if<
- std::is_integral<typename types::dtype_of<
- typename std::decay<E>::type>::type>::value,
- decltype(numpy::functor::floor_divide{}(
- functor::float64{}(std::forward<E>(a)),
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>()) *
- std::declval<typename types::dtype_of<
- typename std::decay<E>::type>::type>())>::type
+ auto around(E &&a, long decimals) -> std::enable_if_t<
+ std::is_integral<typename types::dtype_of<std::decay_t<E>>::type>::value,
+ decltype(numpy::functor::floor_divide{}(
+ functor::float64{}(std::forward<E>(a)),
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>()) *
+ std::declval<typename types::dtype_of<std::decay_t<E>>::type>())>
{
- typename types::dtype_of<typename std::decay<E>::type>::type const fact =
+ typename types::dtype_of<std::decay_t<E>>::type const fact =
functor::power{}(10L, std::max(0L, -decimals));
- return pythonic::numpy::functor::floor_divide{}(
- functor::float64{}(std::forward<E>(a)), fact) *
+ return pythonic::numpy::functor::floor_divide{}(functor::float64{}(std::forward<E>(a)), fact) *
fact;
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/array.hpp b/contrib/python/pythran/pythran/pythonic/numpy/array.hpp
index 2feaf5cd70f..ca6df755da2 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/array.hpp
@@ -12,46 +12,37 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class dtype>
- typename std::enable_if<
- types::has_size<typename std::decay<T>::type>::value,
- types::ndarray<typename dtype::type,
- types::array_tuple<long, std::decay<T>::type::value>>>::
- type
- array(T &&iterable, dtype d)
+ std::enable_if_t<
+ types::has_size<std::decay_t<T>>::value,
+ types::ndarray<typename dtype::type, types::array_tuple<long, std::decay_t<T>::value>>>
+ array(T &&iterable, dtype d)
{
return {std::forward<T>(iterable)};
}
template <class T, class dtype>
- typename std::enable_if<
- !types::has_size<typename std::decay<T>::type>::value &&
- !types::is_dtype<typename std::decay<T>::type>::value,
- types::ndarray<typename dtype::type,
- types::array_tuple<long, std::decay<T>::type::value>>>::
- type
- array(T &&iterable, dtype d)
+ std::enable_if_t<
+ !types::has_size<std::decay_t<T>>::value && !types::is_dtype<std::decay_t<T>>::value,
+ types::ndarray<typename dtype::type, types::array_tuple<long, std::decay<T>::type::value>>>
+ array(T &&iterable, dtype d)
{
- types::list<typename std::decay<T>::type::value_type> tmp{iterable.begin(),
- iterable.end()};
+ types::list<typename std::decay_t<T>::value_type> tmp{iterable.begin(), iterable.end()};
return {tmp};
}
template <class T, class dtype>
- typename std::enable_if<
- !types::has_size<typename std::decay<T>::type>::value &&
- types::is_dtype<typename std::decay<T>::type>::value,
- typename dtype::type>::type
+ std::enable_if_t<!types::has_size<std::decay_t<T>>::value &&
+ types::is_dtype<std::decay_t<T>>::value,
+ typename dtype::type>
array(T &&non_iterable, dtype d)
{
return non_iterable;
}
template <class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, 0>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, 0>>>
array(std::tuple<>, dtype)
{
- return {types::pshape<std::integral_constant<long, 0>>{},
- types::none_type{}};
+ return {types::pshape<std::integral_constant<long, 0>>{}, types::none_type{}};
}
template <class T, class pS>
@@ -61,16 +52,14 @@ namespace numpy
}
template <class T, size_t N, class V, class dtype>
- types::ndarray<typename dtype::type,
- typename types::array_base<T, N, V>::shape_t>
+ types::ndarray<typename dtype::type, typename types::array_base<T, N, V>::shape_t>
array(types::array_base<T, N, V> const &a, dtype)
{
return {a};
}
template <class T, size_t N, class V, class dtype>
- types::ndarray<typename dtype::type,
- typename types::array_base<T, N, V>::shape_t>
+ types::ndarray<typename dtype::type, typename types::array_base<T, N, V>::shape_t>
array(types::array_base<T, N, V> &&a, dtype)
{
return {std::move(a)};
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp b/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp
index 77b45bae840..2aab705195d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/array_equiv.hpp
@@ -23,15 +23,13 @@ namespace numpy
} // namespace
template <class U, class V>
- typename std::enable_if<U::value == V::value, bool>::type
- array_equiv(U const &u, V const &v)
+ std::enable_if_t<U::value == V::value, bool> array_equiv(U const &u, V const &v)
{
return array_equal(u, v);
}
template <class U, class V>
- typename std::enable_if <
- U::value<V::value, bool>::type array_equiv(U const &u, V const &v)
+ std::enable_if_t < U::value<V::value, bool> array_equiv(U const &u, V const &v)
{
if (v.flat_size() % u.flat_size() == 0)
// requires allocation for u' as it is used multiple times.
@@ -40,8 +38,7 @@ namespace numpy
}
template <class U, class V>
- typename std::enable_if<(U::value > V::value), bool>::type
- array_equiv(U const &u, V const &v)
+ std::enable_if_t<(U::value > V::value), bool> array_equiv(U const &u, V const &v)
{
return array_equiv(v, u);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/array_split.hpp b/contrib/python/pythran/pythran/pythonic/numpy/array_split.hpp
index 933a9fafa7c..519d192ffe4 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/array_split.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/array_split.hpp
@@ -11,8 +11,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::list<typename assignable<
- decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
+ types::list<
+ typename assignable<decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
array_split(E const &a, long nb_split)
{
long sz = a.template shape<0>();
@@ -21,8 +21,8 @@ namespace numpy
long nb_full_split = nb_split;
if (end != sz)
nb_full_split -= (end - sz);
- types::list<typename assignable<
- decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
+ types::list<
+ typename assignable<decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
out(nb_split);
long index = 0;
@@ -35,16 +35,14 @@ namespace numpy
}
template <class E, class I>
- typename std::enable_if<
- types::is_iterable<I>::value,
- types::list<typename assignable<
- decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>>::
- type
- array_split(E const &a, I const &split_mask)
+ std::enable_if_t<types::is_iterable<I>::value,
+ types::list<typename assignable<
+ decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>>
+ array_split(E const &a, I const &split_mask)
{
long sz = a.template shape<0>();
- types::list<typename assignable<
- decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
+ types::list<
+ typename assignable<decltype(std::declval<E>()[types::fast_contiguous_slice()])>::type>
out(1 + split_mask.flat_size());
long index = 0;
auto inserter = out.begin();
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp b/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp
index a1e19f7121a..e3bb11f7507 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/asarray.hpp
@@ -29,24 +29,18 @@ namespace numpy
template <class E>
auto asarray(E &&e, types::none_type d)
- -> decltype(_asarray<typename std::decay<E>::type,
- typename types::dtype_of<
- typename std::decay<E>::type>::type>{}(
+ -> decltype(_asarray<std::decay_t<E>, typename types::dtype_of<std::decay_t<E>>::type>{}(
std::forward<E>(e)))
{
- return _asarray<
- typename std::decay<E>::type,
- typename types::dtype_of<typename std::decay<E>::type>::type>{}(
+ return _asarray<std::decay_t<E>, typename types::dtype_of<std::decay_t<E>>::type>{}(
std::forward<E>(e));
}
template <class E, class dtype>
auto asarray(E &&e, dtype d)
- -> decltype(_asarray<typename std::decay<E>::type,
- typename dtype::type>{}(std::forward<E>(e), d))
+ -> decltype(_asarray<std::decay_t<E>, typename dtype::type>{}(std::forward<E>(e), d))
{
- return _asarray<typename std::decay<E>::type, typename dtype::type>{}(
- std::forward<E>(e), d);
+ return _asarray<std::decay_t<E>, typename dtype::type>{}(std::forward<E>(e), d);
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp b/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp
index 23213ad4394..6b4d259ef9f 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/asscalar.hpp
@@ -16,8 +16,7 @@ namespace numpy
asscalar_result_type<typename E::dtype> asscalar(E const &expr)
{
if (expr.flat_size() != 1)
- throw types::ValueError(
- "can only convert an array of size 1 to a Python scalar");
+ throw types::ValueError("can only convert an array of size 1 to a Python scalar");
return *asarray(expr).fbegin();
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp
index f5d5c6c7679..aa207335b67 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/atleast_1d.hpp
@@ -10,18 +10,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<
- types::is_dtype<T>::value,
- types::ndarray<T, types::pshape<std::integral_constant<long, 1>>>>::type
+ std::enable_if_t<types::is_dtype<T>::value,
+ types::ndarray<T, types::pshape<std::integral_constant<long, 1>>>>
atleast_1d(T t)
{
return {types::pshape<std::integral_constant<long, 1>>(), t};
}
template <class T>
- auto atleast_1d(T const &t) ->
- typename std::enable_if<!(types::is_dtype<T>::value),
- decltype(asarray(t))>::type
+ auto atleast_1d(T const &t) -> std::enable_if_t<!types::is_dtype<T>::value, decltype(asarray(t))>
{
return asarray(t);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp
index e26f8abde95..7d1b02beb25 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/atleast_2d.hpp
@@ -10,40 +10,30 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<
- types::is_dtype<T>::value,
- types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
- std::integral_constant<long, 1>>>>::type
+ std::enable_if_t<types::is_dtype<T>::value,
+ types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
+ std::integral_constant<long, 1>>>>
atleast_2d(T t)
{
- return {types::pshape<std::integral_constant<long, 1>,
- std::integral_constant<long, 1>>(),
- t};
+ return {types::pshape<std::integral_constant<long, 1>, std::integral_constant<long, 1>>(), t};
}
template <class T>
- auto atleast_2d(T const &t) ->
- typename std::enable_if < (!types::is_dtype<T>::value) &&
- T::value<2,
- types::ndarray<
- typename T::dtype,
- types::pshape<std::integral_constant<long, 1>,
- typename std::tuple_element<
- 0, typename T::shape_t>::type>>>::type
+ auto atleast_2d(T const &t) -> std::enable_if_t < (!types::is_dtype<T>::value) &&
+ T::value<2, types::ndarray<typename T::dtype,
+ types::pshape<std::integral_constant<long, 1>,
+ std::tuple_element_t<0, typename T::shape_t>>>>
{
- return t.reshape(types::pshape<
- std::integral_constant<long, 1>,
- typename std::tuple_element<0, typename T::shape_t>::type>(
+ return t.reshape(types::pshape<std::integral_constant<long, 1>,
+ std::tuple_element_t<0, typename T::shape_t>>(
std::integral_constant<long, 1>(), t.template shape<0>()));
}
template <class T>
- auto atleast_2d(T &&t) ->
- typename std::enable_if<
- (!types::is_dtype<typename std::remove_cv<
- typename std::remove_reference<T>::type>::type>::value) &&
- std::decay<T>::type::value >= 2,
- decltype(std::forward<T>(t))>::type
+ auto atleast_2d(T &&t)
+ -> std::enable_if_t<(!types::is_dtype<std::remove_cv_t<std::remove_reference_t<T>>>::value) &&
+ std::decay_t<T>::value >= 2,
+ decltype(std::forward<T>(t))>
{
return std::forward<T>(t);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp
index 3bf8a3fbe4c..907882fff30 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/atleast_3d.hpp
@@ -10,62 +10,49 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<
- types::is_dtype<T>::value,
- types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
- std::integral_constant<long, 1>,
- std::integral_constant<long, 1>>>>::type
+ std::enable_if_t<types::is_dtype<T>::value,
+ types::ndarray<T, types::pshape<std::integral_constant<long, 1>,
+ std::integral_constant<long, 1>,
+ std::integral_constant<long, 1>>>>
atleast_3d(T t)
{
- return {types::pshape<std::integral_constant<long, 1>,
- std::integral_constant<long, 1>,
+ return {types::pshape<std::integral_constant<long, 1>, std::integral_constant<long, 1>,
std::integral_constant<long, 1>>(),
t};
}
template <class T>
- auto atleast_3d(T const &t) ->
- typename std::enable_if<
- (!types::is_dtype<T>::value) && (T::value == 1),
- types::ndarray<typename T::dtype,
- types::pshape<std::integral_constant<long, 1>,
- typename std::tuple_element<
- 0, typename T::shape_t>::type,
- std::integral_constant<long, 1>>>>::type
+ auto atleast_3d(T const &t) -> std::enable_if_t<
+ (!types::is_dtype<T>::value) && (T::value == 1),
+ types::ndarray<typename T::dtype, types::pshape<std::integral_constant<long, 1>,
+ std::tuple_element_t<0, typename T::shape_t>,
+ std::integral_constant<long, 1>>>>
{
auto r = asarray(t);
return r.reshape(
- types::pshape<std::integral_constant<long, 1>,
- typename std::tuple_element<0, typename T::shape_t>::type,
- std::integral_constant<long, 1>>(
- std::integral_constant<long, 1>(), r.template shape<0>(),
- std::integral_constant<long, 1>()));
+ types::pshape<std::integral_constant<long, 1>, std::tuple_element_t<0, typename T::shape_t>,
+ std::integral_constant<long, 1>>(std::integral_constant<long, 1>(),
+ r.template shape<0>(),
+ std::integral_constant<long, 1>()));
}
template <class T>
- auto atleast_3d(T const &t) ->
- typename std::enable_if<
- (!types::is_dtype<T>::value) && (T::value == 2),
- types::ndarray<
- typename T::dtype,
- types::pshape<
- typename std::tuple_element<0, typename T::shape_t>::type,
- typename std::tuple_element<1, typename T::shape_t>::type,
- std::integral_constant<long, 1>>>>::type
+ auto atleast_3d(T const &t) -> std::enable_if_t<
+ (!types::is_dtype<T>::value) && (T::value == 2),
+ types::ndarray<typename T::dtype, types::pshape<std::tuple_element_t<0, typename T::shape_t>,
+ std::tuple_element_t<1, typename T::shape_t>,
+ std::integral_constant<long, 1>>>>
{
auto r = asarray(t);
- return r.reshape(
- types::pshape<typename std::tuple_element<0, typename T::shape_t>::type,
- typename std::tuple_element<1, typename T::shape_t>::type,
- std::integral_constant<long, 1>>(
- r.template shape<0>(), r.template shape<1>(),
- std::integral_constant<long, 1>()));
+ return r.reshape(types::pshape<std::tuple_element_t<0, typename T::shape_t>,
+ std::tuple_element_t<1, typename T::shape_t>,
+ std::integral_constant<long, 1>>(
+ r.template shape<0>(), r.template shape<1>(), std::integral_constant<long, 1>()));
}
template <class T>
- auto atleast_3d(T const &t) ->
- typename std::enable_if<(!types::is_dtype<T>::value) && T::value >= 3,
- decltype(asarray(t))>::type
+ auto atleast_3d(T const &t)
+ -> std::enable_if_t<(!types::is_dtype<T>::value) && T::value >= 3, decltype(asarray(t))>
{
return asarray(t);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/average.hpp b/contrib/python/pythran/pythran/pythonic/numpy/average.hpp
index 3be4975aa7e..78848b350df 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/average.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/average.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto average(E const &expr,
- types::none_type const &axis) -> decltype(sum(expr, axis) / 1.)
+ auto average(E const &expr, types::none_type const &axis) -> decltype(sum(expr, axis) / 1.)
{
return sum(expr, axis) / double(expr.flat_size());
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp b/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp
index 5c83c69b31d..17f9567f3a6 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/base_repr.hpp
@@ -19,11 +19,8 @@ namespace numpy
return res;
}
- int const ndigits =
- (number == 0 ? 1
- : std::ceil(std::log(std::labs(number)) / std::log(base)));
- int const effective_padding =
- padding - ((number == 0) && (padding > 0) ? 1 : 0);
+ int const ndigits = (number == 0 ? 1 : std::ceil(std::log(std::labs(number)) / std::log(base)));
+ int const effective_padding = padding - ((number == 0) && (padding > 0) ? 1 : 0);
res.resize(ndigits + effective_padding + (number < 0 ? 1 : 0));
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp b/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp
index 0805a71ce0b..b7249f548b9 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/bincount.hpp
@@ -11,43 +11,37 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- types::ndarray<long, types::pshape<long>>>::type
- bincount(types::ndarray<T, pS> const &expr, types::none_type weights,
- types::none<long> minlength)
+ std::enable_if_t<std::tuple_size<pS>::value == 1, types::ndarray<long, types::pshape<long>>>
+ bincount(types::ndarray<T, pS> const &expr, types::none_type weights, types::none<long> minlength)
{
long length = 0;
if (minlength)
length = (long)minlength;
length = std::max<long>(length, 1 + max(expr));
- types::ndarray<long, types::pshape<long>> out(types::pshape<long>(length),
- 0L);
+ types::ndarray<long, types::pshape<long>> out(types::pshape<long>(length), 0L);
for (auto iter = expr.fbegin(), end = expr.fend(); iter != end; ++iter)
++out[*iter];
return out;
}
template <class T, class E, class pS>
- typename std::enable_if<
+ std::enable_if_t<
std::tuple_size<pS>::value == 1,
- types::ndarray<decltype(std::declval<long>() *
- std::declval<typename E::dtype>()),
- types::pshape<long>>>::type
- bincount(types::ndarray<T, pS> const &expr, E const &weights,
- types::none<long> minlength)
+ types::ndarray<decltype(std::declval<long>() * std::declval<typename E::dtype>()),
+ types::pshape<long>>>
+ bincount(types::ndarray<T, pS> const &expr, E const &weights, types::none<long> minlength)
{
long length = 0;
if (minlength)
length = (long)minlength;
length = std::max<long>(length, 1 + max(expr));
- typename std::enable_if<
+ std::enable_if_t<
std::tuple_size<pS>::value == 1,
- types::ndarray<
- decltype(std::declval<long>() * std::declval<typename E::dtype>()),
- types::pshape<long>>>::type out(types::pshape<long>(length), 0L);
+ types::ndarray<decltype(std::declval<long>() * std::declval<typename E::dtype>()),
+ types::pshape<long>>>
+ out(types::pshape<long>(length), 0L);
auto iweight = weights.begin();
- for (auto iter = expr.fbegin(), end = expr.fend(); iter != end;
- ++iter, ++iweight)
+ for (auto iter = expr.fbegin(), end = expr.fend(); iter != end; ++iter, ++iweight)
out[*iter] += *iweight;
return out;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp b/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp
index 8498a767e5e..dcfa0ccb9f0 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/broadcast_to.hpp
@@ -11,22 +11,18 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class pS>
- auto broadcast_to(E const &expr, pS shape)
- -> decltype(numpy::functor::empty{}(
- shape, typename types::dtype_t<typename types::dtype_of<E>::type>{}))
+ auto broadcast_to(E const &expr, pS shape) -> decltype(numpy::functor::empty{}(
+ shape, typename types::dtype_t<typename types::dtype_of<E>::type>{}))
{
using dtype = typename types::dtype_of<E>::type;
using BExpr =
- typename std::conditional<std::is_scalar<E>::value,
- types::broadcast<E, dtype>, E const &>::type;
+ std::conditional_t<std::is_scalar<E>::value, types::broadcast<E, dtype>, E const &>;
auto out = numpy::functor::empty{}(shape, typename types::dtype_t<dtype>{});
using array_type = decltype(out);
BExpr bexpr = expr;
utils::broadcast_copy<array_type, E, array_type::value,
- array_type::value -
- utils::nested_container_depth<E>::value,
- std::remove_reference<BExpr>::type::is_vectorizable>(
- out, bexpr);
+ array_type::value - utils::nested_container_depth<E>::value,
+ std::remove_reference_t<BExpr>::is_vectorizable>(out, bexpr);
return out;
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/byte.hpp b/contrib/python/pythran/pythran/pythonic/numpy/byte.hpp
index 6bc80e6f941..405630297d7 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/byte.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/byte.hpp
@@ -34,4 +34,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::byte>::convert(numpy::functor::byte const &c)
+{
+ return (PyObject *)&PyByteArrType_Type;
+}
+
+inline bool from_python<numpy::functor::byte>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyByteArrType_Type;
+}
+
+inline numpy::functor::byte from_python<numpy::functor::byte>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/complex128.hpp b/contrib/python/pythran/pythran/pythonic/numpy/complex128.hpp
index e2366a60676..5ee949f279d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/complex128.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/complex128.hpp
@@ -32,5 +32,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::complex128>::convert(numpy::functor::complex128 const &c)
+{
+ return (PyObject *)&PyCDoubleArrType_Type;
+}
+
+inline bool from_python<numpy::functor::complex128>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyCDoubleArrType_Type;
+}
+
+inline numpy::functor::complex128 from_python<numpy::functor::complex128>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/complex256.hpp b/contrib/python/pythran/pythran/pythonic/numpy/complex256.hpp
index 5f055554579..a580300f8ea 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/complex256.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/complex256.hpp
@@ -33,4 +33,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::complex256>::convert(numpy::functor::complex256 const &c)
+{
+ return (PyObject *)&PyCLongDoubleArrType_Type;
+}
+
+inline bool from_python<numpy::functor::complex256>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyCLongDoubleArrType_Type;
+}
+
+inline numpy::functor::complex256 from_python<numpy::functor::complex256>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/complex64.hpp b/contrib/python/pythran/pythran/pythonic/numpy/complex64.hpp
index 2428d427c5e..37c0a629931 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/complex64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/complex64.hpp
@@ -40,4 +40,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::complex64>::convert(numpy::functor::complex64 const &c)
+{
+ return (PyObject *)&PyCFloatArrType_Type;
+}
+
+inline bool from_python<numpy::functor::complex64>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyCFloatArrType_Type;
+}
+
+inline numpy::functor::complex64 from_python<numpy::functor::complex64>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp
index 9d49c83ba5a..dfd03d0cf1a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/concatenate.hpp
@@ -29,17 +29,13 @@ namespace numpy
out_iter = std::copy(ifrom.begin(), ifrom.end(), out_iter);
} else {
using iterator_on_from_value = typename A::value_type::const_iterator;
- std::vector<iterator_on_from_value,
- utils::allocator<iterator_on_from_value>>
- ifroms;
+ std::vector<iterator_on_from_value, utils::allocator<iterator_on_from_value>> ifroms;
for (auto &ifrom : from)
ifroms.emplace_back(ifrom.begin());
using iterator_value_type =
typename std::iterator_traits<iterator_on_from_value>::value_type;
- std::vector<iterator_value_type,
- utils::allocator<iterator_value_type>>
- difroms;
+ std::vector<iterator_value_type, utils::allocator<iterator_value_type>> difroms;
for (auto &&iout : out) {
difroms.clear();
@@ -53,28 +49,23 @@ namespace numpy
}
// array version
template <class Out, class A, size_t... I>
- void operator()(Out &&out, A const &from, long axis,
- utils::index_sequence<I...>) const
+ void operator()(Out &&out, A const &from, long axis, std::index_sequence<I...>) const
{
if (axis == 0) {
auto out_iter = out.begin();
(void)std::initializer_list<int>{
- (out_iter = std::copy(std::get<I>(from).begin(),
- std::get<I>(from).end(), out_iter),
+ (out_iter = std::copy(std::get<I>(from).begin(), std::get<I>(from).end(), out_iter),
1)...};
} else {
- types::array_tuple<typename A::value_type::const_iterator,
- sizeof...(I)>
- ifroms = {std::get<I>(from).begin()...};
+ types::array_tuple<typename A::value_type::const_iterator, sizeof...(I)> ifroms = {
+ std::get<I>(from).begin()...};
for (auto &&iout : out) {
types::array_tuple<
- typename std::iterator_traits<
- typename A::value_type::const_iterator>::value_type,
+ typename std::iterator_traits<typename A::value_type::const_iterator>::value_type,
sizeof...(I)>
difroms = {*std::get<I>(ifroms)...};
- concatenate_helper<N - 1>()(iout, difroms, axis - 1,
- utils::index_sequence<I...>{});
+ concatenate_helper<N - 1>()(iout, difroms, axis - 1, std::index_sequence<I...>{});
(void)std::initializer_list<int>{(++std::get<I>(ifroms), 0)...};
}
}
@@ -82,21 +73,19 @@ namespace numpy
// tuple version
template <class Out, class... Ts, size_t... I>
void operator()(Out &&out, std::tuple<Ts...> const &from, long axis,
- utils::index_sequence<I...>) const
+ std::index_sequence<I...>) const
{
if (axis == 0) {
auto out_iter = out.begin();
(void)std::initializer_list<int>{
- (out_iter = std::copy(std::get<I>(from).begin(),
- std::get<I>(from).end(), out_iter),
+ (out_iter = std::copy(std::get<I>(from).begin(), std::get<I>(from).end(), out_iter),
1)...};
} else {
auto ifroms = std::make_tuple(std::get<I>(from).begin()...);
for (auto &&iout : out) {
auto difroms = std::make_tuple(*std::get<I>(ifroms)...);
- concatenate_helper<N - 1>()(iout, difroms, axis - 1,
- utils::index_sequence<I...>{});
+ concatenate_helper<N - 1>()(iout, difroms, axis - 1, std::index_sequence<I...>{});
(void)std::initializer_list<int>{(++std::get<I>(ifroms), 0)...};
}
}
@@ -112,49 +101,39 @@ namespace numpy
}
// array version
template <class Out, class E, size_t... I>
- void operator()(Out &&, E const &, long,
- utils::index_sequence<I...>) const
+ void operator()(Out &&, E const &, long, std::index_sequence<I...>) const
{
}
// tuple version - sentinel
template <class Out, class... Ts, size_t... I>
- void operator()(Out &&, std::tuple<Ts...> const &, long,
- utils::index_sequence<I...>) const
+ void operator()(Out &&, std::tuple<Ts...> const &, long, std::index_sequence<I...>) const
{
}
};
template <class A, size_t... I>
- long concatenate_axis_size(A const &from, long axis,
- utils::index_sequence<I...>)
+ long concatenate_axis_size(A const &from, long axis, std::index_sequence<I...>)
{
long sizes[] = {sutils::getshape(std::get<I>(from))[axis]...};
- return std::accumulate(std::begin(sizes), std::end(sizes), 0L,
- std::plus<long>());
+ return std::accumulate(std::begin(sizes), std::end(sizes), 0L, std::plus<long>());
}
} // namespace details
template <class... Types>
- auto concatenate(std::tuple<Types...> const &args, long axis)
- -> types::ndarray<
- typename __combined<typename std::decay<Types>::type::dtype...>::type,
- types::array_tuple<
- long, std::tuple_element<0, std::tuple<Types...>>::type::value>>
+ auto concatenate(std::tuple<Types...> const &args, long axis) -> types::ndarray<
+ typename __combined<typename std::decay_t<Types>::dtype...>::type,
+ types::array_tuple<long, std::tuple_element_t<0, std::tuple<Types...>>::value>>
{
- using T =
- typename __combined<typename std::decay<Types>::type::dtype...>::type;
- auto constexpr N = std::decay<decltype(std::get<0>(args))>::type::value;
+ auto constexpr N = std::decay_t<decltype(std::get<0>(args))>::value;
auto shape = sutils::getshape(std::get<0>(args));
- shape[axis] = details::concatenate_axis_size(
- args, axis, utils::make_index_sequence<sizeof...(Types)>{});
+ shape[axis] =
+ details::concatenate_axis_size(args, axis, std::make_index_sequence<sizeof...(Types)>{});
- types::ndarray<
- typename __combined<typename std::decay<Types>::type::dtype...>::type,
- types::array_tuple<
- long, std::decay<decltype(std::get<0>(args))>::type::value>>
+ types::ndarray<typename __combined<typename std::decay_t<Types>::dtype...>::type,
+ types::array_tuple<long, std::decay_t<decltype(std::get<0>(args))>::value>>
result{shape, types::none_type{}};
- details::concatenate_helper<N>()(
- result, args, axis, utils::make_index_sequence<sizeof...(Types)>{});
+ details::concatenate_helper<N>()(result, args, axis,
+ std::make_index_sequence<sizeof...(Types)>{});
return result;
}
@@ -162,15 +141,12 @@ namespace numpy
types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
concatenate(types::array_base<E, M, V> const &args, long axis)
{
- using T = typename E::dtype;
auto constexpr N = E::value;
auto shape = sutils::getshape(std::get<0>(args));
- shape[axis] = details::concatenate_axis_size(
- args, axis, utils::make_index_sequence<M>{});
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> out(
- shape, types::none_type{});
- details::concatenate_helper<N>()(out, args, axis,
- utils::make_index_sequence<M>{});
+ shape[axis] = details::concatenate_axis_size(args, axis, std::make_index_sequence<M>{});
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> out(shape,
+ types::none_type{});
+ details::concatenate_helper<N>()(out, args, axis, std::make_index_sequence<M>{});
return out;
}
@@ -178,15 +154,12 @@ namespace numpy
types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
concatenate(types::list<E> const &ai, long axis)
{
- using return_type =
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>;
- using T = typename return_type::dtype;
+ using return_type = types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>;
auto constexpr N = return_type::value;
auto shape = sutils::getshape(ai[0]);
- shape[axis] = std::accumulate(ai.begin(), ai.end(), 0L,
- [axis](long v, E const &from) {
- return v + sutils::getshape(from)[axis];
- });
+ shape[axis] = std::accumulate(ai.begin(), ai.end(), 0L, [axis](long v, E const &from) {
+ return v + sutils::getshape(from)[axis];
+ });
return_type out{shape, types::none_type{}};
details::concatenate_helper<N>()(out, ai, axis);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp b/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp
index d078d06702f..78f16d4dcf0 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/convolve.hpp
@@ -13,8 +13,8 @@ namespace numpy
{
template <class A, class B, typename U>
- types::ndarray<typename A::dtype, types::pshape<long>>
- convolve(A const &inA, B const &inB, U type)
+ types::ndarray<typename A::dtype, types::pshape<long>> convolve(A const &inA, B const &inB,
+ U type)
{
auto inB_flipped = functor::flip{}(inB, 0);
auto inB_flip_conj = functor::conjugate{}(inB_flipped);
@@ -22,8 +22,7 @@ namespace numpy
}
template <class A, class B>
- types::ndarray<typename A::dtype, types::pshape<long>> convolve(A const &inA,
- B const &inB)
+ types::ndarray<typename A::dtype, types::pshape<long>> convolve(A const &inA, B const &inB)
{
auto inB_flipped = functor::flip{}(inB, 0);
auto inB_flip_conj = functor::conjugate{}(inB_flipped);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp b/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp
index 0b29116d81a..88b824af0c8 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/copy.hpp
@@ -13,10 +13,8 @@ namespace numpy
{
// list case
template <class E>
- typename std::enable_if<
- !types::is_array<E>::value && !types::is_dtype<E>::value,
- types::ndarray<typename E::dtype,
- types::array_tuple<long, E::value>>>::type
+ std::enable_if_t<!types::is_array<E>::value && !types::is_dtype<E>::value,
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>>
copy(E const &v)
{
return {v};
@@ -24,17 +22,14 @@ namespace numpy
// scalar / complex case
template <class E>
- auto copy(E const &v) ->
- typename std::enable_if<types::is_dtype<E>::value, E>::type
+ auto copy(E const &v) -> std::enable_if_t<types::is_dtype<E>::value, E>
{
return v;
}
// No copy is required for numpy_expr
template <class E>
- auto copy(E &&v) ->
- typename std::enable_if<types::is_array<E>::value,
- decltype(std::forward<E>(v))>::type
+ auto copy(E &&v) -> std::enable_if_t<types::is_array<E>::value, decltype(std::forward<E>(v))>
{
return std::forward<E>(v);
}
@@ -48,8 +43,7 @@ namespace numpy
// transposed ndarray case
template <class T, class pS>
- types::numpy_texpr<types::ndarray<T, pS>>
- copy(types::numpy_texpr<types::ndarray<T, pS>> const &a)
+ types::numpy_texpr<types::ndarray<T, pS>> copy(types::numpy_texpr<types::ndarray<T, pS>> const &a)
{
return a.arg.copy();
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp b/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp
index 26fcbe3d507..927a1ed86d1 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/copyto.hpp
@@ -20,16 +20,13 @@ namespace numpy
out_type &, decltype(aexpr), out_type::value,
(int)out_type::value - (int)utils::dim_of<E>::value,
out_type::is_vectorizable &&
- std::is_same<typename out_type::dtype,
- typename types::dtype_of<E>::type>::value &&
+ std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value &&
types::is_vectorizable<E>::value>(out, aexpr);
} else {
utils::broadcast_copy<
- out_type &, E, out_type::value,
- (int)out_type::value - (int)utils::dim_of<E>::value,
+ out_type &, E, out_type::value, (int)out_type::value - (int)utils::dim_of<E>::value,
out_type::is_vectorizable &&
- std::is_same<typename out_type::dtype,
- typename types::dtype_of<E>::type>::value &&
+ std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value &&
types::is_vectorizable<E>::value>(out, expr);
}
return {};
@@ -42,8 +39,7 @@ namespace numpy
}
template <class T, class pS, class E>
- types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out,
- E const &expr)
+ types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &out, E const &expr)
{
using out_type = types::numpy_texpr<types::ndarray<T, pS>>;
if (may_overlap(out, expr)) {
@@ -52,24 +48,20 @@ namespace numpy
out_type &, decltype(aexpr), out_type::value,
(int)out_type::value - (int)utils::dim_of<E>::value,
out_type::is_vectorizable &&
- std::is_same<typename out_type::dtype,
- typename types::dtype_of<E>::type>::value &&
+ std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value &&
types::is_vectorizable<E>::value>(out, aexpr);
} else {
utils::broadcast_copy<
- out_type &, E, out_type::value,
- (int)out_type::value - (int)utils::dim_of<E>::value,
+ out_type &, E, out_type::value, (int)out_type::value - (int)utils::dim_of<E>::value,
out_type::is_vectorizable &&
- std::is_same<typename out_type::dtype,
- typename types::dtype_of<E>::type>::value &&
+ std::is_same<typename out_type::dtype, typename types::dtype_of<E>::type>::value &&
types::is_vectorizable<E>::value>(out, expr);
}
return {};
}
template <class T, class pS, class E>
- types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out,
- E const &expr)
+ types::none_type copyto(types::numpy_texpr<types::ndarray<T, pS>> &&out, E const &expr)
{
return copyto(out, expr);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/correlate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/correlate.hpp
index f87d8bf2573..d7ed201307d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/correlate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/correlate.hpp
@@ -24,8 +24,7 @@ namespace numpy
long NA = shapeA[0];
long NB = shapeB[0];
- using out_type =
- typename __combined<typename A::dtype, typename B::dtype>::type;
+ using out_type = typename __combined<typename A::dtype, typename B::dtype>::type;
// At this point, handling views would slow things down tremendously
auto inA_ = functor::asarray{}(inA);
auto inB_ = functor::asarray{}(inB);
@@ -75,21 +74,18 @@ namespace numpy
} else {
// Incomplete overlap left
for (int i = iLeft; i < 0; i++, out_ptr += out_inc) {
- *out_ptr = wrapper::conjugate(
- numpy::dot(inA_(types::fast_contiguous_slice(0, NB + i)),
- inB_(types::fast_contiguous_slice(-i, NB))));
+ *out_ptr = wrapper::conjugate(numpy::dot(inA_(types::fast_contiguous_slice(0, NB + i)),
+ inB_(types::fast_contiguous_slice(-i, NB))));
}
// Complete overlap middle
for (int i = 0; i <= NA - NB; i++, out_ptr += out_inc) {
- *out_ptr = wrapper::conjugate(
- numpy::dot(inA_(types::fast_contiguous_slice(i, i + NB)),
- inB_(types::fast_contiguous_slice(0, NB))));
+ *out_ptr = wrapper::conjugate(numpy::dot(inA_(types::fast_contiguous_slice(i, i + NB)),
+ inB_(types::fast_contiguous_slice(0, NB))));
}
// Incomplete overlap right.
for (int i = NA - NB + 1; i < iRight; i++, out_ptr += out_inc) {
- *out_ptr = wrapper::conjugate(
- numpy::dot(inA_(types::fast_contiguous_slice(i, NA)),
- inB_(types::fast_contiguous_slice(0, NA - i))));
+ *out_ptr = wrapper::conjugate(numpy::dot(inA_(types::fast_contiguous_slice(i, NA)),
+ inB_(types::fast_contiguous_slice(0, NA - i))));
}
}
@@ -97,8 +93,8 @@ namespace numpy
}
template <class A, class B>
- types::ndarray<typename A::dtype, types::pshape<long>>
- correlate(A const &inA, B const &inB, types::str const &type)
+ types::ndarray<typename A::dtype, types::pshape<long>> correlate(A const &inA, B const &inB,
+ types::str const &type)
{
long NA = inA.template shape<0>();
long NB = inB.template shape<0>();
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp b/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp
index 0fe9e6a132f..6b3adaa6e36 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/count_nonzero.hpp
@@ -12,8 +12,8 @@ namespace numpy
{
template <class dtype, class E>
- auto _count_nonzero(E begin, E end, long &count, utils::int_<1>) ->
- typename std::enable_if<std::is_same<dtype, bool>::value>::type
+ auto _count_nonzero(E begin, E end, long &count, utils::int_<1>)
+ -> std::enable_if_t<std::is_same<dtype, bool>::value>
{
for (; begin != end; ++begin)
// Behaviour defined in the standard
@@ -21,8 +21,8 @@ namespace numpy
}
template <class dtype, class E>
- auto _count_nonzero(E begin, E end, long &count, utils::int_<1>) ->
- typename std::enable_if<!std::is_same<dtype, bool>::value>::type
+ auto _count_nonzero(E begin, E end, long &count, utils::int_<1>)
+ -> std::enable_if_t<!std::is_same<dtype, bool>::value>
{
for (; begin != end; ++begin)
if (*begin != static_cast<dtype>(0))
@@ -33,16 +33,14 @@ namespace numpy
void _count_nonzero(E begin, E end, long &count, utils::int_<N>)
{
for (; begin != end; ++begin)
- _count_nonzero<dtype>((*begin).begin(), (*begin).end(), count,
- utils::int_<N - 1>());
+ _count_nonzero<dtype>((*begin).begin(), (*begin).end(), count, utils::int_<N - 1>());
}
template <class E>
long count_nonzero(E const &array)
{
long count(0);
- _count_nonzero<typename E::dtype>(array.begin(), array.end(), count,
- utils::int_<E::value>());
+ _count_nonzero<typename E::dtype>(array.begin(), array.end(), count, utils::int_<E::value>());
return count;
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp
index bb69d50af34..f4240181a30 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/cross.hpp
@@ -16,8 +16,8 @@ namespace numpy
void operator()(Out obegin, Out oend, E ebegin, F fbegin)
{
while (obegin != oend) {
- _cross<N - 1, En, Fn>{}((*obegin).begin(), (*obegin).end(),
- (*ebegin).begin(), (*fbegin).begin());
+ _cross<N - 1, En, Fn>{}((*obegin).begin(), (*obegin).end(), (*ebegin).begin(),
+ (*fbegin).begin());
++obegin, ++ebegin, ++fbegin;
}
}
@@ -102,41 +102,38 @@ namespace numpy
};
template <class E, class F>
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, E::value>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, E::value>>
cross(E const &e, F const &f)
{
- using dtype =
- typename __combined<typename E::dtype, typename F::dtype>::type;
+ using dtype = typename __combined<typename E::dtype, typename F::dtype>::type;
types::array_tuple<long, E::value> out_shape;
- sutils::copy_shape<0, 0>(out_shape, e,
- utils::make_index_sequence<E::value - 1>());
+ sutils::copy_shape<0, 0>(out_shape, e, std::make_index_sequence<E::value - 1>());
if (e.template shape<E::value - 1>() == 2) {
if (f.template shape<F::value - 1>() == 2) {
out_shape[E::value - 1] = 1;
- types::ndarray<dtype, types::array_tuple<long, E::value>> out{
- out_shape, types::none_type{}};
+ types::ndarray<dtype, types::array_tuple<long, E::value>> out{out_shape,
+ types::none_type{}};
_cross<E::value, 2, 2>{}(out.begin(), out.end(), e.begin(), f.begin());
return out;
} else {
out_shape[E::value - 1] = 3;
- types::ndarray<dtype, types::array_tuple<long, E::value>> out{
- out_shape, types::none_type{}};
+ types::ndarray<dtype, types::array_tuple<long, E::value>> out{out_shape,
+ types::none_type{}};
_cross<E::value, 2, 3>{}(out.begin(), out.end(), e.begin(), f.begin());
return out;
}
} else {
if (f.template shape<F::value - 1>() == 2) {
out_shape[E::value - 1] = 3;
- types::ndarray<dtype, types::array_tuple<long, E::value>> out{
- out_shape, types::none_type{}};
+ types::ndarray<dtype, types::array_tuple<long, E::value>> out{out_shape,
+ types::none_type{}};
_cross<E::value, 3, 2>{}(out.begin(), out.end(), e.begin(), f.begin());
return out;
} else {
out_shape[E::value - 1] = 3;
- types::ndarray<dtype, types::array_tuple<long, E::value>> out{
- out_shape, types::none_type{}};
+ types::ndarray<dtype, types::array_tuple<long, E::value>> out{out_shape,
+ types::none_type{}};
_cross<E::value, 3, 3>{}(out.begin(), out.end(), e.begin(), f.begin());
return out;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp
index 7532bea5626..0edf0f8c84f 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ctypeslib/as_array.hpp
@@ -12,16 +12,14 @@ namespace numpy
namespace ctypeslib
{
template <class T, class pS>
- typename std::enable_if<!std::is_integral<pS>::value,
- types::ndarray<T, pS>>::type
+ std::enable_if_t<!std::is_integral<pS>::value, types::ndarray<T, pS>>
as_array(types::pointer<T> ptr, pS shape)
{
return {ptr.data, shape, types::ownership::external};
}
template <class T>
- types::ndarray<T, types::pshape<long>> as_array(types::pointer<T> ptr,
- long size)
+ types::ndarray<T, types::pshape<long>> as_array(types::pointer<T> ptr, long size)
{
return as_array(ptr, types::pshape<long>{size});
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp
index 962871b833a..f0a93164da5 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/cumprod.hpp
@@ -14,11 +14,10 @@ namespace numpy
template <class E, class... Opts>
auto cumprod(E &&e, Opts &&...opts)
- -> decltype(partial_sum<operator_::functor::imul>(
- std::forward<E>(e), std::forward<Opts>(opts)...))
+ -> decltype(partial_sum<operator_::functor::imul>(std::forward<E>(e),
+ std::forward<Opts>(opts)...))
{
- return partial_sum<operator_::functor::imul>(std::forward<E>(e),
- std::forward<Opts>(opts)...);
+ return partial_sum<operator_::functor::imul>(std::forward<E>(e), std::forward<Opts>(opts)...);
}
NUMPY_EXPR_TO_NDARRAY0_IMPL(cumprod);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp b/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp
index 2f54a703b54..7d01563c6bb 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/cumsum.hpp
@@ -14,11 +14,10 @@ namespace numpy
template <class E, class... Opts>
auto cumsum(E &&e, Opts &&...opts)
- -> decltype(partial_sum<operator_::functor::add>(
- std::forward<E>(e), std::forward<Opts>(opts)...))
+ -> decltype(partial_sum<operator_::functor::add>(std::forward<E>(e),
+ std::forward<Opts>(opts)...))
{
- return partial_sum<operator_::functor::add>(std::forward<E>(e),
- std::forward<Opts>(opts)...);
+ return partial_sum<operator_::functor::add>(std::forward<E>(e), std::forward<Opts>(opts)...);
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp
index 6520eae3884..eb132136d65 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/delete_.hpp
@@ -11,11 +11,11 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- delete_(types::ndarray<T, pS> const &a, long index, types::none_type axis)
+ types::ndarray<T, types::pshape<long>> delete_(types::ndarray<T, pS> const &a, long index,
+ types::none_type axis)
{
- types::ndarray<T, types::pshape<long>> out(
- types::pshape<long>(long(a.flat_size()) - 1), builtins::None);
+ types::ndarray<T, types::pshape<long>> out(types::pshape<long>(long(a.flat_size()) - 1),
+ builtins::None);
long n = a.flat_size();
index = std::min(n, index);
std::copy(a.buffer + index + 1, a.buffer + n,
@@ -24,14 +24,11 @@ namespace numpy
}
template <class T, class pS, class I>
- typename std::enable_if<!std::is_scalar<I>::value,
- types::ndarray<T, types::pshape<long>>>::type
- delete_(types::ndarray<T, pS> const &in, I const &indices,
- types::none_type axis)
+ std::enable_if_t<!std::is_scalar<I>::value, types::ndarray<T, types::pshape<long>>>
+ delete_(types::ndarray<T, pS> const &in, I const &indices, types::none_type axis)
{
types::ndarray<T, types::pshape<long>> out(
- types::pshape<long>(long(in.flat_size()) - indices.flat_size()),
- builtins::None);
+ types::pshape<long>(long(in.flat_size()) - indices.flat_size()), builtins::None);
auto out_iter = out.buffer;
auto in_iter = in.buffer;
for (long index : indices) {
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp b/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp
index 7f4dde7d5e5..80d5f17e741 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/diag.hpp
@@ -13,8 +13,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 2,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 2, types::ndarray<T, types::pshape<long>>>
diag(types::ndarray<T, pS> const &a, long k)
{
auto &&a_shape = a._shape;
@@ -23,26 +22,22 @@ namespace numpy
types::pshape<long> shape = 0;
auto iter = buffer->data;
if (k >= 0)
- for (int i = 0, j = k;
- i < std::get<0>(a_shape) && j < std::get<1>(a_shape);
+ for (int i = 0, j = k; i < std::get<0>(a_shape) && j < std::get<1>(a_shape);
++i, ++j, ++std::get<0>(shape))
*iter++ = a[i][j];
else
- for (int i = -k, j = 0;
- i < std::get<0>(a_shape) && j < std::get<1>(a_shape);
+ for (int i = -k, j = 0; i < std::get<0>(a_shape) && j < std::get<1>(a_shape);
++i, ++j, ++std::get<0>(shape))
*iter++ = a[i][j];
return {buffer, shape};
}
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- types::ndarray<T, types::array_tuple<long, 2>>>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 1, types::ndarray<T, types::array_tuple<long, 2>>>
diag(types::ndarray<T, pS> const &a, long k)
{
long n = a.flat_size() + std::abs(k);
- types::ndarray<T, types::array_tuple<long, 2>> out(types::make_tuple(n, n),
- 0);
+ types::ndarray<T, types::array_tuple<long, 2>> out(types::make_tuple(n, n), 0);
if (k >= 0)
for (long i = 0, j = k; i < n && j < n; ++i, ++j)
out[i][j] = a[i];
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp b/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp
index 763d1cefe5c..e9ea466160e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/diff.hpp
@@ -14,14 +14,13 @@ namespace numpy
namespace details
{
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
- diff(E const &arr, long n, long axis)
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> diff(E const &arr, long n,
+ long axis)
{
auto shape = sutils::getshape(arr);
- auto stride = (axis == E::value - 1)
- ? arr.template shape<E::value - 1>()
- : std::accumulate(shape.begin() + axis + 1, shape.end(),
- 1L, std::multiplies<long>());
+ auto stride = (axis == E::value - 1) ? arr.template shape<E::value - 1>()
+ : std::accumulate(shape.begin() + axis + 1, shape.end(),
+ 1L, std::multiplies<long>());
--shape[axis];
// this does not leak, but uses slightly too much memory
@@ -52,8 +51,8 @@ namespace numpy
}
} // namespace details
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
- diff(E const &expr, long n, long axis)
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> diff(E const &expr, long n,
+ long axis)
{
if (axis < 0)
axis += E::value;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp b/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp
index 65655aba634..0f30ff66917 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/digitize.hpp
@@ -15,21 +15,17 @@ namespace numpy
namespace
{
template <class I, class O, class B, class Op>
- void _digitize(I begin, I end, O &out, B &bins, Op const &op,
- utils::int_<1>)
+ void _digitize(I begin, I end, O &out, B &bins, Op const &op, utils::int_<1>)
{
for (; begin != end; ++begin, ++out)
- *out = std::lower_bound(bins.begin(), bins.end(), *begin, op) -
- bins.begin();
+ *out = std::lower_bound(bins.begin(), bins.end(), *begin, op) - bins.begin();
}
template <class I, class O, class B, class Op, size_t N>
- void _digitize(I begin, I end, O &out, B &bins, Op const &op,
- utils::int_<N>)
+ void _digitize(I begin, I end, O &out, B &bins, Op const &op, utils::int_<N>)
{
for (; begin != end; ++begin)
- _digitize((*begin).begin(), (*begin).end(), out, bins, op,
- utils::int_<N - 1>());
+ _digitize((*begin).begin(), (*begin).end(), out, bins, op, utils::int_<N - 1>());
}
} // namespace
@@ -37,17 +33,16 @@ namespace numpy
types::ndarray<long, types::pshape<long>> digitize(E const &expr, F const &b)
{
auto bins = asarray(b);
- bool is_increasing =
- bins.flat_size() > 1 && *bins.fbegin() < *(bins.fbegin() + 1);
- types::ndarray<long, types::pshape<long>> out(
- types::make_tuple(long(expr.flat_size())), builtins::None);
+ bool is_increasing = bins.flat_size() > 1 && *bins.fbegin() < *(bins.fbegin() + 1);
+ types::ndarray<long, types::pshape<long>> out(types::make_tuple(long(expr.flat_size())),
+ builtins::None);
auto out_iter = out.fbegin();
if (is_increasing)
- _digitize(expr.begin(), expr.end(), out_iter, bins,
- operator_::functor::lt(), utils::int_<E::value>());
+ _digitize(expr.begin(), expr.end(), out_iter, bins, operator_::functor::lt(),
+ utils::int_<E::value>());
else
- _digitize(expr.begin(), expr.end(), out_iter, bins,
- operator_::functor::gt(), utils::int_<E::value>());
+ _digitize(expr.begin(), expr.end(), out_iter, bins, operator_::functor::gt(),
+ utils::int_<E::value>());
return out;
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp b/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp
index 5beadb4489a..69ee3df259d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/dot.hpp
@@ -41,23 +41,19 @@ char *scipy_openblas_get_config64_(void);
char *scipy_openblas_get_corename64_(void);
/*Set the threading backend to a custom callback.*/
-typedef void (*scipy_openblas_dojob_callback64_)(int thread_num, void *jobdata,
- int dojob_data);
-typedef void (*scipy_openblas_threads_callback64_)(
- int sync, scipy_openblas_dojob_callback64_ dojob, int numjobs,
- size_t jobdata_elsize, void *jobdata, int dojob_data);
-void scipy_openblas_set_threads_callback_function64_(
- scipy_openblas_threads_callback64_ callback);
+typedef void (*scipy_openblas_dojob_callback64_)(int thread_num, void *jobdata, int dojob_data);
+typedef void (*scipy_openblas_threads_callback64_)(int sync, scipy_openblas_dojob_callback64_ dojob,
+ int numjobs, size_t jobdata_elsize,
+ void *jobdata, int dojob_data);
+void scipy_openblas_set_threads_callback_function64_(scipy_openblas_threads_callback64_ callback);
#ifdef OPENBLAS_OS_LINUX
/* Sets thread affinity for OpenBLAS threads. `thread_idx` is in [0,
* scipy_openblas_get_num_threads64_()-1]. */
-int scipy_openblas_setaffinity64_(int thread_idx, size_t cpusetsize,
- cpu_set_t *cpu_set);
+int scipy_openblas_setaffinity64_(int thread_idx, size_t cpusetsize, cpu_set_t *cpu_set);
/* Queries thread affinity for OpenBLAS threads. `thread_idx` is in [0,
* scipy_openblas_get_num_threads64_()-1]. */
-int scipy_openblas_getaffinity64_(int thread_idx, size_t cpusetsize,
- cpu_set_t *cpu_set);
+int scipy_openblas_getaffinity64_(int thread_idx, size_t cpusetsize, cpu_set_t *cpu_set);
#endif
/* Get the parallelization type which is used by OpenBLAS */
@@ -79,10 +75,7 @@ int scipy_openblas_get_parallel64_(void);
#define CBLAS_INDEX size_t
-typedef enum CBLAS_ORDER {
- CblasRowMajor = 101,
- CblasColMajor = 102
-} CBLAS_ORDER;
+typedef enum CBLAS_ORDER { CblasRowMajor = 101, CblasColMajor = 102 } CBLAS_ORDER;
typedef enum CBLAS_TRANSPOSE {
CblasNoTrans = 111,
CblasTrans = 112,
@@ -94,59 +87,43 @@ typedef enum CBLAS_DIAG { CblasNonUnit = 131, CblasUnit = 132 } CBLAS_DIAG;
typedef enum CBLAS_SIDE { CblasLeft = 141, CblasRight = 142 } CBLAS_SIDE;
typedef CBLAS_ORDER CBLAS_LAYOUT;
-float scipy_cblas_sdsdot64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST float *y,
- OPENBLAS_CONST blasint incy);
+float scipy_cblas_sdsdot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *x, OPENBLAS_CONST blasint incx,
+ OPENBLAS_CONST float *y, OPENBLAS_CONST blasint incy);
double scipy_cblas_dsdot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST float *y,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST float *y,
OPENBLAS_CONST blasint incy);
float scipy_cblas_sdot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
OPENBLAS_CONST blasint incx, OPENBLAS_CONST float *y,
OPENBLAS_CONST blasint incy);
double scipy_cblas_ddot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST double *y,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST double *y,
OPENBLAS_CONST blasint incy);
-openblas_complex_float scipy_cblas_cdotu64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+openblas_complex_float scipy_cblas_cdotu64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy);
-openblas_complex_float scipy_cblas_cdotc64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+openblas_complex_float scipy_cblas_cdotc64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy);
-openblas_complex_double scipy_cblas_zdotu64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+openblas_complex_double scipy_cblas_zdotu64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy);
-openblas_complex_double scipy_cblas_zdotc64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+openblas_complex_double scipy_cblas_zdotc64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy);
void scipy_cblas_cdotu_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy, void *ret);
void scipy_cblas_cdotc_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy, void *ret);
void scipy_cblas_zdotu_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy, void *ret);
void scipy_cblas_zdotc_sub64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *y,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST void *y,
OPENBLAS_CONST blasint incy, void *ret);
float scipy_cblas_sasum64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
@@ -176,30 +153,22 @@ float scipy_cblas_scnrm264_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *X,
double scipy_cblas_dznrm264_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *X,
OPENBLAS_CONST blasint incX);
-CBLAS_INDEX scipy_cblas_isamax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST float *x,
+CBLAS_INDEX scipy_cblas_isamax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_idamax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST double *x,
+CBLAS_INDEX scipy_cblas_idamax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_icamax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_icamax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_izamax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_izamax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_isamin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST float *x,
+CBLAS_INDEX scipy_cblas_isamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_idamin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST double *x,
+CBLAS_INDEX scipy_cblas_idamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_icamin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_icamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_izamin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_izamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
float scipy_cblas_samax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
@@ -220,1073 +189,854 @@ float scipy_cblas_scamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
double scipy_cblas_dzamin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_ismax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST float *x,
+CBLAS_INDEX scipy_cblas_ismax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_idmax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST double *x,
+CBLAS_INDEX scipy_cblas_idmax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_icmax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_icmax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_izmax64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_izmax64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_ismin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST float *x,
+CBLAS_INDEX scipy_cblas_ismin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_idmin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST double *x,
+CBLAS_INDEX scipy_cblas_idmin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_icmin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_icmin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
-CBLAS_INDEX scipy_cblas_izmin64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *x,
+CBLAS_INDEX scipy_cblas_izmin64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
OPENBLAS_CONST blasint incx);
void scipy_cblas_saxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *x, OPENBLAS_CONST blasint incx,
- float *y, OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST float *x, OPENBLAS_CONST blasint incx, float *y,
+ OPENBLAS_CONST blasint incy);
void scipy_cblas_daxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *x, OPENBLAS_CONST blasint incx,
- double *y, OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST double *x, OPENBLAS_CONST blasint incx, double *y,
+ OPENBLAS_CONST blasint incy);
void scipy_cblas_caxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
- void *y, OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, void *y,
+ OPENBLAS_CONST blasint incy);
void scipy_cblas_zaxpy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
- void *y, OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, void *y,
+ OPENBLAS_CONST blasint incy);
void scipy_cblas_caxpyc64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
- void *y, OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, void *y,
+ OPENBLAS_CONST blasint incy);
void scipy_cblas_zaxpyc64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
- void *y, OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx, void *y,
+ OPENBLAS_CONST blasint incy);
void scipy_cblas_scopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *x,
- OPENBLAS_CONST blasint incx, float *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST blasint incx, float *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_dcopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *x,
- OPENBLAS_CONST blasint incx, double *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST blasint incx, double *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_ccopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx, void *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST blasint incx, void *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_zcopy64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx, void *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST blasint incx, void *y, OPENBLAS_CONST blasint incy);
-void scipy_cblas_sswap64_(OPENBLAS_CONST blasint n, float *x,
- OPENBLAS_CONST blasint incx, float *y,
- OPENBLAS_CONST blasint incy);
-void scipy_cblas_dswap64_(OPENBLAS_CONST blasint n, double *x,
- OPENBLAS_CONST blasint incx, double *y,
+void scipy_cblas_sswap64_(OPENBLAS_CONST blasint n, float *x, OPENBLAS_CONST blasint incx, float *y,
OPENBLAS_CONST blasint incy);
-void scipy_cblas_cswap64_(OPENBLAS_CONST blasint n, void *x,
- OPENBLAS_CONST blasint incx, void *y,
+void scipy_cblas_dswap64_(OPENBLAS_CONST blasint n, double *x, OPENBLAS_CONST blasint incx,
+ double *y, OPENBLAS_CONST blasint incy);
+void scipy_cblas_cswap64_(OPENBLAS_CONST blasint n, void *x, OPENBLAS_CONST blasint incx, void *y,
OPENBLAS_CONST blasint incy);
-void scipy_cblas_zswap64_(OPENBLAS_CONST blasint n, void *x,
- OPENBLAS_CONST blasint incx, void *y,
+void scipy_cblas_zswap64_(OPENBLAS_CONST blasint n, void *x, OPENBLAS_CONST blasint incx, void *y,
OPENBLAS_CONST blasint incy);
-void scipy_cblas_srot64_(OPENBLAS_CONST blasint N, float *X,
- OPENBLAS_CONST blasint incX, float *Y,
+void scipy_cblas_srot64_(OPENBLAS_CONST blasint N, float *X, OPENBLAS_CONST blasint incX, float *Y,
OPENBLAS_CONST blasint incY, OPENBLAS_CONST float c,
OPENBLAS_CONST float s);
-void scipy_cblas_drot64_(OPENBLAS_CONST blasint N, double *X,
- OPENBLAS_CONST blasint incX, double *Y,
- OPENBLAS_CONST blasint incY, OPENBLAS_CONST double c,
+void scipy_cblas_drot64_(OPENBLAS_CONST blasint N, double *X, OPENBLAS_CONST blasint incX,
+ double *Y, OPENBLAS_CONST blasint incY, OPENBLAS_CONST double c,
OPENBLAS_CONST double s);
void scipy_cblas_csrot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx, void *y,
- OPENBLAS_CONST blasint incY, OPENBLAS_CONST float c,
- OPENBLAS_CONST float s);
+ OPENBLAS_CONST blasint incx, void *y, OPENBLAS_CONST blasint incY,
+ OPENBLAS_CONST float c, OPENBLAS_CONST float s);
void scipy_cblas_zdrot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx, void *y,
- OPENBLAS_CONST blasint incY, OPENBLAS_CONST double c,
- OPENBLAS_CONST double s);
+ OPENBLAS_CONST blasint incx, void *y, OPENBLAS_CONST blasint incY,
+ OPENBLAS_CONST double c, OPENBLAS_CONST double s);
void scipy_cblas_srotg64_(float *a, float *b, float *c, float *s);
void scipy_cblas_drotg64_(double *a, double *b, double *c, double *s);
void scipy_cblas_crotg64_(void *a, void *b, float *c, void *s);
void scipy_cblas_zrotg64_(void *a, void *b, double *c, void *s);
-void scipy_cblas_srotm64_(OPENBLAS_CONST blasint N, float *X,
- OPENBLAS_CONST blasint incX, float *Y,
+void scipy_cblas_srotm64_(OPENBLAS_CONST blasint N, float *X, OPENBLAS_CONST blasint incX, float *Y,
OPENBLAS_CONST blasint incY, OPENBLAS_CONST float *P);
-void scipy_cblas_drotm64_(OPENBLAS_CONST blasint N, double *X,
- OPENBLAS_CONST blasint incX, double *Y,
- OPENBLAS_CONST blasint incY,
- OPENBLAS_CONST double *P);
+void scipy_cblas_drotm64_(OPENBLAS_CONST blasint N, double *X, OPENBLAS_CONST blasint incX,
+ double *Y, OPENBLAS_CONST blasint incY, OPENBLAS_CONST double *P);
-void scipy_cblas_srotmg64_(float *d1, float *d2, float *b1,
- OPENBLAS_CONST float b2, float *P);
-void scipy_cblas_drotmg64_(double *d1, double *d2, double *b1,
- OPENBLAS_CONST double b2, double *P);
+void scipy_cblas_srotmg64_(float *d1, float *d2, float *b1, OPENBLAS_CONST float b2, float *P);
+void scipy_cblas_drotmg64_(double *d1, double *d2, double *b1, OPENBLAS_CONST double b2, double *P);
-void scipy_cblas_sscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- float *X, OPENBLAS_CONST blasint incX);
-void scipy_cblas_dscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- double *X, OPENBLAS_CONST blasint incX);
-void scipy_cblas_cscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- void *X, OPENBLAS_CONST blasint incX);
-void scipy_cblas_zscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- void *X, OPENBLAS_CONST blasint incX);
-void scipy_cblas_csscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- void *X, OPENBLAS_CONST blasint incX);
-void scipy_cblas_zdscal64_(OPENBLAS_CONST blasint N,
- OPENBLAS_CONST double alpha, void *X,
+void scipy_cblas_sscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, float *X,
+ OPENBLAS_CONST blasint incX);
+void scipy_cblas_dscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, double *X,
+ OPENBLAS_CONST blasint incX);
+void scipy_cblas_cscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, void *X,
+ OPENBLAS_CONST blasint incX);
+void scipy_cblas_zscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha, void *X,
+ OPENBLAS_CONST blasint incX);
+void scipy_cblas_csscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha, void *X,
+ OPENBLAS_CONST blasint incX);
+void scipy_cblas_zdscal64_(OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha, void *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_sgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE trans,
- OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *a,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST float beta, float *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, OPENBLAS_CONST blasint m,
+ OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *a, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST float *x, OPENBLAS_CONST blasint incx,
+ OPENBLAS_CONST float beta, float *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_dgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE trans,
- OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST double *a,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST double beta, double *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, OPENBLAS_CONST blasint m,
+ OPENBLAS_CONST blasint n, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *a, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST double *x, OPENBLAS_CONST blasint incx,
+ OPENBLAS_CONST double beta, double *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_cgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE trans,
- OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *a,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *beta, void *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, OPENBLAS_CONST blasint m,
+ OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *a, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
+ OPENBLAS_CONST void *beta, void *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_zgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE trans,
- OPENBLAS_CONST blasint m, OPENBLAS_CONST blasint n,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *a,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *beta, void *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, OPENBLAS_CONST blasint m,
+ OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *a, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
+ OPENBLAS_CONST void *beta, void *y, OPENBLAS_CONST blasint incy);
-void scipy_cblas_sger64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *X,
- OPENBLAS_CONST blasint incX, OPENBLAS_CONST float *Y,
- OPENBLAS_CONST blasint incY, float *A,
+void scipy_cblas_sger64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST float *Y, OPENBLAS_CONST blasint incY, float *A,
OPENBLAS_CONST blasint lda);
-void scipy_cblas_dger64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST double *X,
- OPENBLAS_CONST blasint incX, OPENBLAS_CONST double *Y,
- OPENBLAS_CONST blasint incY, double *A,
+void scipy_cblas_dger64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST double *Y, OPENBLAS_CONST blasint incY, double *A,
OPENBLAS_CONST blasint lda);
-void scipy_cblas_cgeru64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
- OPENBLAS_CONST blasint incY, void *A,
+void scipy_cblas_cgeru64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, void *A,
OPENBLAS_CONST blasint lda);
-void scipy_cblas_cgerc64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
- OPENBLAS_CONST blasint incY, void *A,
+void scipy_cblas_cgerc64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, void *A,
OPENBLAS_CONST blasint lda);
-void scipy_cblas_zgeru64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
- OPENBLAS_CONST blasint incY, void *A,
+void scipy_cblas_zgeru64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, void *A,
OPENBLAS_CONST blasint lda);
-void scipy_cblas_zgerc64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
- OPENBLAS_CONST blasint incY, void *A,
+void scipy_cblas_zgerc64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY, void *A,
OPENBLAS_CONST blasint lda);
void scipy_cblas_strsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, float *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, float *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_dtrsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double *A,
- OPENBLAS_CONST blasint lda, double *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, double *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_ctrsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_ztrsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_strmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, float *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, float *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_dtrmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double *A,
- OPENBLAS_CONST blasint lda, double *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, double *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_ctrmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *X,
OPENBLAS_CONST blasint incX);
void scipy_cblas_ztrmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *X,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *X,
OPENBLAS_CONST blasint incX);
-void scipy_cblas_ssyr64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+void scipy_cblas_ssyr64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
- float *A, OPENBLAS_CONST blasint lda);
-void scipy_cblas_dsyr64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX, float *A,
+ OPENBLAS_CONST blasint lda);
+void scipy_cblas_dsyr64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
- double *A, OPENBLAS_CONST blasint lda);
-void scipy_cblas_cher64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX, double *A,
+ OPENBLAS_CONST blasint lda);
+void scipy_cblas_cher64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- void *A, OPENBLAS_CONST blasint lda);
-void scipy_cblas_zher64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, void *A,
+ OPENBLAS_CONST blasint lda);
+void scipy_cblas_zher64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- void *A, OPENBLAS_CONST blasint lda);
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, void *A,
+ OPENBLAS_CONST blasint lda);
void scipy_cblas_ssyr264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST float *Y, OPENBLAS_CONST blasint incY,
- float *A, OPENBLAS_CONST blasint lda);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float alpha, OPENBLAS_CONST float *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST float *Y,
+ OPENBLAS_CONST blasint incY, float *A, OPENBLAS_CONST blasint lda);
void scipy_cblas_dsyr264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST double *Y, OPENBLAS_CONST blasint incY,
- double *A, OPENBLAS_CONST blasint lda);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double alpha, OPENBLAS_CONST double *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST double *Y,
+ OPENBLAS_CONST blasint incY, double *A, OPENBLAS_CONST blasint lda);
void scipy_cblas_cher264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY,
- void *A, OPENBLAS_CONST blasint lda);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
+ OPENBLAS_CONST blasint incY, void *A, OPENBLAS_CONST blasint lda);
void scipy_cblas_zher264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY,
- void *A, OPENBLAS_CONST blasint lda);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
+ OPENBLAS_CONST blasint incY, void *A, OPENBLAS_CONST blasint lda);
void scipy_cblas_sgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST float beta, float *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint KL,
+ OPENBLAS_CONST blasint KU, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST float beta, float *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_dgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST double beta, double *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint KL,
+ OPENBLAS_CONST blasint KU, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST double beta, double *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_cgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint KL,
+ OPENBLAS_CONST blasint KU, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *beta, void *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_zgbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint KL, OPENBLAS_CONST blasint KU,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint KL,
+ OPENBLAS_CONST blasint KU, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *beta, void *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_ssbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST float beta, float *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST float beta, float *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_dsbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST double beta, double *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST double beta, double *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_stbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
- float *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST float *A,
+ OPENBLAS_CONST blasint lda, float *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_dtbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
- double *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST double *A,
+ OPENBLAS_CONST blasint lda, double *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ctbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ztbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_stbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
- float *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST float *A,
+ OPENBLAS_CONST blasint lda, float *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_dtbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
- double *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST double *A,
+ OPENBLAS_CONST blasint lda, double *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ctbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ztbsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_stpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float *Ap,
- float *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float *Ap, float *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_dtpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double *Ap,
- double *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double *Ap, double *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ctpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *Ap, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ztpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *Ap, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_stpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float *Ap,
- float *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float *Ap, float *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_dtpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double *Ap,
- double *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double *Ap, double *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ctpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *Ap, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ztpsv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *Ap,
- void *X, OPENBLAS_CONST blasint incX);
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *Ap, void *X, OPENBLAS_CONST blasint incX);
void scipy_cblas_ssymv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST float beta, float *Y,
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST float beta, float *Y,
OPENBLAS_CONST blasint incY);
void scipy_cblas_dsymv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST double beta, double *Y,
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST double beta, double *Y,
OPENBLAS_CONST blasint incY);
void scipy_cblas_chemv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *beta, void *Y,
OPENBLAS_CONST blasint incY);
void scipy_cblas_zhemv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *beta, void *Y,
OPENBLAS_CONST blasint incY);
void scipy_cblas_sspmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *Ap, OPENBLAS_CONST float *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST float beta, float *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float alpha, OPENBLAS_CONST float *Ap,
+ OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST float beta, float *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_dspmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *Ap, OPENBLAS_CONST double *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST double beta, double *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double alpha, OPENBLAS_CONST double *Ap,
+ OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST double beta, double *Y, OPENBLAS_CONST blasint incY);
-void scipy_cblas_sspr64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+void scipy_cblas_sspr64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
- float *Ap);
-void scipy_cblas_dspr64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX, float *Ap);
+void scipy_cblas_dspr64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
- double *Ap);
+ OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX, double *Ap);
-void scipy_cblas_chpr64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+void scipy_cblas_chpr64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- void *A);
-void scipy_cblas_zhpr64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, void *A);
+void scipy_cblas_zhpr64_(OPENBLAS_CONST enum CBLAS_ORDER order, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- void *A);
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX, void *A);
void scipy_cblas_sspr264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST float *Y, OPENBLAS_CONST blasint incY,
- float *A);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST float alpha, OPENBLAS_CONST float *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST float *Y,
+ OPENBLAS_CONST blasint incY, float *A);
void scipy_cblas_dspr264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST double *Y, OPENBLAS_CONST blasint incY,
- double *A);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST double alpha, OPENBLAS_CONST double *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST double *Y,
+ OPENBLAS_CONST blasint incY, double *A);
void scipy_cblas_chpr264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY,
- void *Ap);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
+ OPENBLAS_CONST blasint incY, void *Ap);
void scipy_cblas_zhpr264_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *Y, OPENBLAS_CONST blasint incY,
- void *Ap);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *X,
+ OPENBLAS_CONST blasint incX, OPENBLAS_CONST void *Y,
+ OPENBLAS_CONST blasint incY, void *Ap);
void scipy_cblas_chbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *beta, void *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_zhbmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *beta, void *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_chpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *Ap, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *Ap,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *beta, void *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_zhpmv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *Ap, OPENBLAS_CONST void *X,
- OPENBLAS_CONST blasint incX,
- OPENBLAS_CONST void *beta, void *Y,
- OPENBLAS_CONST blasint incY);
+ OPENBLAS_CONST enum CBLAS_UPLO Uplo, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *Ap,
+ OPENBLAS_CONST void *X, OPENBLAS_CONST blasint incX,
+ OPENBLAS_CONST void *beta, void *Y, OPENBLAS_CONST blasint incY);
void scipy_cblas_sgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST float *B, OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST float beta, float *C,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
+ OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *B,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST float beta, float *C,
OPENBLAS_CONST blasint ldc);
void scipy_cblas_dgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint K, OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST double *B, OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST double beta, double *C,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
+ OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *B,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST double beta, double *C,
OPENBLAS_CONST blasint ldc);
void scipy_cblas_cgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
OPENBLAS_CONST blasint ldc);
void scipy_cblas_cgemm3m64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint K,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
OPENBLAS_CONST blasint ldc);
void scipy_cblas_zgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
- OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
+ OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
OPENBLAS_CONST blasint ldc);
void scipy_cblas_zgemm3m64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint K,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
OPENBLAS_CONST blasint ldc);
void scipy_cblas_sgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST float beta, float *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST float *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST float beta, float *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_dgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST double alpha,
OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
OPENBLAS_CONST double *B, OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST double beta, double *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST double beta, double *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_cgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST void *beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_zgemmt64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST void *beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_ssymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *B,
- OPENBLAS_CONST blasint ldb, OPENBLAS_CONST float beta,
- float *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST float beta, float *C,
+ OPENBLAS_CONST blasint ldc);
void scipy_cblas_dsymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST double *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST double beta, double *C,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST double beta, double *C,
OPENBLAS_CONST blasint ldc);
void scipy_cblas_csymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta,
- void *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST blasint ldc);
void scipy_cblas_zsymm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta,
- void *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST blasint ldc);
void scipy_cblas_ssyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST float beta,
- float *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST float beta, float *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_dsyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
- OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST double beta, double *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST double beta, double *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_csyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *beta,
- void *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_zsyrk64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *beta,
- void *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_ssyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST float *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST float beta, float *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST float *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST float beta, float *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_dsyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST double alpha,
OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda,
OPENBLAS_CONST double *B, OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST double beta, double *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST double beta, double *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_csyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST void *beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_zsyr2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST void *beta, void *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST void *beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_strmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, float *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, float *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_dtrmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
- OPENBLAS_CONST blasint lda, double *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, double *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_ctrmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_ztrmm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_strsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST float *A,
- OPENBLAS_CONST blasint lda, float *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST float *A, OPENBLAS_CONST blasint lda, float *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_dtrsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST double *A,
- OPENBLAS_CONST blasint lda, double *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *A, OPENBLAS_CONST blasint lda, double *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_ctrsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_ztrsm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_DIAG Diag,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, void *B,
+ OPENBLAS_CONST enum CBLAS_DIAG Diag, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda, void *B,
OPENBLAS_CONST blasint ldb);
void scipy_cblas_chemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta,
- void *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST blasint ldc);
void scipy_cblas_zhemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
- OPENBLAS_CONST enum CBLAS_SIDE Side,
- OPENBLAS_CONST enum CBLAS_UPLO Uplo,
+ OPENBLAS_CONST enum CBLAS_SIDE Side, OPENBLAS_CONST enum CBLAS_UPLO Uplo,
OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta,
- void *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST void *beta, void *C,
+ OPENBLAS_CONST blasint ldc);
void scipy_cblas_cherk64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST float alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST float beta,
- void *C, OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST float beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_zherk64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST double alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST double beta, void *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST double beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_cher2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST float beta, void *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST float beta, void *C, OPENBLAS_CONST blasint ldc);
void scipy_cblas_zher2k64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_UPLO Uplo,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans,
- OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
- OPENBLAS_CONST void *alpha, OPENBLAS_CONST void *A,
- OPENBLAS_CONST blasint lda, OPENBLAS_CONST void *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST double beta, void *C,
- OPENBLAS_CONST blasint ldc);
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE Trans, OPENBLAS_CONST blasint N,
+ OPENBLAS_CONST blasint K, OPENBLAS_CONST void *alpha,
+ OPENBLAS_CONST void *A, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST void *B, OPENBLAS_CONST blasint ldb,
+ OPENBLAS_CONST double beta, void *C, OPENBLAS_CONST blasint ldc);
-void scipy_cblas_xerbla64_(blasint p, OPENBLAS_CONST char *rout,
- OPENBLAS_CONST char *form, ...);
+void scipy_cblas_xerbla64_(blasint p, OPENBLAS_CONST char *rout, OPENBLAS_CONST char *form, ...);
/*** BLAS extensions ***/
void scipy_cblas_saxpby64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha,
OPENBLAS_CONST float *x, OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST float beta, float *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST float beta, float *y, OPENBLAS_CONST blasint incy);
-void scipy_cblas_daxpby64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST double alpha,
- OPENBLAS_CONST double *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST double beta, double *y,
- OPENBLAS_CONST blasint incy);
+void scipy_cblas_daxpby64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double alpha,
+ OPENBLAS_CONST double *x, OPENBLAS_CONST blasint incx,
+ OPENBLAS_CONST double beta, double *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_caxpby64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *beta, void *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST void *beta, void *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_zaxpby64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST void *alpha,
OPENBLAS_CONST void *x, OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST void *beta, void *y,
- OPENBLAS_CONST blasint incy);
+ OPENBLAS_CONST void *beta, void *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_somatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST float calpha,
- OPENBLAS_CONST float *a,
- OPENBLAS_CONST blasint clda, float *b,
- OPENBLAS_CONST blasint cldb);
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST float calpha, OPENBLAS_CONST float *a,
+ OPENBLAS_CONST blasint clda, float *b, OPENBLAS_CONST blasint cldb);
void scipy_cblas_domatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST double calpha,
- OPENBLAS_CONST double *a,
- OPENBLAS_CONST blasint clda, double *b,
- OPENBLAS_CONST blasint cldb);
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST double calpha, OPENBLAS_CONST double *a,
+ OPENBLAS_CONST blasint clda, double *b, OPENBLAS_CONST blasint cldb);
void scipy_cblas_comatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST float *calpha,
- OPENBLAS_CONST float *a,
- OPENBLAS_CONST blasint clda, float *b,
- OPENBLAS_CONST blasint cldb);
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST float *calpha, OPENBLAS_CONST float *a,
+ OPENBLAS_CONST blasint clda, float *b, OPENBLAS_CONST blasint cldb);
void scipy_cblas_zomatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST double *calpha,
- OPENBLAS_CONST double *a,
- OPENBLAS_CONST blasint clda, double *b,
- OPENBLAS_CONST blasint cldb);
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST double *calpha, OPENBLAS_CONST double *a,
+ OPENBLAS_CONST blasint clda, double *b, OPENBLAS_CONST blasint cldb);
void scipy_cblas_simatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST float calpha, float *a,
- OPENBLAS_CONST blasint clda,
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST float calpha, float *a, OPENBLAS_CONST blasint clda,
OPENBLAS_CONST blasint cldb);
void scipy_cblas_dimatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST double calpha, double *a,
- OPENBLAS_CONST blasint clda,
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST double calpha, double *a, OPENBLAS_CONST blasint clda,
OPENBLAS_CONST blasint cldb);
void scipy_cblas_cimatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST float *calpha, float *a,
- OPENBLAS_CONST blasint clda,
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST float *calpha, float *a, OPENBLAS_CONST blasint clda,
OPENBLAS_CONST blasint cldb);
void scipy_cblas_zimatcopy64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
OPENBLAS_CONST enum CBLAS_TRANSPOSE CTRANS,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST double *calpha, double *a,
- OPENBLAS_CONST blasint clda,
+ OPENBLAS_CONST blasint crows, OPENBLAS_CONST blasint ccols,
+ OPENBLAS_CONST double *calpha, double *a, OPENBLAS_CONST blasint clda,
OPENBLAS_CONST blasint cldb);
-void scipy_cblas_sgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST float calpha, float *a,
- OPENBLAS_CONST blasint clda,
- OPENBLAS_CONST float cbeta, float *c,
+void scipy_cblas_sgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, OPENBLAS_CONST blasint crows,
+ OPENBLAS_CONST blasint ccols, OPENBLAS_CONST float calpha, float *a,
+ OPENBLAS_CONST blasint clda, OPENBLAS_CONST float cbeta, float *c,
OPENBLAS_CONST blasint cldc);
-void scipy_cblas_dgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST double calpha, double *a,
- OPENBLAS_CONST blasint clda,
- OPENBLAS_CONST double cbeta, double *c,
+void scipy_cblas_dgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, OPENBLAS_CONST blasint crows,
+ OPENBLAS_CONST blasint ccols, OPENBLAS_CONST double calpha, double *a,
+ OPENBLAS_CONST blasint clda, OPENBLAS_CONST double cbeta, double *c,
OPENBLAS_CONST blasint cldc);
-void scipy_cblas_cgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST float *calpha, float *a,
- OPENBLAS_CONST blasint clda,
- OPENBLAS_CONST float *cbeta, float *c,
+void scipy_cblas_cgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, OPENBLAS_CONST blasint crows,
+ OPENBLAS_CONST blasint ccols, OPENBLAS_CONST float *calpha, float *a,
+ OPENBLAS_CONST blasint clda, OPENBLAS_CONST float *cbeta, float *c,
OPENBLAS_CONST blasint cldc);
-void scipy_cblas_zgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER,
- OPENBLAS_CONST blasint crows,
- OPENBLAS_CONST blasint ccols,
- OPENBLAS_CONST double *calpha, double *a,
- OPENBLAS_CONST blasint clda,
- OPENBLAS_CONST double *cbeta, double *c,
+void scipy_cblas_zgeadd64_(OPENBLAS_CONST enum CBLAS_ORDER CORDER, OPENBLAS_CONST blasint crows,
+ OPENBLAS_CONST blasint ccols, OPENBLAS_CONST double *calpha, double *a,
+ OPENBLAS_CONST blasint clda, OPENBLAS_CONST double *cbeta, double *c,
OPENBLAS_CONST blasint cldc);
/*** BFLOAT16 and INT8 extensions ***/
/* convert float array to BFLOAT16 array by rounding */
-void scipy_cblas_sbstobf1664_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST float *in,
+void scipy_cblas_sbstobf1664_(OPENBLAS_CONST blasint n, OPENBLAS_CONST float *in,
OPENBLAS_CONST blasint incin, bfloat16 *out,
OPENBLAS_CONST blasint incout);
/* convert double array to BFLOAT16 array by rounding */
-void scipy_cblas_sbdtobf1664_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST double *in,
+void scipy_cblas_sbdtobf1664_(OPENBLAS_CONST blasint n, OPENBLAS_CONST double *in,
OPENBLAS_CONST blasint incin, bfloat16 *out,
OPENBLAS_CONST blasint incout);
/* convert BFLOAT16 array to float array */
-void scipy_cblas_sbf16tos64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST bfloat16 *in,
+void scipy_cblas_sbf16tos64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST bfloat16 *in,
OPENBLAS_CONST blasint incin, float *out,
OPENBLAS_CONST blasint incout);
/* convert BFLOAT16 array to double array */
-void scipy_cblas_dbf16tod64_(OPENBLAS_CONST blasint n,
- OPENBLAS_CONST bfloat16 *in,
+void scipy_cblas_dbf16tod64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST bfloat16 *in,
OPENBLAS_CONST blasint incin, double *out,
OPENBLAS_CONST blasint incout);
/* dot production of BFLOAT16 input arrays, and output as float */
float scipy_cblas_sbdot64_(OPENBLAS_CONST blasint n, OPENBLAS_CONST bfloat16 *x,
- OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST bfloat16 *y,
+ OPENBLAS_CONST blasint incx, OPENBLAS_CONST bfloat16 *y,
OPENBLAS_CONST blasint incy);
-void scipy_cblas_sbgemv64_(
- OPENBLAS_CONST enum CBLAS_ORDER order,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, OPENBLAS_CONST blasint m,
- OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST bfloat16 *a, OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST bfloat16 *x, OPENBLAS_CONST blasint incx,
- OPENBLAS_CONST float beta, float *y, OPENBLAS_CONST blasint incy);
+void scipy_cblas_sbgemv64_(OPENBLAS_CONST enum CBLAS_ORDER order,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE trans, OPENBLAS_CONST blasint m,
+ OPENBLAS_CONST blasint n, OPENBLAS_CONST float alpha,
+ OPENBLAS_CONST bfloat16 *a, OPENBLAS_CONST blasint lda,
+ OPENBLAS_CONST bfloat16 *x, OPENBLAS_CONST blasint incx,
+ OPENBLAS_CONST float beta, float *y, OPENBLAS_CONST blasint incy);
void scipy_cblas_sbgemm64_(OPENBLAS_CONST enum CBLAS_ORDER Order,
OPENBLAS_CONST enum CBLAS_TRANSPOSE TransA,
- OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB,
- OPENBLAS_CONST blasint M, OPENBLAS_CONST blasint N,
- OPENBLAS_CONST blasint K, OPENBLAS_CONST float alpha,
- OPENBLAS_CONST bfloat16 *A,
- OPENBLAS_CONST blasint lda,
- OPENBLAS_CONST bfloat16 *B,
- OPENBLAS_CONST blasint ldb,
- OPENBLAS_CONST float beta, float *C,
+ OPENBLAS_CONST enum CBLAS_TRANSPOSE TransB, OPENBLAS_CONST blasint M,
+ OPENBLAS_CONST blasint N, OPENBLAS_CONST blasint K,
+ OPENBLAS_CONST float alpha, OPENBLAS_CONST bfloat16 *A,
+ OPENBLAS_CONST blasint lda, OPENBLAS_CONST bfloat16 *B,
+ OPENBLAS_CONST blasint ldb, OPENBLAS_CONST float beta, float *C,
OPENBLAS_CONST blasint ldc);
}
/* } VENDORED HEADER */
@@ -1307,9 +1057,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class F>
- typename std::enable_if<types::is_dtype<E>::value &&
- types::is_dtype<F>::value,
- decltype(std::declval<E>() * std::declval<F>())>::type
+ std::enable_if_t<types::is_dtype<E>::value && types::is_dtype<F>::value,
+ decltype(std::declval<E>() * std::declval<F>())>
dot(E const &e, F const &f)
{
return e * f;
@@ -1350,51 +1099,45 @@ namespace numpy
}
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value &&
- types::is_numexpr_arg<F>::value // Arguments are array_like
- && E::value == 1 && F::value == 1 // It is a two vectors.
- && (!is_blas_view<E>::value || !is_blas_view<F>::value ||
- !std::is_same<typename E::dtype, typename F::dtype>::value),
- typename __combined<typename E::dtype, typename F::dtype>::type>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value &&
+ types::is_numexpr_arg<F>::value // Arguments are array_like
+ && E::value == 1 && F::value == 1 // It is a two vectors.
+ && (!is_blas_view<E>::value || !is_blas_view<F>::value ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value),
+ typename __combined<typename E::dtype, typename F::dtype>::type>
dot(E const &e, F const &f)
{
return sum(functor::multiply{}(e, f));
}
template <class E, class F>
- typename std::enable_if<E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, float>::value &&
- std::is_same<typename F::dtype, float>::value &&
- is_blas_array<E>::value &&
- is_blas_array<F>::value,
- float>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, float>::value &&
+ std::is_same<typename F::dtype, float>::value && is_blas_array<E>::value &&
+ is_blas_array<F>::value,
+ float>
dot(E const &e, F const &f)
{
- return BLAS_MANGLE(cblas_sdot)(e.size(), blas_buffer(e), 1, blas_buffer(f),
- 1);
+ return BLAS_MANGLE(cblas_sdot)(e.size(), blas_buffer(e), 1, blas_buffer(f), 1);
}
template <class E, class F>
- typename std::enable_if<E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, double>::value &&
- std::is_same<typename F::dtype, double>::value &&
- is_blas_array<E>::value &&
- is_blas_array<F>::value,
- double>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, double>::value &&
+ std::is_same<typename F::dtype, double>::value && is_blas_array<E>::value &&
+ is_blas_array<F>::value,
+ double>
dot(E const &e, F const &f)
{
- return BLAS_MANGLE(cblas_ddot)(e.size(), blas_buffer(e), 1, blas_buffer(f),
- 1);
+ return BLAS_MANGLE(cblas_ddot)(e.size(), blas_buffer(e), 1, blas_buffer(f), 1);
}
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<float>>::value &&
- std::is_same<typename F::dtype, std::complex<float>>::value &&
- is_blas_array<E>::value && is_blas_array<F>::value,
- std::complex<float>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<float>>::value &&
+ std::is_same<typename F::dtype, std::complex<float>>::value &&
+ is_blas_array<E>::value && is_blas_array<F>::value,
+ std::complex<float>>
dot(E const &e, F const &f)
{
std::complex<float> out;
@@ -1404,12 +1147,11 @@ namespace numpy
}
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<double>>::value &&
- std::is_same<typename F::dtype, std::complex<double>>::value &&
- is_blas_array<E>::value && is_blas_array<F>::value,
- std::complex<double>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<double>>::value &&
+ std::is_same<typename F::dtype, std::complex<double>>::value &&
+ is_blas_array<E>::value && is_blas_array<F>::value,
+ std::complex<double>>
dot(E const &e, F const &f)
{
std::complex<double> out;
@@ -1419,58 +1161,53 @@ namespace numpy
}
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, float>::value &&
- std::is_same<typename F::dtype, float>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- float>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, float>::value &&
+ std::is_same<typename F::dtype, float>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ float>
dot(E const &e, F const &f)
{
if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) {
- return BLAS_MANGLE(cblas_sdot)(e.size(), blas_buffer(e),
- e.template strides<0>(), blas_buffer(f),
- f.template strides<0>());
+ return BLAS_MANGLE(cblas_sdot)(e.size(), blas_buffer(e), e.template strides<0>(),
+ blas_buffer(f), f.template strides<0>());
} else {
return dot(asarray(e), asarray(f));
}
}
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, double>::value &&
- std::is_same<typename F::dtype, double>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- double>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, double>::value &&
+ std::is_same<typename F::dtype, double>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ double>
dot(E const &e, F const &f)
{
if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) {
- return BLAS_MANGLE(cblas_ddot)(e.size(), blas_buffer(e),
- e.template strides<0>(), blas_buffer(f),
- f.template strides<0>());
+ return BLAS_MANGLE(cblas_ddot)(e.size(), blas_buffer(e), e.template strides<0>(),
+ blas_buffer(f), f.template strides<0>());
} else {
return dot(asarray(e), asarray(f));
}
}
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<float>>::value &&
- std::is_same<typename F::dtype, std::complex<float>>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- std::complex<float>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<float>>::value &&
+ std::is_same<typename F::dtype, std::complex<float>>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ std::complex<float>>
dot(E const &e, F const &f)
{
if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) {
std::complex<float> out;
BLAS_MANGLE(cblas_cdotu_sub)
- (e.size(), blas_buffer(e), e.template strides<0>(), blas_buffer(f),
- f.template strides<0>(), &out);
+ (e.size(), blas_buffer(e), e.template strides<0>(), blas_buffer(f), f.template strides<0>(),
+ &out);
return out;
} else {
return dot(asarray(e), asarray(f));
@@ -1478,20 +1215,19 @@ namespace numpy
}
template <class E, class F>
- typename std::enable_if<
- E::value == 1 && F::value == 1 &&
- std::is_same<typename E::dtype, std::complex<double>>::value &&
- std::is_same<typename F::dtype, std::complex<double>>::value &&
- (is_blas_view<E>::value && is_blas_view<F>::value &&
- !(is_blas_array<E>::value && is_blas_array<F>::value)),
- std::complex<double>>::type
+ std::enable_if_t<E::value == 1 && F::value == 1 &&
+ std::is_same<typename E::dtype, std::complex<double>>::value &&
+ std::is_same<typename F::dtype, std::complex<double>>::value &&
+ (is_blas_view<E>::value && is_blas_view<F>::value &&
+ !(is_blas_array<E>::value && is_blas_array<F>::value)),
+ std::complex<double>>
dot(E const &e, F const &f)
{
if (e.template strides<0>() >= 1 && f.template strides<0>() >= 1) {
std::complex<double> out;
BLAS_MANGLE(cblas_zdotu_sub)
- (e.size(), blas_buffer(e), e.template strides<0>(), blas_buffer(f),
- f.template strides<0>(), &out);
+ (e.size(), blas_buffer(e), e.template strides<0>(), blas_buffer(f), f.template strides<0>(),
+ &out);
return out;
} else {
return dot(asarray(e), asarray(f));
@@ -1500,11 +1236,11 @@ namespace numpy
/// Matrice / Vector multiplication
-#define MV_DEF(T, L) \
- inline void mv(int m, int n, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemv) \
- (CblasRowMajor, CblasNoTrans, n, m, 1, A, m, B, 1, 0, C, 1); \
+#define MV_DEF(T, L) \
+ inline void mv(int m, int n, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemv) \
+ (CblasRowMajor, CblasNoTrans, n, m, 1, A, m, B, 1, 0, C, 1); \
}
MV_DEF(double, d)
@@ -1512,11 +1248,11 @@ namespace numpy
#undef MV_DEF
-#define TV_DEF(T, L) \
- inline void tv(int m, int n, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemv) \
- (CblasRowMajor, CblasTrans, m, n, 1, A, n, B, 1, 0, C, 1); \
+#define TV_DEF(T, L) \
+ inline void tv(int m, int n, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemv) \
+ (CblasRowMajor, CblasTrans, m, n, 1, A, n, B, 1, 0, C, 1); \
}
TV_DEF(double, d)
@@ -1524,106 +1260,98 @@ namespace numpy
#undef TV_DEF
-#define MV_DEF(T, K, L) \
- inline void mv(int m, int n, T *A, T *B, T *C) \
- { \
- T alpha = 1, beta = 0; \
- BLAS_MANGLE(cblas_##L##gemv) \
- (CblasRowMajor, CblasNoTrans, n, m, (K *)&alpha, (K *)A, m, (K *)B, 1, \
- (K *)&beta, (K *)C, 1); \
+#define MV_DEF(T, K, L) \
+ inline void mv(int m, int n, T *A, T *B, T *C) \
+ { \
+ T alpha = 1, beta = 0; \
+ BLAS_MANGLE(cblas_##L##gemv) \
+ (CblasRowMajor, CblasNoTrans, n, m, (K *)&alpha, (K *)A, m, (K *)B, 1, (K *)&beta, (K *)C, 1); \
}
MV_DEF(std::complex<float>, float, c)
MV_DEF(std::complex<double>, double, z)
#undef MV_DEF
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 1,
- types::ndarray<E, types::pshape<long>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 1,
+ types::ndarray<E, types::pshape<long>>>
dot(types::ndarray<E, pS0> const &f, types::ndarray<E, pS1> const &e)
{
- types::ndarray<E, types::pshape<long>> out(
- types::pshape<long>{f.template shape<0>()}, builtins::None);
+ types::ndarray<E, types::pshape<long>> out(types::pshape<long>{f.template shape<0>()},
+ builtins::None);
const int m = f.template shape<1>(), n = f.template shape<0>();
mv(m, n, f.buffer, e.buffer, out.buffer);
return out;
}
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 1,
- types::ndarray<E, types::pshape<long>>>::type
- dot(types::numpy_texpr<types::ndarray<E, pS0>> const &f,
- types::ndarray<E, pS1> const &e)
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 1,
+ types::ndarray<E, types::pshape<long>>>
+ dot(types::numpy_texpr<types::ndarray<E, pS0>> const &f, types::ndarray<E, pS1> const &e)
{
- types::ndarray<E, types::pshape<long>> out(
- types::pshape<long>{f.template shape<0>()}, builtins::None);
+ types::ndarray<E, types::pshape<long>> out(types::pshape<long>{f.template shape<0>()},
+ builtins::None);
const int m = f.template shape<1>(), n = f.template shape<0>();
tv(m, n, f.arg.buffer, e.buffer, out.buffer);
return out;
}
// The trick is to not transpose the matrix so that MV become VM
-#define VM_DEF(T, L) \
- inline void vm(int m, int n, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemv) \
- (CblasRowMajor, CblasTrans, n, m, 1, A, m, B, 1, 0, C, 1); \
+#define VM_DEF(T, L) \
+ inline void vm(int m, int n, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemv) \
+ (CblasRowMajor, CblasTrans, n, m, 1, A, m, B, 1, 0, C, 1); \
}
VM_DEF(double, d)
VM_DEF(float, s)
#undef VM_DEF
-#define VT_DEF(T, L) \
- inline void vt(int m, int n, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemv) \
- (CblasRowMajor, CblasNoTrans, m, n, 1, A, n, B, 1, 0, C, 1); \
+#define VT_DEF(T, L) \
+ inline void vt(int m, int n, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemv) \
+ (CblasRowMajor, CblasNoTrans, m, n, 1, A, n, B, 1, 0, C, 1); \
}
VT_DEF(double, d)
VT_DEF(float, s)
#undef VM_DEF
-#define VM_DEF(T, K, L) \
- inline void vm(int m, int n, T *A, T *B, T *C) \
- { \
- T alpha = 1, beta = 0; \
- BLAS_MANGLE(cblas_##L##gemv) \
- (CblasRowMajor, CblasTrans, n, m, (K *)&alpha, (K *)A, m, (K *)B, 1, \
- (K *)&beta, (K *)C, 1); \
+#define VM_DEF(T, K, L) \
+ inline void vm(int m, int n, T *A, T *B, T *C) \
+ { \
+ T alpha = 1, beta = 0; \
+ BLAS_MANGLE(cblas_##L##gemv) \
+ (CblasRowMajor, CblasTrans, n, m, (K *)&alpha, (K *)A, m, (K *)B, 1, (K *)&beta, (K *)C, 1); \
}
VM_DEF(std::complex<float>, float, c)
VM_DEF(std::complex<double>, double, z)
#undef VM_DEF
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 1 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::pshape<long>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 1 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::pshape<long>>>
dot(types::ndarray<E, pS0> const &e, types::ndarray<E, pS1> const &f)
{
- types::ndarray<E, types::pshape<long>> out(
- types::pshape<long>{f.template shape<1>()}, builtins::None);
+ types::ndarray<E, types::pshape<long>> out(types::pshape<long>{f.template shape<1>()},
+ builtins::None);
const int m = f.template shape<1>(), n = f.template shape<0>();
vm(m, n, f.buffer, e.buffer, out.buffer);
return out;
}
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 1 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::pshape<long>>>::type
- dot(types::ndarray<E, pS0> const &e,
- types::numpy_texpr<types::ndarray<E, pS1>> const &f)
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 1 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::pshape<long>>>
+ dot(types::ndarray<E, pS0> const &e, types::numpy_texpr<types::ndarray<E, pS1>> const &f)
{
- types::ndarray<E, types::pshape<long>> out(
- types::pshape<long>{f.template shape<1>()}, builtins::None);
+ types::ndarray<E, types::pshape<long>> out(types::pshape<long>{f.template shape<1>()},
+ builtins::None);
const int m = f.template shape<1>(), n = f.template shape<0>();
vt(m, n, f.arg.buffer, e.buffer, out.buffer);
return out;
@@ -1632,27 +1360,23 @@ namespace numpy
// If arguments could be use with blas, we evaluate them as we need pointer
// on array for blas
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value &&
- types::is_numexpr_arg<F>::value // It is an array_like
- && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
- !std::is_same<typename E::dtype, typename F::dtype>::value) &&
- is_blas_type<typename E::dtype>::value &&
- is_blas_type<typename F::dtype>::value // With dtype compatible with
- // blas
- && E::value == 2 && F::value == 1, // And it is matrix / vect
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value &&
+ types::is_numexpr_arg<F>::value // It is an array_like
+ && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value) &&
+ is_blas_type<typename E::dtype>::value &&
+ is_blas_type<typename F::dtype>::value // With dtype compatible with
+ // blas
+ && E::value == 2 && F::value == 1, // And it is matrix / vect
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f)
{
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- typename E::shape_t>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ typename E::shape_t>
e_ = e;
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- typename F::shape_t>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ typename F::shape_t>
f_ = f;
return dot(e_, f_);
}
@@ -1660,27 +1384,23 @@ namespace numpy
// If arguments could be use with blas, we evaluate them as we need pointer
// on array for blas
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value &&
- types::is_numexpr_arg<F>::value // It is an array_like
- && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
- !std::is_same<typename E::dtype, typename F::dtype>::value) &&
- is_blas_type<typename E::dtype>::value &&
- is_blas_type<typename F::dtype>::value // With dtype compatible with
- // blas
- && E::value == 1 && F::value == 2, // And it is vect / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value &&
+ types::is_numexpr_arg<F>::value // It is an array_like
+ && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value) &&
+ is_blas_type<typename E::dtype>::value &&
+ is_blas_type<typename F::dtype>::value // With dtype compatible with
+ // blas
+ && E::value == 1 && F::value == 2, // And it is vect / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f)
{
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- typename E::shape_t>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ typename E::shape_t>
e_ = e;
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- typename F::shape_t>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ typename F::shape_t>
f_ = f;
return dot(e_, f_);
}
@@ -1688,18 +1408,15 @@ namespace numpy
// If one of the arg doesn't have a "blas compatible type", we use a slow
// matrix vector multiplication.
template <class E, class F>
- typename std::enable_if<
- (!is_blas_type<typename E::dtype>::value ||
- !is_blas_type<typename F::dtype>::value) &&
- E::value == 1 && F::value == 2, // And it is vect / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<(!is_blas_type<typename E::dtype>::value ||
+ !is_blas_type<typename F::dtype>::value) &&
+ E::value == 1 && F::value == 2, // And it is vect / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f)
{
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>
out(types::pshape<long>{f.template shape<1>()}, 0);
for (long i = 0; i < out.template shape<0>(); i++)
for (long j = 0; j < f.template shape<0>(); j++)
@@ -1710,18 +1427,15 @@ namespace numpy
// If one of the arg doesn't have a "blas compatible type", we use a slow
// matrix vector multiplication.
template <class E, class F>
- typename std::enable_if<
- (!is_blas_type<typename E::dtype>::value ||
- !is_blas_type<typename F::dtype>::value) &&
- E::value == 2 && F::value == 1, // And it is vect / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>>::type
+ std::enable_if_t<(!is_blas_type<typename E::dtype>::value ||
+ !is_blas_type<typename F::dtype>::value) &&
+ E::value == 2 && F::value == 1, // And it is vect / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>>
dot(E const &e, F const &f)
{
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>
out(types::pshape<long>{e.template shape<0>()}, 0);
for (long i = 0; i < out.template shape<0>(); i++)
for (long j = 0; j < f.template shape<0>(); j++)
@@ -1731,171 +1445,155 @@ namespace numpy
/// Matrix / Matrix multiplication
-#define MM_DEF(T, L) \
- inline void mm(int m, int n, int k, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, 1, A, k, B, n, 0, C, \
- n); \
+#define MM_DEF(T, L) \
+ inline void mm(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, 1, A, k, B, n, 0, C, n); \
}
MM_DEF(double, d)
MM_DEF(float, s)
#undef MM_DEF
-#define MM_DEF(T, K, L) \
- inline void mm(int m, int n, int k, T *A, T *B, T *C) \
- { \
- T alpha = 1, beta = 0; \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, (K *)&alpha, (K *)A, \
- k, (K *)B, n, (K *)&beta, (K *)C, n); \
+#define MM_DEF(T, K, L) \
+ inline void mm(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ T alpha = 1, beta = 0; \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, (K *)&alpha, (K *)A, k, (K *)B, n, \
+ (K *)&beta, (K *)C, n); \
}
MM_DEF(std::complex<float>, float, c)
MM_DEF(std::complex<double>, double, z)
#undef MM_DEF
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b)
{
- int n = b.template shape<1>(), m = a.template shape<0>(),
- k = b.template shape<0>();
+ int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>();
- types::ndarray<E, types::array_tuple<long, 2>> out(
- types::array_tuple<long, 2>{{m, n}}, builtins::None);
+ types::ndarray<E, types::array_tuple<long, 2>> out(types::array_tuple<long, 2>{{m, n}},
+ builtins::None);
mm(m, n, k, a.buffer, b.buffer, out.buffer);
return out;
}
template <class E, class pS0, class pS1, class pS2>
- typename std::enable_if<
- is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2 && std::tuple_size<pS2>::value == 2,
- types::ndarray<E, pS2>>::type &
- dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b,
- types::ndarray<E, pS2> &c)
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2 && std::tuple_size<pS2>::value == 2,
+ types::ndarray<E, pS2>> &
+ dot(types::ndarray<E, pS0> const &a, types::ndarray<E, pS1> const &b, types::ndarray<E, pS2> &c)
{
- int n = b.template shape<1>(), m = a.template shape<0>(),
- k = b.template shape<0>();
+ int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>();
mm(m, n, k, a.buffer, b.buffer, c.buffer);
return c;
}
-#define TM_DEF(T, L) \
- inline void tm(int m, int n, int k, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, 1, A, m, B, n, 0, C, \
- n); \
+#define TM_DEF(T, L) \
+ inline void tm(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, 1, A, m, B, n, 0, C, n); \
}
TM_DEF(double, d)
TM_DEF(float, s)
#undef TM_DEF
-#define TM_DEF(T, K, L) \
- inline void tm(int m, int n, int k, T *A, T *B, T *C) \
- { \
- T alpha = 1, beta = 0; \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, (K *)&alpha, (K *)A, m, \
- (K *)B, n, (K *)&beta, (K *)C, n); \
+#define TM_DEF(T, K, L) \
+ inline void tm(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ T alpha = 1, beta = 0; \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasTrans, CblasNoTrans, m, n, k, (K *)&alpha, (K *)A, m, (K *)B, n, \
+ (K *)&beta, (K *)C, n); \
}
TM_DEF(std::complex<float>, float, c)
TM_DEF(std::complex<double>, double, z)
#undef TM_DEF
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
- dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a,
- types::ndarray<E, pS1> const &b)
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
+ dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a, types::ndarray<E, pS1> const &b)
{
- int n = b.template shape<1>(), m = a.template shape<0>(),
- k = b.template shape<0>();
+ int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>();
- types::ndarray<E, types::array_tuple<long, 2>> out(
- types::array_tuple<long, 2>{{m, n}}, builtins::None);
+ types::ndarray<E, types::array_tuple<long, 2>> out(types::array_tuple<long, 2>{{m, n}},
+ builtins::None);
tm(m, n, k, a.arg.buffer, b.buffer, out.buffer);
return out;
}
-#define MT_DEF(T, L) \
- inline void mt(int m, int n, int k, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, 1, A, k, B, k, 0, C, \
- n); \
+#define MT_DEF(T, L) \
+ inline void mt(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, 1, A, k, B, k, 0, C, n); \
}
MT_DEF(double, d)
MT_DEF(float, s)
#undef MT_DEF
-#define MT_DEF(T, K, L) \
- inline void mt(int m, int n, int k, T *A, T *B, T *C) \
- { \
- T alpha = 1, beta = 0; \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, (K *)&alpha, (K *)A, k, \
- (K *)B, k, (K *)&beta, (K *)C, n); \
+#define MT_DEF(T, K, L) \
+ inline void mt(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ T alpha = 1, beta = 0; \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, (K *)&alpha, (K *)A, k, (K *)B, k, \
+ (K *)&beta, (K *)C, n); \
}
MT_DEF(std::complex<float>, float, c)
MT_DEF(std::complex<double>, double, z)
#undef MT_DEF
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
- dot(types::ndarray<E, pS0> const &a,
- types::numpy_texpr<types::ndarray<E, pS1>> const &b)
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
+ dot(types::ndarray<E, pS0> const &a, types::numpy_texpr<types::ndarray<E, pS1>> const &b)
{
- int n = b.template shape<1>(), m = a.template shape<0>(),
- k = b.template shape<0>();
+ int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>();
- types::ndarray<E, types::array_tuple<long, 2>> out(
- types::array_tuple<long, 2>{{m, n}}, builtins::None);
+ types::ndarray<E, types::array_tuple<long, 2>> out(types::array_tuple<long, 2>{{m, n}},
+ builtins::None);
mt(m, n, k, a.buffer, b.arg.buffer, out.buffer);
return out;
}
-#define TT_DEF(T, L) \
- inline void tt(int m, int n, int k, T *A, T *B, T *C) \
- { \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasTrans, CblasTrans, m, n, k, 1, A, m, B, k, 0, C, n); \
+#define TT_DEF(T, L) \
+ inline void tt(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasTrans, CblasTrans, m, n, k, 1, A, m, B, k, 0, C, n); \
}
TT_DEF(double, d)
TT_DEF(float, s)
#undef TT_DEF
-#define TT_DEF(T, K, L) \
- inline void tt(int m, int n, int k, T *A, T *B, T *C) \
- { \
- T alpha = 1, beta = 0; \
- BLAS_MANGLE(cblas_##L##gemm) \
- (CblasRowMajor, CblasTrans, CblasTrans, m, n, k, (K *)&alpha, (K *)A, m, \
- (K *)B, k, (K *)&beta, (K *)C, n); \
+#define TT_DEF(T, K, L) \
+ inline void tt(int m, int n, int k, T *A, T *B, T *C) \
+ { \
+ T alpha = 1, beta = 0; \
+ BLAS_MANGLE(cblas_##L##gemm) \
+ (CblasRowMajor, CblasTrans, CblasTrans, m, n, k, (K *)&alpha, (K *)A, m, (K *)B, k, \
+ (K *)&beta, (K *)C, n); \
}
TT_DEF(std::complex<float>, float, c)
TT_DEF(std::complex<double>, double, z)
#undef TT_DEF
template <class E, class pS0, class pS1>
- typename std::enable_if<is_blas_type<E>::value &&
- std::tuple_size<pS0>::value == 2 &&
- std::tuple_size<pS1>::value == 2,
- types::ndarray<E, types::array_tuple<long, 2>>>::type
+ std::enable_if_t<is_blas_type<E>::value && std::tuple_size<pS0>::value == 2 &&
+ std::tuple_size<pS1>::value == 2,
+ types::ndarray<E, types::array_tuple<long, 2>>>
dot(types::numpy_texpr<types::ndarray<E, pS0>> const &a,
types::numpy_texpr<types::ndarray<E, pS1>> const &b)
{
- int n = b.template shape<1>(), m = a.template shape<0>(),
- k = b.template shape<0>();
+ int n = b.template shape<1>(), m = a.template shape<0>(), k = b.template shape<0>();
- types::ndarray<E, types::array_tuple<long, 2>> out(
- types::array_tuple<long, 2>{{m, n}}, builtins::None);
+ types::ndarray<E, types::array_tuple<long, 2>> out(types::array_tuple<long, 2>{{m, n}},
+ builtins::None);
tt(m, n, k, a.arg.buffer, b.arg.buffer, out.buffer);
return out;
}
@@ -1903,27 +1601,23 @@ namespace numpy
// If arguments could be use with blas, we evaluate them as we need pointer
// on array for blas
template <class E, class F>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value &&
- types::is_numexpr_arg<F>::value // It is an array_like
- && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
- !std::is_same<typename E::dtype, typename F::dtype>::value) &&
- is_blas_type<typename E::dtype>::value &&
- is_blas_type<typename F::dtype>::value // With dtype compatible with
- // blas
- && E::value == 2 && F::value == 2, // And both are matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, 2>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value &&
+ types::is_numexpr_arg<F>::value // It is an array_like
+ && (!(types::is_ndarray<E>::value && types::is_ndarray<F>::value) ||
+ !std::is_same<typename E::dtype, typename F::dtype>::value) &&
+ is_blas_type<typename E::dtype>::value &&
+ is_blas_type<typename F::dtype>::value // With dtype compatible with
+ // blas
+ && E::value == 2 && F::value == 2, // And both are matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, 2>>>
dot(E const &e, F const &f)
{
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- typename E::shape_t>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ typename E::shape_t>
e_ = e;
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- typename F::shape_t>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ typename F::shape_t>
f_ = f;
return dot(e_, f_);
}
@@ -1931,41 +1625,31 @@ namespace numpy
// If one of the arg doesn't have a "blas compatible type", we use a slow
// matrix multiplication.
template <class E, class F>
- typename std::enable_if<
- (!is_blas_type<typename E::dtype>::value ||
- !is_blas_type<typename F::dtype>::value) &&
- E::value == 2 && F::value == 2, // And it is matrix / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, 2>>>::type
+ std::enable_if_t<(!is_blas_type<typename E::dtype>::value ||
+ !is_blas_type<typename F::dtype>::value) &&
+ E::value == 2 && F::value == 2, // And it is matrix / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, 2>>>
dot(E const &e, F const &f)
{
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, 2>>
- out(types::array_tuple<long, 2>{{e.template shape<0>(),
- f.template shape<1>()}},
- 0);
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, 2>>
+ out(types::array_tuple<long, 2>{{e.template shape<0>(), f.template shape<1>()}}, 0);
for (long i = 0; i < out.template shape<0>(); i++)
for (long j = 0; j < out.template shape<1>(); j++)
for (long k = 0; k < e.template shape<1>(); k++)
out[types::array_tuple<long, 2>{{i, j}}] +=
- e[types::array_tuple<long, 2>{{i, k}}] *
- f[types::array_tuple<long, 2>{{k, j}}];
+ e[types::array_tuple<long, 2>{{i, k}}] * f[types::array_tuple<long, 2>{{k, j}}];
return out;
}
template <class E, class F>
- typename std::enable_if<
- (E::value >= 3 && F::value == 1), // And it is matrix / matrix
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<(E::value >= 3 && F::value == 1), // And it is matrix / matrix
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, E::value - 1>>>
dot(E const &e, F const &f)
{
- auto out = dot(e.reshape(types::array_tuple<long, 2>{
- {sutils::prod_head(e), f.size()}}),
- f);
+ auto out = dot(e.reshape(types::array_tuple<long, 2>{{sutils::prod_head(e), f.size()}}), f);
types::array_tuple<long, E::value - 1> out_shape;
auto tmp = sutils::getshape(e);
std::copy(tmp.begin(), tmp.end() - 1, out_shape.begin());
@@ -1973,11 +1657,9 @@ namespace numpy
}
template <class E, class F>
- typename std::enable_if<
- (E::value >= 3 && F::value >= 2),
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::array_tuple<long, E::value - 1>>>::type
+ std::enable_if_t<(E::value >= 3 && F::value >= 2),
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::array_tuple<long, E::value - 1>>>
dot(E const &e, F const &f)
{
static_assert(E::value == 0, "not implemented yet");
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp
index d194e4cb351..82df86aff7d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ediff1d.hpp
@@ -14,8 +14,8 @@ namespace numpy
{
auto arr = asarray(expr);
long n = arr.flat_size() - 1;
- types::ndarray<typename E::dtype, types::pshape<long>> out(
- types::pshape<long>(n), builtins::None);
+ types::ndarray<typename E::dtype, types::pshape<long>> out(types::pshape<long>(n),
+ builtins::None);
// Compute adjacent difference except for the first element
std::adjacent_difference(arr.fbegin() + 1, arr.fend(), out.fbegin());
// First element can be done now
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp b/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp
index 373f5f4dad4..26763b3856b 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/empty.hpp
@@ -17,22 +17,19 @@ namespace numpy
}
template <class pS, class dtype>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- empty(pS const &shape, dtype)
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> empty(pS const &shape, dtype)
{
return {(sutils::shape_t<pS>)shape, builtins::None};
}
template <class dtype>
- types::ndarray<typename dtype::type, types::pshape<long>> empty(long size,
- dtype d)
+ types::ndarray<typename dtype::type, types::pshape<long>> empty(long size, dtype d)
{
return empty(types::pshape<long>(size), d);
}
template <long N, class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
empty(std::integral_constant<long, N>, dtype d)
{
return empty(types::pshape<std::integral_constant<long, N>>({}), d);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp
index d1776b0def9..e017774b208 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/empty_like.hpp
@@ -11,16 +11,14 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class dtype>
- auto empty_like(E const &expr,
- dtype d) -> decltype(empty(sutils::getshape(expr), d))
+ auto empty_like(E const &expr, dtype d) -> decltype(empty(sutils::getshape(expr), d))
{
return empty(sutils::getshape(expr), d);
}
template <class E>
auto empty_like(E const &expr, types::none_type)
- -> decltype(empty(sutils::getshape(expr),
- types::dtype_t<typename E::dtype>()))
+ -> decltype(empty(sutils::getshape(expr), types::dtype_t<typename E::dtype>()))
{
return empty(sutils::getshape(expr), types::dtype_t<typename E::dtype>());
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp b/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp
index 816a3351782..738f2b4d39c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/eye.hpp
@@ -12,8 +12,8 @@ namespace numpy
{
template <class dtype>
- types::ndarray<typename dtype::type, types::array_tuple<long, 2>>
- eye(long N, long M, long k, dtype d)
+ types::ndarray<typename dtype::type, types::array_tuple<long, 2>> eye(long N, long M, long k,
+ dtype d)
{
types::ndarray<typename dtype::type, types::array_tuple<long, 2>> out =
zeros(types::make_tuple(N, M), d);
@@ -27,8 +27,8 @@ namespace numpy
}
template <class dtype>
- types::ndarray<typename dtype::type, types::array_tuple<long, 2>>
- eye(long N, types::none_type M, long k, dtype d)
+ types::ndarray<typename dtype::type, types::array_tuple<long, 2>> eye(long N, types::none_type M,
+ long k, dtype d)
{
return eye(N, N, k, d);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp
index bb84da4eaa3..1f7f0e7dfa2 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/c2c.hpp
@@ -24,14 +24,11 @@ namespace numpy
{
using pocketfft::shape_t;
using pocketfft::stride_t;
- using ldbl_t =
- typename std::conditional<sizeof(long double) == sizeof(double), double,
- long double>::type;
+ using ldbl_t = std::conditional_t<sizeof(long double) == sizeof(double), double, long double>;
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<std::is_integral<T>::value, double>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, double>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
_copy_to_double(types::ndarray<T, pS> const &in_array)
{
auto out_shape = sutils::getshape(in_array);
@@ -42,29 +39,25 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
_copy_to_complex(types::ndarray<T, pS> const &in_array)
{
auto out_shape = sutils::getshape(in_array);
size_t l = in_array.flat_size();
- auto out_array =
- numpy::empty(out_shape, types::dtype_t<typename std::complex<T>>());
+ auto out_array = numpy::empty(out_shape, types::dtype_t<typename std::complex<T>>());
std::copy(in_array.buffer, in_array.buffer + l, out_array.buffer);
return out_array;
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
_copy_to_complex(types::ndarray<T, pS> const &in_array)
{
auto out_shape = sutils::getshape(in_array);
size_t l = in_array.flat_size();
- auto out_array = numpy::empty(
- out_shape, types::dtype_t<typename std::complex<double>>());
+ auto out_array = numpy::empty(out_shape, types::dtype_t<typename std::complex<double>>());
std::copy(in_array.buffer, in_array.buffer + l, out_array.buffer);
return out_array;
}
@@ -102,8 +95,8 @@ namespace numpy
}
template <typename T>
- T norm_fct(Inorm inorm, const shape_t &shape, const shape_t &axes,
- size_t fct = 1, int delta = 0)
+ T norm_fct(Inorm inorm, const shape_t &shape, const shape_t &axes, size_t fct = 1,
+ int delta = 0)
{
// Fast path
if (inorm == Inorm::forward)
@@ -122,8 +115,8 @@ namespace numpy
auto shape = sutils::getshape(in_array);
stride_t strides = stride_t(N);
strides[N - 1] = sizeof(T);
- std::transform(strides.rbegin(), strides.rend() - 1, shape.rbegin(),
- strides.rbegin() + 1, std::multiplies<long>());
+ std::transform(strides.rbegin(), strides.rend() - 1, shape.rbegin(), strides.rbegin() + 1,
+ std::multiplies<long>());
return strides;
}
@@ -131,14 +124,11 @@ namespace numpy
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
_pad_in_array(types::ndarray<T, pS> const &in_array, long axis, long n)
{
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- extended_array;
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> extended_array;
auto tmp_shape = sutils::getshape(in_array);
tmp_shape[axis] = n;
auto tmp_array = zeros(tmp_shape, types::dtype_t<T>());
- types::list<types::ndarray<
- T, types::array_tuple<long, std::tuple_size<pS>::value>>>
- bi(0);
+ types::list<types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>> bi(0);
bi.push_back(in_array);
bi.push_back(tmp_array);
extended_array = concatenate(bi, axis);
@@ -161,11 +151,10 @@ namespace numpy
auto out_shape = sutils::getshape(in_array);
out_shape[axis] = n;
// Create output array.
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- out_array(out_shape, builtins::None);
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> out_array(
+ out_shape, builtins::None);
std::complex<T> *d_in;
- types::ndarray<std::complex<T>,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::complex<T>, types::array_tuple<long, std::tuple_size<pS>::value>>
extended_array;
stride_t in_strides;
auto out_strides = create_strides(out_array);
@@ -175,8 +164,8 @@ namespace numpy
in_strides = create_strides(extended_array);
d_in = reinterpret_cast<std::complex<T> *>(extended_array.buffer);
} else {
- in_strides = create_strides(
- in_array); // for cropped arrays we need to use different strides
+ in_strides =
+ create_strides(in_array); // for cropped arrays we need to use different strides
d_in = reinterpret_cast<std::complex<T> *>(in_array.buffer);
}
auto d_out = reinterpret_cast<T *>(out_array.buffer);
@@ -186,14 +175,12 @@ namespace numpy
shape_t shapes = shape_t(size_t(N));
std::copy(out_shape.begin(), out_shape.begin() + N, shapes.begin());
auto fct = norm_fct<T>(inorm, shapes, axes);
- pocketfft::c2r(shapes, in_strides, out_strides, axes, forward, d_in,
- d_out, fct, size_t(0));
+ pocketfft::c2r(shapes, in_strides, out_strides, axes, forward, d_in, d_out, fct, size_t(0));
return out_array;
}
template <class T, class pS>
- types::ndarray<std::complex<T>,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::complex<T>, types::array_tuple<long, std::tuple_size<pS>::value>>
c2c(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis,
types::str const &norm, bool forward)
{
@@ -208,12 +195,10 @@ namespace numpy
auto out_shape = sutils::getshape(in_array);
out_shape[axis] = n;
// Create output array.
- types::ndarray<std::complex<T>,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::complex<T>, types::array_tuple<long, std::tuple_size<pS>::value>>
out_array(out_shape, builtins::None);
std::complex<T> *d_in;
- types::ndarray<std::complex<T>,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::complex<T>, types::array_tuple<long, std::tuple_size<pS>::value>>
extended_array;
stride_t in_strides;
if (n > npts) {
@@ -223,8 +208,8 @@ namespace numpy
in_strides = create_strides(extended_array); //
} else {
d_in = reinterpret_cast<std::complex<T> *>(in_array.buffer);
- in_strides = create_strides(
- in_array); // for cropped arrays we need to use different strides
+ in_strides =
+ create_strides(in_array); // for cropped arrays we need to use different strides
}
auto d_out = reinterpret_cast<std::complex<T> *>(out_array.buffer);
// axes calculation is for 1D transform
@@ -235,17 +220,15 @@ namespace numpy
for (size_t i = 0; i < N; ++i)
shapes[i] = size_t(out_shape[i]);
auto fct = norm_fct<T>(inorm, shapes, axes);
- pocketfft::c2c(shapes, in_strides, out_strides, axes, forward, d_in,
- d_out, fct, size_t(0));
+ pocketfft::c2c(shapes, in_strides, out_strides, axes, forward, d_in, d_out, fct, size_t(0));
return out_array;
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- r2c(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm, bool forward, bool extend = true)
+ r2c(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm,
+ bool forward, bool extend = true)
{
auto constexpr N = std::tuple_size<pS>::value;
Inorm inorm = _get_inorm(norm, forward);
@@ -262,12 +245,10 @@ namespace numpy
out_shape[axis] = n / 2 + 1;
}
// Create output array.
- types::ndarray<std::complex<T>,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::complex<T>, types::array_tuple<long, std::tuple_size<pS>::value>>
out_array(out_shape, builtins::None);
T *d_in;
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- extended_array;
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> extended_array;
shape_t shapes = shape_t(size_t(N));
stride_t in_strides;
if (n > npts) {
@@ -281,8 +262,8 @@ namespace numpy
d_in = reinterpret_cast<T *>(in_array.buffer);
in_shape[axis] = n;
std::copy(in_shape.begin(), in_shape.begin() + N, shapes.begin());
- in_strides = create_strides(
- in_array); // for cropped arrays we need to use different strides
+ in_strides =
+ create_strides(in_array); // for cropped arrays we need to use different strides
}
auto d_out = reinterpret_cast<std::complex<T> *>(out_array.buffer);
// axes calculation is for 1D transform
@@ -290,8 +271,7 @@ namespace numpy
axes[0] = axis;
auto out_strides = create_strides(out_array);
auto fct = norm_fct<T>(inorm, shapes, axes);
- pocketfft::r2c(shapes, in_strides, out_strides, axes, forward, d_in,
- d_out, fct, size_t(0));
+ pocketfft::r2c(shapes, in_strides, out_strides, axes, forward, d_in, d_out, fct, size_t(0));
if (extend) {
using namespace pocketfft::detail;
ndarr<std::complex<T>> ares(out_array.buffer, shapes, out_strides);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp
index 87d093367a2..e504b778004 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/fft.hpp
@@ -39,33 +39,26 @@ namespace numpy
} // namespace details
template <class T, class pS, class N, class Norm>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- fft(types::ndarray<T, pS> const &in_array, N const &n, long axis,
- Norm const &norm)
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ fft(types::ndarray<T, pS> const &in_array, N const &n, long axis, Norm const &norm)
{
- return c2c(in_array, details::normalize_n(n), axis,
- details::normalize_norm(norm), true);
+ return c2c(in_array, details::normalize_n(n), axis, details::normalize_norm(norm), true);
}
template <class T, class pS, class N, class Norm>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fft(types::ndarray<T, pS> const &in_array, N const &n, long axis,
- Norm const &norm)
+ fft(types::ndarray<T, pS> const &in_array, N const &n, long axis, Norm const &norm)
{
- return r2c(in_array, details::normalize_n(n), axis,
- details::normalize_norm(norm), true, true);
+ return r2c(in_array, details::normalize_n(n), axis, details::normalize_norm(norm), true,
+ true);
}
template <class T, class pS, class N, class Norm>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fft(types::ndarray<T, pS> const &in_array, N const &n, long axis,
- Norm const &norm)
+ fft(types::ndarray<T, pS> const &in_array, N const &n, long axis, Norm const &norm)
{
auto tmp_array = _copy_to_double(in_array);
return fft(tmp_array, n, axis, norm);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp
index 28ce369592c..8783e64b55f 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/fftn.hpp
@@ -38,8 +38,7 @@ namespace numpy
return result;
}
template <size_t K, size_t S, class T, size_t N, class V>
- types::array_base<T, N, V> const &
- normalize_axes(types::array_base<T, N, V> const &axes)
+ types::array_base<T, N, V> const &normalize_axes(types::array_base<T, N, V> const &axes)
{
return axes;
}
@@ -48,22 +47,20 @@ namespace numpy
// without shape
template <class T, class pS, class Axes, class Norm>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &in_array, types::none_type s,
- Axes const &axes, Norm const &norm)
+ fftn(types::ndarray<T, pS> const &in_array, types::none_type s, Axes const &axes,
+ Norm const &norm)
{
auto tmp_array = _copy_to_double(in_array);
return fftn(tmp_array, s, axes, norm);
}
template <class T, class pS, class Axes, class Norm>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &in_array, types::none_type s,
- Axes const &axes, Norm const &norm)
+ fftn(types::ndarray<T, pS> const &in_array, types::none_type s, Axes const &axes,
+ Norm const &norm)
{
auto naxes = details::normalize_axes<std::tuple_size<pS>::value, 1>(axes);
auto nnorm = details::normalize_norm(norm);
@@ -74,11 +71,10 @@ namespace numpy
}
template <class T, class pS, class Axes, class Norm>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &in_array, types::none_type s,
- Axes const &axes, Norm const &norm)
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ fftn(types::ndarray<T, pS> const &in_array, types::none_type s, Axes const &axes,
+ Norm const &norm)
{
auto naxes = details::normalize_axes<std::tuple_size<pS>::value, 1>(axes);
auto nnorm = details::normalize_norm(norm);
@@ -89,25 +85,21 @@ namespace numpy
}
// with shape
- template <class T, class pS, class I, size_t N, class V, class Axes,
- class Norm>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ template <class T, class pS, class I, size_t N, class V, class Axes, class Norm>
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s,
- Axes const &axes, Norm const &norm)
+ fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes,
+ Norm const &norm)
{
auto tmp_array = _copy_to_double(a);
return fftn(tmp_array, s, axes, norm);
}
- template <class T, class pS, class I, size_t N, class V, class Axes,
- class Norm>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ template <class T, class pS, class I, size_t N, class V, class Axes, class Norm>
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s,
- Axes const &axes, Norm const &norm)
+ fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes,
+ Norm const &norm)
{
auto nnorm = details::normalize_norm(norm);
auto naxes = details::normalize_axes<std::tuple_size<pS>::value, N>(axes);
@@ -119,13 +111,11 @@ namespace numpy
return out;
}
- template <class T, class pS, class I, size_t N, class V, class Axes,
- class Norm>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s,
- Axes const &axes, Norm const &norm)
+ template <class T, class pS, class I, size_t N, class V, class Axes, class Norm>
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ fftn(types::ndarray<T, pS> const &a, types::array_base<I, N, V> const &s, Axes const &axes,
+ Norm const &norm)
{
auto nnorm = details::normalize_norm(norm);
auto naxes = details::normalize_axes<std::tuple_size<pS>::value, N>(axes);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp
index bf230a19bfc..aee58bb1a84 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/hfft.hpp
@@ -17,16 +17,16 @@ namespace numpy
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<std::complex<T>, pS> const &in_array,
- types::none_type n, long axis, types::str const &norm)
+ hfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis,
+ types::str const &norm)
{
return c2r(in_array, -1, axis, norm, true);
}
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<std::complex<T>, pS> const &in_array,
- types::none_type n, long axis, types::none_type norm)
+ hfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis,
+ types::none_type norm)
{
return c2r(in_array, -1, axis, "", true);
}
@@ -48,10 +48,8 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
hfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -61,10 +59,8 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
hfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -74,26 +70,20 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ hfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
auto tmp_array = _copy_to_complex(in_array);
return c2r(tmp_array, n, axis, "", true);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- hfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ hfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
auto tmp_array = _copy_to_complex(in_array);
return c2r(tmp_array, n, axis, norm, true);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp
index 743615e9923..d724ec5786c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/ifft.hpp
@@ -16,9 +16,8 @@ namespace numpy
{
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
{
@@ -26,9 +25,8 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
{
@@ -36,28 +34,23 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
return c2c(in_array, n, axis, "", false);
}
template <class T, class pS>
- types::ndarray<
- typename std::enable_if<types::is_complex<T>::value, T>::type,
- types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ types::ndarray<std::enable_if_t<types::is_complex<T>::value, T>,
+ types::array_tuple<long, std::tuple_size<pS>::value>>
+ ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
return c2c(in_array, n, axis, norm, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -66,8 +59,7 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -76,28 +68,23 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
return r2c(in_array, n, axis, "", false, true);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
return r2c(in_array, n, axis, norm, false, true);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -107,8 +94,7 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ifft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -118,22 +104,18 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
auto tmp_array = _copy_to_double(in_array);
return r2c(tmp_array, n, axis, "", false, true);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ifft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ ifft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
auto tmp_array = _copy_to_double(in_array);
return r2c(tmp_array, n, axis, norm, false, true);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp
index e8c1fed129e..4a3801649f2 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/ihfft.hpp
@@ -15,8 +15,7 @@ namespace numpy
{
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -25,8 +24,7 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -35,28 +33,23 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
return r2c(in_array, n, axis, "", false, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
return r2c(in_array, n, axis, norm, false, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -66,8 +59,7 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
ihfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -77,22 +69,18 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
auto tmp_array = _copy_to_double(in_array);
return r2c(tmp_array, n, axis, "", false, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- ihfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ ihfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
auto tmp_array = _copy_to_double(in_array);
return r2c(tmp_array, n, axis, norm, false, false);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp
index 6d3c5a97114..6af35651581 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/irfft.hpp
@@ -17,41 +17,39 @@ namespace numpy
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &in_array,
- types::none_type n, long axis, types::str const &norm)
+ irfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis,
+ types::str const &norm)
{
return c2r(in_array, -1, axis, norm, false);
}
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &in_array,
- types::none_type n, long axis, types::none_type norm)
+ irfft(types::ndarray<std::complex<T>, pS> const &in_array, types::none_type n, long axis,
+ types::none_type norm)
{
return c2r(in_array, -1, axis, "", false);
}
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &in_array, long n,
- long axis, types::none_type norm)
+ irfft(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis,
+ types::none_type norm)
{
return c2r(in_array, n, axis, "", false);
}
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<std::complex<T>, pS> const &in_array, long n,
- long axis, types::str const &norm)
+ irfft(types::ndarray<std::complex<T>, pS> const &in_array, long n, long axis,
+ types::str const &norm)
{
return c2r(in_array, n, axis, norm, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
irfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -61,10 +59,8 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
irfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -74,26 +70,20 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ irfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
auto tmp_array = _copy_to_complex(in_array);
return c2r(tmp_array, n, axis, "", false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<
- !types::is_complex<T>::value,
- typename std::conditional<std::is_integral<T>::value,
- double, T>::type>::type,
+ types::ndarray<std::enable_if_t<!types::is_complex<T>::value,
+ std::conditional_t<std::is_integral<T>::value, double, T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- irfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ irfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
auto tmp_array = _copy_to_complex(in_array);
return c2r(tmp_array, n, axis, norm, false);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp
index 3ad32f425d0..503da758cc5 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/pocketfft.hpp
@@ -199,9 +199,8 @@ namespace pocketfft
free(ptr);
}
// C++17 in principle has "aligned_alloc", but unfortunately not everywhere ...
-#elif (__cplusplus >= 201703L) && \
- ((!defined(__MINGW32__)) || defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)) && \
- (!defined(__APPLE__))
+#elif (__cplusplus >= 201703L) && \
+ ((!defined(__MINGW32__)) || defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)) && (!defined(__APPLE__))
static T *ralloc(size_t num)
{
if (num == 0)
@@ -223,8 +222,7 @@ namespace pocketfft
void *ptr = malloc(num * sizeof(T) + 64);
if (!ptr)
throw std::bad_alloc();
- T *res = reinterpret_cast<T *>(
- (reinterpret_cast<size_t>(ptr) & ~(size_t(63))) + 64);
+ T *res = reinterpret_cast<T *>((reinterpret_cast<size_t>(ptr) & ~(size_t(63))) + 64);
(reinterpret_cast<void **>(res))[-1] = ptr;
return res;
}
@@ -345,26 +343,22 @@ namespace pocketfft
return {r * other, i * other};
}
template <typename T2>
- auto
- operator+(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
+ auto operator+(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
{
return {r + other.r, i + other.i};
}
template <typename T2>
- auto
- operator-(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
+ auto operator-(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
{
return {r - other.r, i - other.i};
}
template <typename T2>
- auto
- operator*(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
+ auto operator*(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
{
return {r * other.r - i * other.i, r * other.i + i * other.r};
}
template <bool fwd, typename T2>
- auto
- special_mul(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
+ auto special_mul(const cmplx<T2> &other) const -> cmplx<decltype(r + other.r)>
{
using Tres = cmplx<decltype(r + other.r)>;
return fwd ? Tres(r * other.r + i * other.i, i * other.r - r * other.i)
@@ -399,9 +393,8 @@ namespace pocketfft
template <bool fwd, typename T, typename T2>
void special_mul(const cmplx<T> &v1, const cmplx<T2> &v2, cmplx<T> &res)
{
- res =
- fwd ? cmplx<T>(v1.r * v2.r + v1.i * v2.i, v1.i * v2.r - v1.r * v2.i)
- : cmplx<T>(v1.r * v2.r - v1.i * v2.i, v1.r * v2.i + v1.i * v2.r);
+ res = fwd ? cmplx<T>(v1.r * v2.r + v1.i * v2.i, v1.i * v2.r - v1.r * v2.i)
+ : cmplx<T>(v1.r * v2.r - v1.i * v2.i, v1.r * v2.i + v1.i * v2.r);
}
template <typename T>
@@ -426,8 +419,7 @@ namespace pocketfft
class sincos_2pibyn
{
private:
- using Thigh = typename std::conditional<(sizeof(T) > sizeof(double)), T,
- double>::type;
+ using Thigh = std::conditional_t<(sizeof(T) > sizeof(double)), T, double>;
size_t N, mask, shift;
arr<cmplx<Thigh>> v1, v2;
@@ -439,16 +431,13 @@ namespace pocketfft
if (x < 2 * n) // first quadrant
{
if (x < n)
- return cmplx<Thigh>(std::cos(Thigh(x) * ang),
- std::sin(Thigh(x) * ang));
- return cmplx<Thigh>(std::sin(Thigh(2 * n - x) * ang),
- std::cos(Thigh(2 * n - x) * ang));
+ return cmplx<Thigh>(std::cos(Thigh(x) * ang), std::sin(Thigh(x) * ang));
+ return cmplx<Thigh>(std::sin(Thigh(2 * n - x) * ang), std::cos(Thigh(2 * n - x) * ang));
} else // second quadrant
{
x -= 2 * n;
if (x < n)
- return cmplx<Thigh>(-std::sin(Thigh(x) * ang),
- std::cos(Thigh(x) * ang));
+ return cmplx<Thigh>(-std::sin(Thigh(x) * ang), std::cos(Thigh(x) * ang));
return cmplx<Thigh>(-std::cos(Thigh(2 * n - x) * ang),
std::sin(Thigh(2 * n - x) * ang));
}
@@ -457,16 +446,14 @@ namespace pocketfft
if (x < 2 * n) // third quadrant
{
if (x < n)
- return cmplx<Thigh>(std::cos(Thigh(x) * ang),
- -std::sin(Thigh(x) * ang));
+ return cmplx<Thigh>(std::cos(Thigh(x) * ang), -std::sin(Thigh(x) * ang));
return cmplx<Thigh>(std::sin(Thigh(2 * n - x) * ang),
-std::cos(Thigh(2 * n - x) * ang));
} else // fourth quadrant
{
x -= 2 * n;
if (x < n)
- return cmplx<Thigh>(-std::sin(Thigh(x) * ang),
- -std::cos(Thigh(x) * ang));
+ return cmplx<Thigh>(-std::sin(Thigh(x) * ang), -std::cos(Thigh(x) * ang));
return cmplx<Thigh>(-std::cos(Thigh(2 * n - x) * ang),
-std::sin(Thigh(2 * n - x) * ang));
}
@@ -497,13 +484,11 @@ namespace pocketfft
{
if (2 * idx <= N) {
auto x1 = v1[idx & mask], x2 = v2[idx >> shift];
- return cmplx<T>(T(x1.r * x2.r - x1.i * x2.i),
- T(x1.r * x2.i + x1.i * x2.r));
+ return cmplx<T>(T(x1.r * x2.r - x1.i * x2.i), T(x1.r * x2.i + x1.i * x2.r));
}
idx = N - idx;
auto x1 = v1[idx & mask], x2 = v2[idx >> shift];
- return cmplx<T>(T(x1.r * x2.r - x1.i * x2.i),
- -T(x1.r * x2.i + x1.i * x2.r));
+ return cmplx<T>(T(x1.r * x2.r - x1.i * x2.i), -T(x1.r * x2.i + x1.i * x2.r));
}
};
@@ -537,9 +522,7 @@ namespace pocketfft
}
for (size_t x = 3; x * x <= n; x += 2)
while ((n % x) == 0) {
- result += (x <= 5)
- ? double(x)
- : lfp * double(x); // penalize larger prime factors
+ result += (x <= 5) ? double(x) : lfp * double(x); // penalize larger prime factors
n /= x;
}
if (n > 1)
@@ -611,10 +594,8 @@ namespace pocketfft
return res;
}
- static POCKETFFT_NOINLINE void sanity_check(const shape_t &shape,
- const stride_t &stride_in,
- const stride_t &stride_out,
- bool inplace)
+ static POCKETFFT_NOINLINE void sanity_check(const shape_t &shape, const stride_t &stride_in,
+ const stride_t &stride_out, bool inplace)
{
auto ndim = shape.size();
if (ndim < 1)
@@ -625,10 +606,8 @@ namespace pocketfft
throw std::runtime_error("stride mismatch");
}
- static POCKETFFT_NOINLINE void sanity_check(const shape_t &shape,
- const stride_t &stride_in,
- const stride_t &stride_out,
- bool inplace,
+ static POCKETFFT_NOINLINE void sanity_check(const shape_t &shape, const stride_t &stride_in,
+ const stride_t &stride_out, bool inplace,
const shape_t &axes)
{
sanity_check(shape, stride_in, stride_out, inplace);
@@ -642,10 +621,9 @@ namespace pocketfft
}
}
- static POCKETFFT_NOINLINE void sanity_check(const shape_t &shape,
- const stride_t &stride_in,
- const stride_t &stride_out,
- bool inplace, size_t axis)
+ static POCKETFFT_NOINLINE void sanity_check(const shape_t &shape, const stride_t &stride_in,
+ const stride_t &stride_out, bool inplace,
+ size_t axis)
{
sanity_check(shape, stride_in, stride_out, inplace);
if (axis >= shape.size())
@@ -653,14 +631,13 @@ namespace pocketfft
}
#ifdef POCKETFFT_NO_MULTITHREADING
- static size_t thread_count(size_t /*nthreads*/, const shape_t & /*shape*/,
- size_t /*axis*/, size_t /*vlen*/)
+ static size_t thread_count(size_t /*nthreads*/, const shape_t & /*shape*/, size_t /*axis*/,
+ size_t /*vlen*/)
{
return 1;
}
#else
- static size_t thread_count(size_t nthreads, const shape_t &shape,
- size_t axis, size_t vlen)
+ static size_t thread_count(size_t nthreads, const shape_t &shape, size_t axis, size_t vlen)
{
if (nthreads == 1)
return 1;
@@ -668,8 +645,7 @@ namespace pocketfft
size_t parallel = size / (shape[axis] * vlen);
if (shape[axis] < 1000)
parallel /= 4;
- size_t max_threads =
- nthreads == 0 ? std::thread::hardware_concurrency() : nthreads;
+ size_t max_threads = nthreads == 0 ? std::thread::hardware_concurrency() : nthreads;
return std::max(size_t(1), std::min(parallel, max_threads));
}
#endif
@@ -707,8 +683,7 @@ namespace pocketfft
static thread_local size_t num_threads_ = 1;
return num_threads_;
}
- static const size_t max_threads =
- std::max(1u, std::thread::hardware_concurrency());
+ static const size_t max_threads = std::max(1u, std::thread::hardware_concurrency());
class latch
{
@@ -930,8 +905,7 @@ namespace pocketfft
}
template <bool fwd, typename T>
- void pass2(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void pass2(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const cmplx<T0> *POCKETFFT_RESTRICT wa) const
{
auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & {
@@ -940,9 +914,7 @@ namespace pocketfft
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 2 * c)];
};
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i - 1 + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; };
if (ido == 1)
for (size_t k = 0; k < l1; ++k) {
@@ -955,37 +927,33 @@ namespace pocketfft
CH(0, k, 1) = CC(0, 0, k) - CC(0, 1, k);
for (size_t i = 1; i < ido; ++i) {
CH(i, k, 0) = CC(i, 0, k) + CC(i, 1, k);
- special_mul<fwd>(CC(i, 0, k) - CC(i, 1, k), WA(0, i),
- CH(i, k, 1));
+ special_mul<fwd>(CC(i, 0, k) - CC(i, 1, k), WA(0, i), CH(i, k, 1));
}
}
}
-#define POCKETFFT_PREP3(idx) \
- T t0 = CC(idx, 0, k), t1, t2; \
- PM(t1, t2, CC(idx, 1, k), CC(idx, 2, k)); \
+#define POCKETFFT_PREP3(idx) \
+ T t0 = CC(idx, 0, k), t1, t2; \
+ PM(t1, t2, CC(idx, 1, k), CC(idx, 2, k)); \
CH(idx, k, 0) = t0 + t1;
-#define POCKETFFT_PARTSTEP3a(u1, u2, twr, twi) \
- { \
- T ca = t0 + t1 * twr; \
- T cb{-t2.i * twi, t2.r * twi}; \
- PM(CH(0, k, u1), CH(0, k, u2), ca, cb); \
+#define POCKETFFT_PARTSTEP3a(u1, u2, twr, twi) \
+ { \
+ T ca = t0 + t1 * twr; \
+ T cb{-t2.i * twi, t2.r * twi}; \
+ PM(CH(0, k, u1), CH(0, k, u2), ca, cb); \
}
-#define POCKETFFT_PARTSTEP3b(u1, u2, twr, twi) \
- { \
- T ca = t0 + t1 * twr; \
- T cb{-t2.i * twi, t2.r * twi}; \
- special_mul<fwd>(ca + cb, WA(u1 - 1, i), CH(i, k, u1)); \
- special_mul<fwd>(ca - cb, WA(u2 - 1, i), CH(i, k, u2)); \
+#define POCKETFFT_PARTSTEP3b(u1, u2, twr, twi) \
+ { \
+ T ca = t0 + t1 * twr; \
+ T cb{-t2.i * twi, t2.r * twi}; \
+ special_mul<fwd>(ca + cb, WA(u1 - 1, i), CH(i, k, u1)); \
+ special_mul<fwd>(ca - cb, WA(u2 - 1, i), CH(i, k, u2)); \
}
template <bool fwd, typename T>
- void pass3(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void pass3(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const cmplx<T0> *POCKETFFT_RESTRICT wa) const
{
- constexpr T0 tw1r = -0.5,
- tw1i = (fwd ? -1 : 1) *
- T0(0.8660254037844386467637231707529362L);
+ constexpr T0 tw1r = -0.5, tw1i = (fwd ? -1 : 1) * T0(0.8660254037844386467637231707529362L);
auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & {
return ch[a + ido * (b + l1 * c)];
@@ -993,9 +961,7 @@ namespace pocketfft
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 3 * c)];
};
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i - 1 + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; };
if (ido == 1)
for (size_t k = 0; k < l1; ++k) {
@@ -1020,8 +986,7 @@ namespace pocketfft
#undef POCKETFFT_PREP3
template <bool fwd, typename T>
- void pass4(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void pass4(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const cmplx<T0> *POCKETFFT_RESTRICT wa) const
{
auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & {
@@ -1030,9 +995,7 @@ namespace pocketfft
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 4 * c)];
};
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i - 1 + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; };
if (ido == 1)
for (size_t k = 0; k < l1; ++k) {
@@ -1055,8 +1018,7 @@ namespace pocketfft
}
for (size_t i = 1; i < ido; ++i) {
T t1, t2, t3, t4;
- T cc0 = CC(i, 0, k), cc1 = CC(i, 1, k), cc2 = CC(i, 2, k),
- cc3 = CC(i, 3, k);
+ T cc0 = CC(i, 0, k), cc1 = CC(i, 1, k), cc2 = CC(i, 2, k), cc3 = CC(i, 3, k);
PM(t2, t1, cc0, cc2);
PM(t3, t4, cc1, cc3);
ROTX90<fwd>(t4);
@@ -1068,44 +1030,41 @@ namespace pocketfft
}
}
-#define POCKETFFT_PREP5(idx) \
- T t0 = CC(idx, 0, k), t1, t2, t3, t4; \
- PM(t1, t4, CC(idx, 1, k), CC(idx, 4, k)); \
- PM(t2, t3, CC(idx, 2, k), CC(idx, 3, k)); \
- CH(idx, k, 0).r = t0.r + t1.r + t2.r; \
+#define POCKETFFT_PREP5(idx) \
+ T t0 = CC(idx, 0, k), t1, t2, t3, t4; \
+ PM(t1, t4, CC(idx, 1, k), CC(idx, 4, k)); \
+ PM(t2, t3, CC(idx, 2, k), CC(idx, 3, k)); \
+ CH(idx, k, 0).r = t0.r + t1.r + t2.r; \
CH(idx, k, 0).i = t0.i + t1.i + t2.i;
-#define POCKETFFT_PARTSTEP5a(u1, u2, twar, twbr, twai, twbi) \
- { \
- T ca, cb; \
- ca.r = t0.r + twar * t1.r + twbr * t2.r; \
- ca.i = t0.i + twar * t1.i + twbr * t2.i; \
- cb.i = twai * t4.r twbi * t3.r; \
- cb.r = -(twai * t4.i twbi * t3.i); \
- PM(CH(0, k, u1), CH(0, k, u2), ca, cb); \
+#define POCKETFFT_PARTSTEP5a(u1, u2, twar, twbr, twai, twbi) \
+ { \
+ T ca, cb; \
+ ca.r = t0.r + twar * t1.r + twbr * t2.r; \
+ ca.i = t0.i + twar * t1.i + twbr * t2.i; \
+ cb.i = twai * t4.r twbi * t3.r; \
+ cb.r = -(twai * t4.i twbi * t3.i); \
+ PM(CH(0, k, u1), CH(0, k, u2), ca, cb); \
}
-#define POCKETFFT_PARTSTEP5b(u1, u2, twar, twbr, twai, twbi) \
- { \
- T ca, cb, da, db; \
- ca.r = t0.r + twar * t1.r + twbr * t2.r; \
- ca.i = t0.i + twar * t1.i + twbr * t2.i; \
- cb.i = twai * t4.r twbi * t3.r; \
- cb.r = -(twai * t4.i twbi * t3.i); \
- special_mul<fwd>(ca + cb, WA(u1 - 1, i), CH(i, k, u1)); \
- special_mul<fwd>(ca - cb, WA(u2 - 1, i), CH(i, k, u2)); \
+#define POCKETFFT_PARTSTEP5b(u1, u2, twar, twbr, twai, twbi) \
+ { \
+ T ca, cb, da, db; \
+ ca.r = t0.r + twar * t1.r + twbr * t2.r; \
+ ca.i = t0.i + twar * t1.i + twbr * t2.i; \
+ cb.i = twai * t4.r twbi * t3.r; \
+ cb.r = -(twai * t4.i twbi * t3.i); \
+ special_mul<fwd>(ca + cb, WA(u1 - 1, i), CH(i, k, u1)); \
+ special_mul<fwd>(ca - cb, WA(u2 - 1, i), CH(i, k, u2)); \
}
template <bool fwd, typename T>
- void pass5(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void pass5(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const cmplx<T0> *POCKETFFT_RESTRICT wa) const
{
constexpr T0 tw1r = T0(0.3090169943749474241022934171828191L),
- tw1i = (fwd ? -1 : 1) *
- T0(0.9510565162951535721164393333793821L),
+ tw1i = (fwd ? -1 : 1) * T0(0.9510565162951535721164393333793821L),
tw2r = T0(-0.8090169943749474241022934171828191L),
- tw2i = (fwd ? -1 : 1) *
- T0(0.5877852522924731291687059546390728L);
+ tw2i = (fwd ? -1 : 1) * T0(0.5877852522924731291687059546390728L);
auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & {
return ch[a + ido * (b + l1 * c)];
@@ -1113,9 +1072,7 @@ namespace pocketfft
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 5 * c)];
};
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i - 1 + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; };
if (ido == 1)
for (size_t k = 0; k < l1; ++k) {
@@ -1142,48 +1099,43 @@ namespace pocketfft
#undef POCKETFFT_PARTSTEP5a
#undef POCKETFFT_PREP5
-#define POCKETFFT_PREP7(idx) \
- T t1 = CC(idx, 0, k), t2, t3, t4, t5, t6, t7; \
- PM(t2, t7, CC(idx, 1, k), CC(idx, 6, k)); \
- PM(t3, t6, CC(idx, 2, k), CC(idx, 5, k)); \
- PM(t4, t5, CC(idx, 3, k), CC(idx, 4, k)); \
- CH(idx, k, 0).r = t1.r + t2.r + t3.r + t4.r; \
+#define POCKETFFT_PREP7(idx) \
+ T t1 = CC(idx, 0, k), t2, t3, t4, t5, t6, t7; \
+ PM(t2, t7, CC(idx, 1, k), CC(idx, 6, k)); \
+ PM(t3, t6, CC(idx, 2, k), CC(idx, 5, k)); \
+ PM(t4, t5, CC(idx, 3, k), CC(idx, 4, k)); \
+ CH(idx, k, 0).r = t1.r + t2.r + t3.r + t4.r; \
CH(idx, k, 0).i = t1.i + t2.i + t3.i + t4.i;
-#define POCKETFFT_PARTSTEP7a0(u1, u2, x1, x2, x3, y1, y2, y3, out1, out2) \
- { \
- T ca, cb; \
- ca.r = t1.r + x1 * t2.r + x2 * t3.r + x3 * t4.r; \
- ca.i = t1.i + x1 * t2.i + x2 * t3.i + x3 * t4.i; \
- cb.i = y1 * t7.r y2 * t6.r y3 * t5.r; \
- cb.r = -(y1 * t7.i y2 * t6.i y3 * t5.i); \
- PM(out1, out2, ca, cb); \
+#define POCKETFFT_PARTSTEP7a0(u1, u2, x1, x2, x3, y1, y2, y3, out1, out2) \
+ { \
+ T ca, cb; \
+ ca.r = t1.r + x1 * t2.r + x2 * t3.r + x3 * t4.r; \
+ ca.i = t1.i + x1 * t2.i + x2 * t3.i + x3 * t4.i; \
+ cb.i = y1 * t7.r y2 * t6.r y3 * t5.r; \
+ cb.r = -(y1 * t7.i y2 * t6.i y3 * t5.i); \
+ PM(out1, out2, ca, cb); \
}
-#define POCKETFFT_PARTSTEP7a(u1, u2, x1, x2, x3, y1, y2, y3) \
- POCKETFFT_PARTSTEP7a0(u1, u2, x1, x2, x3, y1, y2, y3, CH(0, k, u1), \
- CH(0, k, u2))
-#define POCKETFFT_PARTSTEP7(u1, u2, x1, x2, x3, y1, y2, y3) \
- { \
- T da, db; \
- POCKETFFT_PARTSTEP7a0(u1, u2, x1, x2, x3, y1, y2, y3, da, db) \
- special_mul<fwd>(da, WA(u1 - 1, i), CH(i, k, u1)); \
- special_mul<fwd>(db, WA(u2 - 1, i), CH(i, k, u2)); \
+#define POCKETFFT_PARTSTEP7a(u1, u2, x1, x2, x3, y1, y2, y3) \
+ POCKETFFT_PARTSTEP7a0(u1, u2, x1, x2, x3, y1, y2, y3, CH(0, k, u1), CH(0, k, u2))
+#define POCKETFFT_PARTSTEP7(u1, u2, x1, x2, x3, y1, y2, y3) \
+ { \
+ T da, db; \
+ POCKETFFT_PARTSTEP7a0(u1, u2, x1, x2, x3, y1, y2, y3, da, db) \
+ special_mul<fwd>(da, WA(u1 - 1, i), CH(i, k, u1)); \
+ special_mul<fwd>(db, WA(u2 - 1, i), CH(i, k, u2)); \
}
template <bool fwd, typename T>
- void pass7(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void pass7(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const cmplx<T0> *POCKETFFT_RESTRICT wa) const
{
constexpr T0 tw1r = T0(0.6234898018587335305250048840042398L),
- tw1i = (fwd ? -1 : 1) *
- T0(0.7818314824680298087084445266740578L),
+ tw1i = (fwd ? -1 : 1) * T0(0.7818314824680298087084445266740578L),
tw2r = T0(-0.2225209339563144042889025644967948L),
- tw2i = (fwd ? -1 : 1) *
- T0(0.9749279121818236070181316829939312L),
+ tw2i = (fwd ? -1 : 1) * T0(0.9749279121818236070181316829939312L),
tw3r = T0(-0.9009688679024191262361023195074451L),
- tw3i = (fwd ? -1 : 1) *
- T0(0.433883739117558120475768332848359L);
+ tw3i = (fwd ? -1 : 1) * T0(0.433883739117558120475768332848359L);
auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & {
return ch[a + ido * (b + l1 * c)];
@@ -1191,28 +1143,22 @@ namespace pocketfft
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 7 * c)];
};
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i - 1 + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; };
if (ido == 1)
for (size_t k = 0; k < l1; ++k) {
POCKETFFT_PREP7(0)
POCKETFFT_PARTSTEP7a(1, 6, tw1r, tw2r, tw3r, +tw1i, +tw2i, +tw3i)
- POCKETFFT_PARTSTEP7a(2, 5, tw2r, tw3r, tw1r, +tw2i, -tw3i,
- -tw1i)
- POCKETFFT_PARTSTEP7a(3, 4, tw3r, tw1r, tw2r, +tw3i, -tw1i,
- +tw2i)
+ POCKETFFT_PARTSTEP7a(2, 5, tw2r, tw3r, tw1r, +tw2i, -tw3i, -tw1i)
+ POCKETFFT_PARTSTEP7a(3, 4, tw3r, tw1r, tw2r, +tw3i, -tw1i, +tw2i)
}
else
for (size_t k = 0; k < l1; ++k) {
{
POCKETFFT_PREP7(0)
POCKETFFT_PARTSTEP7a(1, 6, tw1r, tw2r, tw3r, +tw1i, +tw2i, +tw3i)
- POCKETFFT_PARTSTEP7a(2, 5, tw2r, tw3r, tw1r, +tw2i, -tw3i,
- -tw1i)
- POCKETFFT_PARTSTEP7a(3, 4, tw3r, tw1r, tw2r, +tw3i, -tw1i,
- +tw2i)
+ POCKETFFT_PARTSTEP7a(2, 5, tw2r, tw3r, tw1r, +tw2i, -tw3i, -tw1i)
+ POCKETFFT_PARTSTEP7a(3, 4, tw3r, tw1r, tw2r, +tw3i, -tw1i, +tw2i)
}
for (size_t i = 1; i < ido; ++i) {
POCKETFFT_PREP7(i)
@@ -1258,8 +1204,7 @@ namespace pocketfft
}
template <bool fwd, typename T>
- void pass8(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void pass8(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const cmplx<T0> *POCKETFFT_RESTRICT wa) const
{
auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & {
@@ -1268,9 +1213,7 @@ namespace pocketfft
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 8 * c)];
};
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i - 1 + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; };
if (ido == 1)
for (size_t k = 0; k < l1; ++k) {
@@ -1342,52 +1285,47 @@ namespace pocketfft
}
}
-#define POCKETFFT_PREP11(idx) \
- T t1 = CC(idx, 0, k), t2, t3, t4, t5, t6, t7, t8, t9, t10, t11; \
- PM(t2, t11, CC(idx, 1, k), CC(idx, 10, k)); \
- PM(t3, t10, CC(idx, 2, k), CC(idx, 9, k)); \
- PM(t4, t9, CC(idx, 3, k), CC(idx, 8, k)); \
- PM(t5, t8, CC(idx, 4, k), CC(idx, 7, k)); \
- PM(t6, t7, CC(idx, 5, k), CC(idx, 6, k)); \
- CH(idx, k, 0).r = t1.r + t2.r + t3.r + t4.r + t5.r + t6.r; \
+#define POCKETFFT_PREP11(idx) \
+ T t1 = CC(idx, 0, k), t2, t3, t4, t5, t6, t7, t8, t9, t10, t11; \
+ PM(t2, t11, CC(idx, 1, k), CC(idx, 10, k)); \
+ PM(t3, t10, CC(idx, 2, k), CC(idx, 9, k)); \
+ PM(t4, t9, CC(idx, 3, k), CC(idx, 8, k)); \
+ PM(t5, t8, CC(idx, 4, k), CC(idx, 7, k)); \
+ PM(t6, t7, CC(idx, 5, k), CC(idx, 6, k)); \
+ CH(idx, k, 0).r = t1.r + t2.r + t3.r + t4.r + t5.r + t6.r; \
CH(idx, k, 0).i = t1.i + t2.i + t3.i + t4.i + t5.i + t6.i;
-#define POCKETFFT_PARTSTEP11a0(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, \
- out1, out2) \
- { \
- T ca = t1 + t2 * x1 + t3 * x2 + t4 * x3 + t5 * x4 + t6 * x5, cb; \
- cb.i = y1 * t11.r y2 * t10.r y3 * t9.r y4 * t8.r y5 * t7.r; \
- cb.r = -(y1 * t11.i y2 * t10.i y3 * t9.i y4 * t8.i y5 * t7.i); \
- PM(out1, out2, ca, cb); \
+#define POCKETFFT_PARTSTEP11a0(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, out1, out2) \
+ { \
+ T ca = t1 + t2 * x1 + t3 * x2 + t4 * x3 + t5 * x4 + t6 * x5, cb; \
+ cb.i = y1 * t11.r y2 * t10.r y3 * t9.r y4 * t8.r y5 * t7.r; \
+ cb.r = -(y1 * t11.i y2 * t10.i y3 * t9.i y4 * t8.i y5 * t7.i); \
+ PM(out1, out2, ca, cb); \
}
-#define POCKETFFT_PARTSTEP11a(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) \
- POCKETFFT_PARTSTEP11a0(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, \
- CH(0, k, u1), CH(0, k, u2))
-#define POCKETFFT_PARTSTEP11(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) \
- { \
- T da, db; \
- POCKETFFT_PARTSTEP11a0(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, da, \
- db) \
- special_mul<fwd>(da, WA(u1 - 1, i), CH(i, k, u1)); \
- special_mul<fwd>(db, WA(u2 - 1, i), CH(i, k, u2)); \
+#define POCKETFFT_PARTSTEP11a(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) \
+ POCKETFFT_PARTSTEP11a0(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, CH(0, k, u1), CH(0, k, u2))
+#define POCKETFFT_PARTSTEP11(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) \
+ { \
+ T da, db; \
+ POCKETFFT_PARTSTEP11a0(u1, u2, x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, da, db) \
+ special_mul<fwd>(da, WA(u1 - 1, i), CH(i, k, u1)); \
+ special_mul<fwd>(db, WA(u2 - 1, i), CH(i, k, u2)); \
}
template <bool fwd, typename T>
- void pass11(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void pass11(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const cmplx<T0> *POCKETFFT_RESTRICT wa) const
{
- constexpr T0
- tw1r = T0(0.8412535328311811688618116489193677L),
- tw1i = (fwd ? -1 : 1) * T0(0.5406408174555975821076359543186917L),
- tw2r = T0(0.4154150130018864255292741492296232L),
- tw2i = (fwd ? -1 : 1) * T0(0.9096319953545183714117153830790285L),
- tw3r = T0(-0.1423148382732851404437926686163697L),
- tw3i = (fwd ? -1 : 1) * T0(0.9898214418809327323760920377767188L),
- tw4r = T0(-0.6548607339452850640569250724662936L),
- tw4i = (fwd ? -1 : 1) * T0(0.7557495743542582837740358439723444L),
- tw5r = T0(-0.9594929736144973898903680570663277L),
- tw5i = (fwd ? -1 : 1) * T0(0.2817325568414296977114179153466169L);
+ constexpr T0 tw1r = T0(0.8412535328311811688618116489193677L),
+ tw1i = (fwd ? -1 : 1) * T0(0.5406408174555975821076359543186917L),
+ tw2r = T0(0.4154150130018864255292741492296232L),
+ tw2i = (fwd ? -1 : 1) * T0(0.9096319953545183714117153830790285L),
+ tw3r = T0(-0.1423148382732851404437926686163697L),
+ tw3i = (fwd ? -1 : 1) * T0(0.9898214418809327323760920377767188L),
+ tw4r = T0(-0.6548607339452850640569250724662936L),
+ tw4i = (fwd ? -1 : 1) * T0(0.7557495743542582837740358439723444L),
+ tw5r = T0(-0.9594929736144973898903680570663277L),
+ tw5i = (fwd ? -1 : 1) * T0(0.2817325568414296977114179153466169L);
auto CH = [ch, ido, l1](size_t a, size_t b, size_t c) -> T & {
return ch[a + ido * (b + l1 * c)];
@@ -1395,55 +1333,47 @@ namespace pocketfft
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 11 * c)];
};
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i - 1 + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i - 1 + x * (ido - 1)]; };
if (ido == 1)
for (size_t k = 0; k < l1; ++k) {
POCKETFFT_PREP11(0)
- POCKETFFT_PARTSTEP11a(1, 10, tw1r, tw2r, tw3r, tw4r, tw5r, +tw1i,
- +tw2i, +tw3i, +tw4i, +tw5i)
- POCKETFFT_PARTSTEP11a(2, 9, tw2r, tw4r, tw5r, tw3r, tw1r, +tw2i,
- +tw4i, -tw5i, -tw3i, -tw1i)
- POCKETFFT_PARTSTEP11a(3, 8, tw3r, tw5r, tw2r, tw1r, tw4r,
- +tw3i, -tw5i, -tw2i, +tw1i, +tw4i)
- POCKETFFT_PARTSTEP11a(4, 7, tw4r, tw3r, tw1r, tw5r,
- tw2r, +tw4i, -tw3i, +tw1i, +tw5i,
- -tw2i)
- POCKETFFT_PARTSTEP11a(5, 6, tw5r, tw1r, tw4r, tw2r,
- tw3r, +tw5i, -tw1i, +tw4i,
- -tw2i, +tw3i)
+ POCKETFFT_PARTSTEP11a(1, 10, tw1r, tw2r, tw3r, tw4r, tw5r, +tw1i, +tw2i, +tw3i, +tw4i,
+ +tw5i) POCKETFFT_PARTSTEP11a(2, 9, tw2r, tw4r, tw5r, tw3r, tw1r,
+ +tw2i, +tw4i, -tw5i, -tw3i, -tw1i)
+ POCKETFFT_PARTSTEP11a(3, 8, tw3r, tw5r, tw2r, tw1r, tw4r, +tw3i, -tw5i, -tw2i,
+ +tw1i, +tw4i)
+ POCKETFFT_PARTSTEP11a(4, 7, tw4r, tw3r, tw1r, tw5r, tw2r, +tw4i, -tw3i, +tw1i,
+ +tw5i, -tw2i)
+ POCKETFFT_PARTSTEP11a(5, 6, tw5r, tw1r, tw4r, tw2r, tw3r, +tw5i, -tw1i,
+ +tw4i, -tw2i, +tw3i)
}
else
for (size_t k = 0; k < l1; ++k) {
{
POCKETFFT_PREP11(0)
- POCKETFFT_PARTSTEP11a(1, 10, tw1r, tw2r, tw3r, tw4r, tw5r, +tw1i,
- +tw2i, +tw3i, +tw4i, +tw5i)
- POCKETFFT_PARTSTEP11a(2, 9, tw2r, tw4r, tw5r, tw3r, tw1r,
- +tw2i, +tw4i, -tw5i, -tw3i, -tw1i)
- POCKETFFT_PARTSTEP11a(3, 8, tw3r, tw5r, tw2r, tw1r, tw4r,
- +tw3i, -tw5i, -tw2i, +tw1i, +tw4i)
- POCKETFFT_PARTSTEP11a(4, 7, tw4r, tw3r, tw1r, tw5r,
- tw2r, +tw4i, -tw3i, +tw1i,
- +tw5i, -tw2i)
- POCKETFFT_PARTSTEP11a(5, 6, tw5r, tw1r, tw4r,
- tw2r, tw3r, +tw5i, -tw1i,
- +tw4i, -tw2i, +tw3i)
+ POCKETFFT_PARTSTEP11a(1, 10, tw1r, tw2r, tw3r, tw4r, tw5r, +tw1i, +tw2i, +tw3i, +tw4i,
+ +tw5i) POCKETFFT_PARTSTEP11a(2, 9, tw2r, tw4r, tw5r, tw3r, tw1r,
+ +tw2i, +tw4i, -tw5i, -tw3i, -tw1i)
+ POCKETFFT_PARTSTEP11a(3, 8, tw3r, tw5r, tw2r, tw1r, tw4r, +tw3i, -tw5i, -tw2i,
+ +tw1i, +tw4i)
+ POCKETFFT_PARTSTEP11a(4, 7, tw4r, tw3r, tw1r, tw5r, tw2r, +tw4i, -tw3i, +tw1i,
+ +tw5i, -tw2i)
+ POCKETFFT_PARTSTEP11a(5, 6, tw5r, tw1r, tw4r, tw2r, tw3r, +tw5i, -tw1i,
+ +tw4i, -tw2i, +tw3i)
}
for (size_t i = 1; i < ido; ++i) {
POCKETFFT_PREP11(i)
- POCKETFFT_PARTSTEP11(1, 10, tw1r, tw2r, tw3r, tw4r, tw5r, +tw1i,
- +tw2i, +tw3i, +tw4i, +tw5i)
- POCKETFFT_PARTSTEP11(2, 9, tw2r, tw4r, tw5r, tw3r, tw1r, +tw2i,
- +tw4i, -tw5i, -tw3i, -tw1i)
- POCKETFFT_PARTSTEP11(3, 8, tw3r, tw5r, tw2r, tw1r, tw4r, +tw3i,
- -tw5i, -tw2i, +tw1i, +tw4i)
- POCKETFFT_PARTSTEP11(4, 7, tw4r, tw3r, tw1r, tw5r, tw2r, +tw4i,
- -tw3i, +tw1i, +tw5i, -tw2i)
- POCKETFFT_PARTSTEP11(5, 6, tw5r, tw1r, tw4r, tw2r, tw3r, +tw5i,
- -tw1i, +tw4i, -tw2i, +tw3i)
+ POCKETFFT_PARTSTEP11(1, 10, tw1r, tw2r, tw3r, tw4r, tw5r, +tw1i, +tw2i, +tw3i, +tw4i,
+ +tw5i)
+ POCKETFFT_PARTSTEP11(2, 9, tw2r, tw4r, tw5r, tw3r, tw1r, +tw2i, +tw4i, -tw5i, -tw3i,
+ -tw1i)
+ POCKETFFT_PARTSTEP11(3, 8, tw3r, tw5r, tw2r, tw1r, tw4r, +tw3i, -tw5i, -tw2i, +tw1i,
+ +tw4i)
+ POCKETFFT_PARTSTEP11(4, 7, tw4r, tw3r, tw1r, tw5r, tw2r, +tw4i, -tw3i, +tw1i, +tw5i,
+ -tw2i)
+ POCKETFFT_PARTSTEP11(5, 6, tw5r, tw1r, tw4r, tw2r, tw3r, +tw5i, -tw1i, +tw4i, -tw2i,
+ +tw3i)
}
}
}
@@ -1455,8 +1385,7 @@ namespace pocketfft
template <bool fwd, typename T>
void passg(size_t ido, size_t ip, size_t l1, T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
- const cmplx<T0> *POCKETFFT_RESTRICT wa,
+ T *POCKETFFT_RESTRICT ch, const cmplx<T0> *POCKETFFT_RESTRICT wa,
const cmplx<T0> *POCKETFFT_RESTRICT csarr) const
{
const size_t cdim = ip;
@@ -1472,12 +1401,8 @@ namespace pocketfft
auto CX = [cc, ido, l1](size_t a, size_t b, size_t c) -> T & {
return cc[a + ido * (b + l1 * c)];
};
- auto CX2 = [cc, idl1](size_t a, size_t b) -> T & {
- return cc[a + idl1 * b];
- };
- auto CH2 = [ch, idl1](size_t a, size_t b) -> const T & {
- return ch[a + idl1 * b];
- };
+ auto CX2 = [cc, idl1](size_t a, size_t b) -> T & { return cc[a + idl1 * b]; };
+ auto CH2 = [ch, idl1](size_t a, size_t b) -> const T & { return ch[a + idl1 * b]; };
arr<cmplx<T0>> wal(ip);
wal[0] = cmplx<T0>(1., 0.);
@@ -1501,14 +1426,10 @@ namespace pocketfft
for (size_t l = 1, lc = ip - 1; l < ipph; ++l, --lc) {
// j=0
for (size_t ik = 0; ik < idl1; ++ik) {
- CX2(ik, l).r = CH2(ik, 0).r + wal[l].r * CH2(ik, 1).r +
- wal[2 * l].r * CH2(ik, 2).r;
- CX2(ik, l).i = CH2(ik, 0).i + wal[l].r * CH2(ik, 1).i +
- wal[2 * l].r * CH2(ik, 2).i;
- CX2(ik, lc).r = -wal[l].i * CH2(ik, ip - 1).i -
- wal[2 * l].i * CH2(ik, ip - 2).i;
- CX2(ik, lc).i =
- wal[l].i * CH2(ik, ip - 1).r + wal[2 * l].i * CH2(ik, ip - 2).r;
+ CX2(ik, l).r = CH2(ik, 0).r + wal[l].r * CH2(ik, 1).r + wal[2 * l].r * CH2(ik, 2).r;
+ CX2(ik, l).i = CH2(ik, 0).i + wal[l].r * CH2(ik, 1).i + wal[2 * l].r * CH2(ik, 2).i;
+ CX2(ik, lc).r = -wal[l].i * CH2(ik, ip - 1).i - wal[2 * l].i * CH2(ik, ip - 2).i;
+ CX2(ik, lc).i = wal[l].i * CH2(ik, ip - 1).r + wal[2 * l].i * CH2(ik, ip - 2).r;
}
size_t iwal = 2 * l;
@@ -1523,14 +1444,10 @@ namespace pocketfft
iwal -= ip;
cmplx<T0> xwal2 = wal[iwal];
for (size_t ik = 0; ik < idl1; ++ik) {
- CX2(ik, l).r +=
- CH2(ik, j).r * xwal.r + CH2(ik, j + 1).r * xwal2.r;
- CX2(ik, l).i +=
- CH2(ik, j).i * xwal.r + CH2(ik, j + 1).i * xwal2.r;
- CX2(ik, lc).r -=
- CH2(ik, jc).i * xwal.i + CH2(ik, jc - 1).i * xwal2.i;
- CX2(ik, lc).i +=
- CH2(ik, jc).r * xwal.i + CH2(ik, jc - 1).r * xwal2.i;
+ CX2(ik, l).r += CH2(ik, j).r * xwal.r + CH2(ik, j + 1).r * xwal2.r;
+ CX2(ik, l).i += CH2(ik, j).i * xwal.r + CH2(ik, j + 1).i * xwal2.r;
+ CX2(ik, lc).r -= CH2(ik, jc).i * xwal.i + CH2(ik, jc - 1).i * xwal2.i;
+ CX2(ik, lc).i += CH2(ik, jc).r * xwal.i + CH2(ik, jc - 1).r * xwal2.i;
}
}
for (; j < ipph; ++j, --jc) {
@@ -1731,13 +1648,10 @@ namespace pocketfft
}
template <typename T>
- void radf2(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radf2(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + l1 * c)];
};
@@ -1758,34 +1672,29 @@ namespace pocketfft
for (size_t i = 2; i < ido; i += 2) {
size_t ic = ido - i;
T tr2, ti2;
- MULPM(tr2, ti2, WA(0, i - 2), WA(0, i - 1), CC(i - 1, k, 1),
- CC(i, k, 1));
+ MULPM(tr2, ti2, WA(0, i - 2), WA(0, i - 1), CC(i - 1, k, 1), CC(i, k, 1));
PM(CH(i - 1, 0, k), CH(ic - 1, 1, k), CC(i - 1, k, 0), tr2);
PM(CH(i, 0, k), CH(ic, 1, k), ti2, CC(i, k, 0));
}
}
// a2=a+b; b2=i*(b-a);
-#define POCKETFFT_REARRANGE(rx, ix, ry, iy) \
- { \
- auto t1 = rx + ry, t2 = ry - rx, t3 = ix + iy, t4 = ix - iy; \
- rx = t1; \
- ix = t3; \
- ry = t4; \
- iy = t2; \
+#define POCKETFFT_REARRANGE(rx, ix, ry, iy) \
+ { \
+ auto t1 = rx + ry, t2 = ry - rx, t3 = ix + iy, t4 = ix - iy; \
+ rx = t1; \
+ ix = t3; \
+ ry = t4; \
+ iy = t2; \
}
template <typename T>
- void radf3(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radf3(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
- constexpr T0 taur = -0.5,
- taui = T0(0.8660254037844386467637231707529362L);
+ constexpr T0 taur = -0.5, taui = T0(0.8660254037844386467637231707529362L);
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + l1 * c)];
};
@@ -1817,20 +1726,17 @@ namespace pocketfft
T tr3 = taui * dr3; // t3 = taui*i*(d3-d2)?
T ti3 = taui * di3;
PM(CH(i - 1, 2, k), CH(ic - 1, 1, k), tr2, tr3); // PM(i) = t2+t3
- PM(CH(i, 2, k), CH(ic, 1, k), ti3, ti2); // PM(ic) = conj(t2-t3)
+ PM(CH(i, 2, k), CH(ic, 1, k), ti3, ti2); // PM(ic) = conj(t2-t3)
}
}
template <typename T>
- void radf4(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radf4(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
constexpr T0 hsqt2 = T0(0.707106781186547524400844362104849L);
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + l1 * c)];
};
@@ -1856,14 +1762,10 @@ namespace pocketfft
for (size_t k = 0; k < l1; k++)
for (size_t i = 2; i < ido; i += 2) {
size_t ic = ido - i;
- T ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3,
- tr4;
- MULPM(cr2, ci2, WA(0, i - 2), WA(0, i - 1), CC(i - 1, k, 1),
- CC(i, k, 1));
- MULPM(cr3, ci3, WA(1, i - 2), WA(1, i - 1), CC(i - 1, k, 2),
- CC(i, k, 2));
- MULPM(cr4, ci4, WA(2, i - 2), WA(2, i - 1), CC(i - 1, k, 3),
- CC(i, k, 3));
+ T ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
+ MULPM(cr2, ci2, WA(0, i - 2), WA(0, i - 1), CC(i - 1, k, 1), CC(i, k, 1));
+ MULPM(cr3, ci3, WA(1, i - 2), WA(1, i - 1), CC(i - 1, k, 2), CC(i, k, 2));
+ MULPM(cr4, ci4, WA(2, i - 2), WA(2, i - 1), CC(i - 1, k, 3), CC(i, k, 3));
PM(tr1, tr4, cr4, cr2);
PM(ti1, ti4, ci2, ci4);
PM(tr2, tr3, CC(i - 1, k, 0), cr3);
@@ -1876,8 +1778,7 @@ namespace pocketfft
}
template <typename T>
- void radf5(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radf5(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
constexpr T0 tr11 = T0(0.3090169943749474241022934171828191L),
@@ -1885,9 +1786,7 @@ namespace pocketfft
tr12 = T0(-0.8090169943749474241022934171828191L),
ti12 = T0(0.5877852522924731291687059546390728L);
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + l1 * c)];
};
@@ -1910,14 +1809,10 @@ namespace pocketfft
for (size_t k = 0; k < l1; ++k)
for (size_t i = 2, ic = ido - 2; i < ido; i += 2, ic -= 2) {
T di2, di3, di4, di5, dr2, dr3, dr4, dr5;
- MULPM(dr2, di2, WA(0, i - 2), WA(0, i - 1), CC(i - 1, k, 1),
- CC(i, k, 1));
- MULPM(dr3, di3, WA(1, i - 2), WA(1, i - 1), CC(i - 1, k, 2),
- CC(i, k, 2));
- MULPM(dr4, di4, WA(2, i - 2), WA(2, i - 1), CC(i - 1, k, 3),
- CC(i, k, 3));
- MULPM(dr5, di5, WA(3, i - 2), WA(3, i - 1), CC(i - 1, k, 4),
- CC(i, k, 4));
+ MULPM(dr2, di2, WA(0, i - 2), WA(0, i - 1), CC(i - 1, k, 1), CC(i, k, 1));
+ MULPM(dr3, di3, WA(1, i - 2), WA(1, i - 1), CC(i - 1, k, 2), CC(i, k, 2));
+ MULPM(dr4, di4, WA(2, i - 2), WA(2, i - 1), CC(i - 1, k, 3), CC(i, k, 3));
+ MULPM(dr5, di5, WA(3, i - 2), WA(3, i - 1), CC(i - 1, k, 4), CC(i, k, 4));
POCKETFFT_REARRANGE(dr2, di2, dr5, di5);
POCKETFFT_REARRANGE(dr3, di3, dr4, di4);
CH(i - 1, 0, k) = CC(i - 1, k, 0) + dr2 + dr3;
@@ -1957,12 +1852,8 @@ namespace pocketfft
auto C1 = [cc, ido, l1](size_t a, size_t b, size_t c) -> T & {
return cc[a + ido * (b + l1 * c)];
};
- auto C2 = [cc, idl1](size_t a, size_t b) -> T & {
- return cc[a + idl1 * b];
- };
- auto CH2 = [ch, idl1](size_t a, size_t b) -> T & {
- return ch[a + idl1 * b];
- };
+ auto C2 = [cc, idl1](size_t a, size_t b) -> T & { return cc[a + idl1 * b]; };
+ auto CH2 = [ch, idl1](size_t a, size_t b) -> T & { return ch[a + idl1 * b]; };
if (ido > 1) {
for (size_t j = 1, jc = ip - 1; j < ipph; ++j, --jc) // 114
@@ -1974,10 +1865,8 @@ namespace pocketfft
size_t idij2 = is2;
for (size_t i = 1; i <= ido - 2; i += 2) // 112
{
- T t1 = C1(i, k, j), t2 = C1(i + 1, k, j), t3 = C1(i, k, jc),
- t4 = C1(i + 1, k, jc);
- T x1 = wa[idij] * t1 + wa[idij + 1] * t2,
- x2 = wa[idij] * t2 - wa[idij + 1] * t1,
+ T t1 = C1(i, k, j), t2 = C1(i + 1, k, j), t3 = C1(i, k, jc), t4 = C1(i + 1, k, jc);
+ T x1 = wa[idij] * t1 + wa[idij + 1] * t2, x2 = wa[idij] * t2 - wa[idij + 1] * t1,
x3 = wa[idij2] * t3 + wa[idij2 + 1] * t4,
x4 = wa[idij2] * t4 - wa[idij2 + 1] * t3;
PM(C1(i, k, j), C1(i + 1, k, jc), x3, x1);
@@ -2000,10 +1889,8 @@ namespace pocketfft
{
for (size_t ik = 0; ik < idl1; ++ik) // 124
{
- CH2(ik, l) =
- C2(ik, 0) + csarr[2 * l] * C2(ik, 1) + csarr[4 * l] * C2(ik, 2);
- CH2(ik, lc) = csarr[2 * l + 1] * C2(ik, ip - 1) +
- csarr[4 * l + 1] * C2(ik, ip - 2);
+ CH2(ik, l) = C2(ik, 0) + csarr[2 * l] * C2(ik, 1) + csarr[4 * l] * C2(ik, 2);
+ CH2(ik, lc) = csarr[2 * l + 1] * C2(ik, ip - 1) + csarr[4 * l + 1] * C2(ik, ip - 2);
}
size_t iang = 2 * l;
size_t j = 3, jc = ip - 3;
@@ -2027,10 +1914,10 @@ namespace pocketfft
T0 ar4 = csarr[2 * iang], ai4 = csarr[2 * iang + 1];
for (size_t ik = 0; ik < idl1; ++ik) // 125
{
- CH2(ik, l) += ar1 * C2(ik, j) + ar2 * C2(ik, j + 1) +
- ar3 * C2(ik, j + 2) + ar4 * C2(ik, j + 3);
- CH2(ik, lc) += ai1 * C2(ik, jc) + ai2 * C2(ik, jc - 1) +
- ai3 * C2(ik, jc - 2) + ai4 * C2(ik, jc - 3);
+ CH2(ik, l) +=
+ ar1 * C2(ik, j) + ar2 * C2(ik, j + 1) + ar3 * C2(ik, j + 2) + ar4 * C2(ik, j + 3);
+ CH2(ik, lc) += ai1 * C2(ik, jc) + ai2 * C2(ik, jc - 1) + ai3 * C2(ik, jc - 2) +
+ ai4 * C2(ik, jc - 3);
}
}
for (; j < ipph - 1; j += 2, jc -= 2) // 126
@@ -2091,9 +1978,8 @@ namespace pocketfft
for (size_t j = 1, jc = ip - 1; j < ipph; ++j, --jc) // 140
{
size_t j2 = 2 * j - 1;
- for (size_t k = 0; k < l1; ++k) // 139
- for (size_t i = 1, ic = ido - i - 2; i <= ido - 2;
- i += 2, ic -= 2) // 138
+ for (size_t k = 0; k < l1; ++k) // 139
+ for (size_t i = 1, ic = ido - i - 2; i <= ido - 2; i += 2, ic -= 2) // 138
{
CC(i, j2 + 1, k) = CH(i, k, j) + CH(i, k, jc);
CC(ic, j2, k) = CH(i, k, j) - CH(i, k, jc);
@@ -2104,13 +1990,10 @@ namespace pocketfft
}
template <typename T>
- void radb2(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radb2(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 2 * c)];
};
@@ -2133,22 +2016,17 @@ namespace pocketfft
T ti2, tr2;
PM(CH(i - 1, k, 0), tr2, CC(i - 1, 0, k), CC(ic - 1, 1, k));
PM(ti2, CH(i, k, 0), CC(i, 0, k), CC(ic, 1, k));
- MULPM(CH(i, k, 1), CH(i - 1, k, 1), WA(0, i - 2), WA(0, i - 1), ti2,
- tr2);
+ MULPM(CH(i, k, 1), CH(i - 1, k, 1), WA(0, i - 2), WA(0, i - 1), ti2, tr2);
}
}
template <typename T>
- void radb3(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radb3(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
- constexpr T0 taur = -0.5,
- taui = T0(0.8660254037844386467637231707529362L);
+ constexpr T0 taur = -0.5, taui = T0(0.8660254037844386467637231707529362L);
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 3 * c)];
};
@@ -2167,36 +2045,30 @@ namespace pocketfft
return;
for (size_t k = 0; k < l1; k++)
for (size_t i = 2, ic = ido - 2; i < ido; i += 2, ic -= 2) {
- T tr2 =
- CC(i - 1, 2, k) + CC(ic - 1, 1, k); // t2=CC(I) + conj(CC(ic))
+ T tr2 = CC(i - 1, 2, k) + CC(ic - 1, 1, k); // t2=CC(I) + conj(CC(ic))
T ti2 = CC(i, 2, k) - CC(ic, 1, k);
T cr2 = CC(i - 1, 0, k) + taur * tr2; // c2=CC +taur*t2
T ci2 = CC(i, 0, k) + taur * ti2;
CH(i - 1, k, 0) = CC(i - 1, 0, k) + tr2; // CH=CC+t2
CH(i, k, 0) = CC(i, 0, k) + ti2;
- T cr3 = taui * (CC(i - 1, 2, k) -
- CC(ic - 1, 1, k)); // c3=taui*(CC(i)-conj(CC(ic)))
+ T cr3 = taui * (CC(i - 1, 2, k) - CC(ic - 1, 1, k)); // c3=taui*(CC(i)-conj(CC(ic)))
T ci3 = taui * (CC(i, 2, k) + CC(ic, 1, k));
T di2, di3, dr2, dr3;
PM(dr3, dr2, cr2, ci3); // d2= (cr2-ci3, ci2+cr3) = c2+i*c3
PM(di2, di3, ci2, cr3); // d3= (cr2+ci3, ci2-cr3) = c2-i*c3
MULPM(CH(i, k, 1), CH(i - 1, k, 1), WA(0, i - 2), WA(0, i - 1), di2,
dr2); // ch = WA*d2
- MULPM(CH(i, k, 2), CH(i - 1, k, 2), WA(1, i - 2), WA(1, i - 1), di3,
- dr3);
+ MULPM(CH(i, k, 2), CH(i - 1, k, 2), WA(1, i - 2), WA(1, i - 1), di3, dr3);
}
}
template <typename T>
- void radb4(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radb4(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
constexpr T0 sqrt2 = T0(1.414213562373095048801688724209698L);
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 4 * c)];
};
@@ -2226,8 +2098,7 @@ namespace pocketfft
return;
for (size_t k = 0; k < l1; ++k)
for (size_t i = 2; i < ido; i += 2) {
- T ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3,
- tr4;
+ T ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4;
size_t ic = ido - i;
PM(tr2, tr1, CC(i - 1, 0, k), CC(ic - 1, 3, k));
PM(ti1, ti2, CC(i, 0, k), CC(ic, 3, k));
@@ -2237,18 +2108,14 @@ namespace pocketfft
PM(CH(i, k, 0), ci3, ti2, ti3);
PM(cr4, cr2, tr1, tr4);
PM(ci2, ci4, ti1, ti4);
- MULPM(CH(i, k, 1), CH(i - 1, k, 1), WA(0, i - 2), WA(0, i - 1), ci2,
- cr2);
- MULPM(CH(i, k, 2), CH(i - 1, k, 2), WA(1, i - 2), WA(1, i - 1), ci3,
- cr3);
- MULPM(CH(i, k, 3), CH(i - 1, k, 3), WA(2, i - 2), WA(2, i - 1), ci4,
- cr4);
+ MULPM(CH(i, k, 1), CH(i - 1, k, 1), WA(0, i - 2), WA(0, i - 1), ci2, cr2);
+ MULPM(CH(i, k, 2), CH(i - 1, k, 2), WA(1, i - 2), WA(1, i - 1), ci3, cr3);
+ MULPM(CH(i, k, 3), CH(i - 1, k, 3), WA(2, i - 2), WA(2, i - 1), ci4, cr4);
}
}
template <typename T>
- void radb5(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc,
- T *POCKETFFT_RESTRICT ch,
+ void radb5(size_t ido, size_t l1, const T *POCKETFFT_RESTRICT cc, T *POCKETFFT_RESTRICT ch,
const T0 *POCKETFFT_RESTRICT wa) const
{
constexpr T0 tr11 = T0(0.3090169943749474241022934171828191L),
@@ -2256,9 +2123,7 @@ namespace pocketfft
tr12 = T0(-0.8090169943749474241022934171828191L),
ti12 = T0(0.5877852522924731291687059546390728L);
- auto WA = [wa, ido](size_t x, size_t i) {
- return wa[i + x * (ido - 1)];
- };
+ auto WA = [wa, ido](size_t x, size_t i) { return wa[i + x * (ido - 1)]; };
auto CC = [cc, ido](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + 5 * c)];
};
@@ -2302,14 +2167,10 @@ namespace pocketfft
PM(di3, di4, ci3, cr4);
PM(dr5, dr2, cr2, ci5);
PM(di2, di5, ci2, cr5);
- MULPM(CH(i, k, 1), CH(i - 1, k, 1), WA(0, i - 2), WA(0, i - 1), di2,
- dr2);
- MULPM(CH(i, k, 2), CH(i - 1, k, 2), WA(1, i - 2), WA(1, i - 1), di3,
- dr3);
- MULPM(CH(i, k, 3), CH(i - 1, k, 3), WA(2, i - 2), WA(2, i - 1), di4,
- dr4);
- MULPM(CH(i, k, 4), CH(i - 1, k, 4), WA(3, i - 2), WA(3, i - 1), di5,
- dr5);
+ MULPM(CH(i, k, 1), CH(i - 1, k, 1), WA(0, i - 2), WA(0, i - 1), di2, dr2);
+ MULPM(CH(i, k, 2), CH(i - 1, k, 2), WA(1, i - 2), WA(1, i - 1), di3, dr3);
+ MULPM(CH(i, k, 3), CH(i - 1, k, 3), WA(2, i - 2), WA(2, i - 1), di4, dr4);
+ MULPM(CH(i, k, 4), CH(i - 1, k, 4), WA(3, i - 2), WA(3, i - 1), di5, dr5);
}
}
@@ -2331,12 +2192,8 @@ namespace pocketfft
auto C1 = [cc, ido, l1](size_t a, size_t b, size_t c) -> const T & {
return cc[a + ido * (b + l1 * c)];
};
- auto C2 = [cc, idl1](size_t a, size_t b) -> T & {
- return cc[a + idl1 * b];
- };
- auto CH2 = [ch, idl1](size_t a, size_t b) -> T & {
- return ch[a + idl1 * b];
- };
+ auto C2 = [cc, idl1](size_t a, size_t b) -> T & { return cc[a + idl1 * b]; };
+ auto CH2 = [ch, idl1](size_t a, size_t b) -> T & { return ch[a + idl1 * b]; };
for (size_t k = 0; k < l1; ++k) // 102
for (size_t i = 0; i < ido; ++i) // 101
@@ -2355,8 +2212,7 @@ namespace pocketfft
{
size_t j2 = 2 * j - 1;
for (size_t k = 0; k < l1; ++k)
- for (size_t i = 1, ic = ido - i - 2; i <= ido - 2;
- i += 2, ic -= 2) // 109
+ for (size_t i = 1, ic = ido - i - 2; i <= ido - 2; i += 2, ic -= 2) // 109
{
CH(i, k, j) = CC(i, j2 + 1, k) + CC(ic, j2, k);
CH(i, k, jc) = CC(i, j2 + 1, k) - CC(ic, j2, k);
@@ -2367,10 +2223,8 @@ namespace pocketfft
}
for (size_t l = 1, lc = ip - 1; l < ipph; ++l, --lc) {
for (size_t ik = 0; ik < idl1; ++ik) {
- C2(ik, l) = CH2(ik, 0) + csarr[2 * l] * CH2(ik, 1) +
- csarr[4 * l] * CH2(ik, 2);
- C2(ik, lc) = csarr[2 * l + 1] * CH2(ik, ip - 1) +
- csarr[4 * l + 1] * CH2(ik, ip - 2);
+ C2(ik, l) = CH2(ik, 0) + csarr[2 * l] * CH2(ik, 1) + csarr[4 * l] * CH2(ik, 2);
+ C2(ik, lc) = csarr[2 * l + 1] * CH2(ik, ip - 1) + csarr[4 * l + 1] * CH2(ik, ip - 2);
}
size_t iang = 2 * l;
size_t j = 3, jc = ip - 3;
@@ -2392,10 +2246,10 @@ namespace pocketfft
iang -= ip;
T0 ar4 = csarr[2 * iang], ai4 = csarr[2 * iang + 1];
for (size_t ik = 0; ik < idl1; ++ik) {
- C2(ik, l) += ar1 * CH2(ik, j) + ar2 * CH2(ik, j + 1) +
- ar3 * CH2(ik, j + 2) + ar4 * CH2(ik, j + 3);
- C2(ik, lc) += ai1 * CH2(ik, jc) + ai2 * CH2(ik, jc - 1) +
- ai3 * CH2(ik, jc - 2) + ai4 * CH2(ik, jc - 3);
+ C2(ik, l) += ar1 * CH2(ik, j) + ar2 * CH2(ik, j + 1) + ar3 * CH2(ik, j + 2) +
+ ar4 * CH2(ik, j + 3);
+ C2(ik, lc) += ai1 * CH2(ik, jc) + ai2 * CH2(ik, jc - 1) + ai3 * CH2(ik, jc - 2) +
+ ai4 * CH2(ik, jc - 3);
}
}
for (; j < ipph - 1; j += 2, jc -= 2) {
@@ -2573,10 +2427,8 @@ namespace pocketfft
ptr += (ip - 1) * (ido - 1);
for (size_t j = 1; j < ip; ++j)
for (size_t i = 1; i <= (ido - 1) / 2; ++i) {
- fact[k].tw[(j - 1) * (ido - 1) + 2 * i - 2] =
- twid[j * l1 * i].r;
- fact[k].tw[(j - 1) * (ido - 1) + 2 * i - 1] =
- twid[j * l1 * i].i;
+ fact[k].tw[(j - 1) * (ido - 1) + 2 * i - 2] = twid[j * l1 * i].r;
+ fact[k].tw[(j - 1) * (ido - 1) + 2 * i - 1] = twid[j * l1 * i].i;
}
}
if (ip > 5) // special factors required by *g functions
@@ -2655,8 +2507,8 @@ namespace pocketfft
public:
POCKETFFT_NOINLINE fftblue(size_t length)
- : n(length), n2(util::good_size_cmplx(n * 2 - 1)), plan(n2),
- mem(n + n2 / 2 + 1), bk(mem.data()), bkf(mem.data() + n)
+ : n(length), n2(util::good_size_cmplx(n * 2 - 1)), plan(n2), mem(n + n2 / 2 + 1),
+ bk(mem.data()), bkf(mem.data() + n)
{
/* initialize b_k */
sincos_2pibyn<T0> tmp(2 * n);
@@ -2703,8 +2555,8 @@ namespace pocketfft
memcpy(c + 1, tmp.data() + 1, (n - 1) * sizeof(T));
} else {
tmp[0].Set(c[0], c[0] * 0);
- memcpy(reinterpret_cast<void *>(tmp.data() + 1),
- reinterpret_cast<void *>(c + 1), (n - 1) * sizeof(T));
+ memcpy(reinterpret_cast<void *>(tmp.data() + 1), reinterpret_cast<void *>(c + 1),
+ (n - 1) * sizeof(T));
if ((n & 1) == 0)
tmp[n / 2].i = T0(0) * c[0];
for (size_t m = 1; 2 * m < n; ++m)
@@ -2739,8 +2591,7 @@ namespace pocketfft
return;
}
double comp1 = util::cost_guess(length);
- double comp2 =
- 2 * util::cost_guess(util::good_size_cmplx(2 * length - 1));
+ double comp2 = 2 * util::cost_guess(util::good_size_cmplx(2 * length - 1));
comp2 *= 1.5; /* fudge factor that appears to give good overall
performance */
if (comp2 < comp1) // use Bluestein
@@ -2784,8 +2635,7 @@ namespace pocketfft
return;
}
double comp1 = 0.5 * util::cost_guess(length);
- double comp2 =
- 2 * util::cost_guess(util::good_size_cmplx(2 * length - 1));
+ double comp2 = 2 * util::cost_guess(util::good_size_cmplx(2 * length - 1));
comp2 *= 1.5; /* fudge factor that appears to give good overall
performance */
if (comp2 < comp1) // use Bluestein
@@ -2822,8 +2672,7 @@ namespace pocketfft
}
template <typename T>
- POCKETFFT_NOINLINE void exec(T c[], T0 fct, bool ortho, int /*type*/,
- bool /*cosine*/) const
+ POCKETFFT_NOINLINE void exec(T c[], T0 fct, bool ortho, int /*type*/, bool /*cosine*/) const
{
constexpr T0 sqrt2 = T0(1.414213562373095048801688724209698L);
size_t N = fftplan.length(), n = N / 2 + 1;
@@ -2892,8 +2741,7 @@ namespace pocketfft
std::vector<T0> twiddle;
public:
- POCKETFFT_NOINLINE T_dcst23(size_t length)
- : fftplan(length), twiddle(length)
+ POCKETFFT_NOINLINE T_dcst23(size_t length) : fftplan(length), twiddle(length)
{
sincos_2pibyn<T0> tw(4 * length);
for (size_t i = 0; i < length; ++i)
@@ -2901,8 +2749,7 @@ namespace pocketfft
}
template <typename T>
- POCKETFFT_NOINLINE void exec(T c[], T0 fct, bool ortho, int type,
- bool cosine) const
+ POCKETFFT_NOINLINE void exec(T c[], T0 fct, bool ortho, int type, bool cosine) const
{
constexpr T0 sqrt2 = T0(1.414213562373095048801688724209698L);
size_t N = length();
@@ -2970,8 +2817,7 @@ namespace pocketfft
public:
POCKETFFT_NOINLINE T_dcst4(size_t length)
: N(length), fft((N & 1) ? nullptr : new pocketfft_c<T0>(N / 2)),
- rfft((N & 1) ? new pocketfft_r<T0>(N) : nullptr),
- C2((N & 1) ? 0 : N / 2)
+ rfft((N & 1) ? new pocketfft_r<T0>(N) : nullptr), C2((N & 1) ? 0 : N / 2)
{
if ((N & 1) == 0) {
sincos_2pibyn<T0> tw(16 * N);
@@ -2981,8 +2827,7 @@ namespace pocketfft
}
template <typename T>
- POCKETFFT_NOINLINE void exec(T c[], T0 fct, bool /*ortho*/, int /*type*/,
- bool cosine) const
+ POCKETFFT_NOINLINE void exec(T c[], T0 fct, bool /*ortho*/, int /*type*/, bool cosine) const
{
size_t n2 = N / 2;
if (!cosine)
@@ -3018,10 +2863,8 @@ namespace pocketfft
for (; k < n2; ++i, ++i1, k += 2) {
c[i] = y[2 * k - 1] * SGN(i1) + y[2 * k] * SGN(i);
c[N - i1] = y[2 * k - 1] * SGN(N - i) - y[2 * k] * SGN(N - i1);
- c[n2 - i1] =
- y[2 * k + 1] * SGN(n2 - i) - y[2 * k + 2] * SGN(n2 - i1);
- c[n2 + i1] =
- y[2 * k + 1] * SGN(n2 + i + 2) + y[2 * k + 2] * SGN(n2 + i1);
+ c[n2 - i1] = y[2 * k + 1] * SGN(n2 - i) - y[2 * k + 2] * SGN(n2 - i1);
+ c[n2 + i1] = y[2 * k + 1] * SGN(n2 + i + 2) + y[2 * k + 2] * SGN(n2 + i1);
}
if (k == n2) {
c[i] = y[2 * k - 1] * SGN(i + 1) + y[2 * k] * SGN(i);
@@ -3119,8 +2962,7 @@ namespace pocketfft
stride_t str;
public:
- arr_info(const shape_t &shape_, const stride_t &stride_)
- : shp(shape_), str(stride_)
+ arr_info(const shape_t &shape_, const stride_t &stride_) : shp(shape_), str(stride_)
{
}
size_t ndim() const
@@ -3207,9 +3049,8 @@ namespace pocketfft
public:
multi_iter(const arr_info &iarr_, const arr_info &oarr_, size_t idim_)
- : pos(iarr_.ndim(), 0), iarr(iarr_), oarr(oarr_), p_ii(0),
- str_i(iarr.stride(idim_)), p_oi(0), str_o(oarr.stride(idim_)),
- idim(idim_), rem(iarr.size() / iarr.shape(idim))
+ : pos(iarr_.ndim(), 0), iarr(iarr_), oarr(oarr_), p_ii(0), str_i(iarr.stride(idim_)),
+ p_oi(0), str_o(oarr.stride(idim_)), idim(idim_), rem(iarr.size() / iarr.shape(idim))
{
auto nshares = threading::num_threads();
if (nshares == 1)
@@ -3221,8 +3062,7 @@ namespace pocketfft
throw std::runtime_error("impossible share requested");
size_t nbase = rem / nshares;
size_t additional = rem % nshares;
- size_t lo =
- myshare * nbase + ((myshare < additional) ? myshare : additional);
+ size_t lo = myshare * nbase + ((myshare < additional) ? myshare : additional);
size_t hi = lo + nbase + (myshare < additional);
size_t todo = hi - lo;
@@ -3297,8 +3137,7 @@ namespace pocketfft
size_t rem;
public:
- simple_iter(const arr_info &arr_)
- : pos(arr_.ndim(), 0), arr(arr_), p(0), rem(arr_.size())
+ simple_iter(const arr_info &arr_) : pos(arr_.ndim(), 0), arr(arr_), p(0), rem(arr_.size())
{
}
void advance()
@@ -3337,8 +3176,8 @@ namespace pocketfft
public:
rev_iter(const arr_info &arr_, const shape_t &axes)
- : pos(arr_.ndim(), 0), arr(arr_), rev_axis(arr_.ndim(), 0),
- rev_jump(arr_.ndim(), 1), p(0), rp(0)
+ : pos(arr_.ndim(), 0), arr(arr_), rev_axis(arr_.ndim(), 0), rev_jump(arr_.ndim(), 1),
+ p(0), rp(0)
{
for (auto ax : axes)
rev_axis[ax] = 1;
@@ -3399,18 +3238,16 @@ namespace pocketfft
#ifndef POCKETFFT_NO_VECTORS
template <>
struct VTYPE<float> {
- using type =
- float __attribute__((vector_size(VLEN<float>::val * sizeof(float))));
+ using type = float __attribute__((vector_size(VLEN<float>::val * sizeof(float))));
};
template <>
struct VTYPE<double> {
- using type = double
- __attribute__((vector_size(VLEN<double>::val * sizeof(double))));
+ using type = double __attribute__((vector_size(VLEN<double>::val * sizeof(double))));
};
template <>
struct VTYPE<long double> {
- using type = long double __attribute__((
- vector_size(VLEN<long double>::val * sizeof(long double))));
+ using type =
+ long double __attribute__((vector_size(VLEN<long double>::val * sizeof(long double))));
};
#endif
@@ -3422,8 +3259,7 @@ namespace pocketfft
return arr<char>(tmpsize * elemsize);
}
template <typename T>
- arr<char> alloc_tmp(const shape_t &shape, const shape_t &axes,
- size_t elemsize)
+ arr<char> alloc_tmp(const shape_t &shape, const shape_t &axes, size_t elemsize)
{
size_t fullsize = util::prod(shape);
size_t tmpsize = 0;
@@ -3458,8 +3294,7 @@ namespace pocketfft
}
template <typename T, size_t vlen>
- void copy_input(const multi_iter<vlen> &it, const cndarr<T> &src,
- T *POCKETFFT_RESTRICT dst)
+ void copy_input(const multi_iter<vlen> &it, const cndarr<T> &src, T *POCKETFFT_RESTRICT dst)
{
if (dst == &src[it.iofs(0)])
return; // in-place
@@ -3468,8 +3303,7 @@ namespace pocketfft
}
template <typename T, size_t vlen>
- void copy_output(const multi_iter<vlen> &it,
- const cmplx<vtype_t<T>> *POCKETFFT_RESTRICT src,
+ void copy_output(const multi_iter<vlen> &it, const cmplx<vtype_t<T>> *POCKETFFT_RESTRICT src,
ndarr<cmplx<T>> &dst)
{
for (size_t i = 0; i < it.length_out(); ++i)
@@ -3478,8 +3312,8 @@ namespace pocketfft
}
template <typename T, size_t vlen>
- void copy_output(const multi_iter<vlen> &it,
- const vtype_t<T> *POCKETFFT_RESTRICT src, ndarr<T> &dst)
+ void copy_output(const multi_iter<vlen> &it, const vtype_t<T> *POCKETFFT_RESTRICT src,
+ ndarr<T> &dst)
{
for (size_t i = 0; i < it.length_out(); ++i)
for (size_t j = 0; j < vlen; ++j)
@@ -3487,8 +3321,7 @@ namespace pocketfft
}
template <typename T, size_t vlen>
- void copy_output(const multi_iter<vlen> &it,
- const T *POCKETFFT_RESTRICT src, ndarr<T> &dst)
+ void copy_output(const multi_iter<vlen> &it, const T *POCKETFFT_RESTRICT src, ndarr<T> &dst)
{
if (src == &dst[it.oofs(0)])
return; // in-place
@@ -3508,9 +3341,8 @@ namespace pocketfft
using add_vec_t = typename add_vec<T>::type;
template <typename Tplan, typename T, typename T0, typename Exec>
- POCKETFFT_NOINLINE void general_nd(const cndarr<T> &in, ndarr<T> &out,
- const shape_t &axes, T0 fct,
- size_t nthreads, const Exec &exec,
+ POCKETFFT_NOINLINE void general_nd(const cndarr<T> &in, ndarr<T> &out, const shape_t &axes,
+ T0 fct, size_t nthreads, const Exec &exec,
const bool allow_inplace = true)
{
std::shared_ptr<Tplan> plan;
@@ -3520,31 +3352,29 @@ namespace pocketfft
if ((!plan) || (len != plan->length()))
plan = get_plan<Tplan>(len);
- threading::thread_map(
- util::thread_count(nthreads, in.shape(), axes[iax], VLEN<T>::val),
- [&] {
- constexpr auto vlen = VLEN<T0>::val;
- auto storage = alloc_tmp<T0>(in.shape(), len, sizeof(T));
- const auto &tin(iax == 0 ? in : out);
- multi_iter<vlen> it(tin, out, axes[iax]);
+ threading::thread_map(util::thread_count(nthreads, in.shape(), axes[iax], VLEN<T>::val),
+ [&] {
+ constexpr auto vlen = VLEN<T0>::val;
+ auto storage = alloc_tmp<T0>(in.shape(), len, sizeof(T));
+ const auto &tin(iax == 0 ? in : out);
+ multi_iter<vlen> it(tin, out, axes[iax]);
#ifndef POCKETFFT_NO_VECTORS
- if (vlen > 1)
- while (it.remaining() >= vlen) {
- it.advance(vlen);
- auto tdatav =
- reinterpret_cast<add_vec_t<T> *>(storage.data());
- exec(it, tin, out, tdatav, *plan, fct);
- }
+ if (vlen > 1)
+ while (it.remaining() >= vlen) {
+ it.advance(vlen);
+ auto tdatav = reinterpret_cast<add_vec_t<T> *>(storage.data());
+ exec(it, tin, out, tdatav, *plan, fct);
+ }
#endif
- while (it.remaining() > 0) {
- it.advance(1);
- auto buf = allow_inplace && it.stride_out() == sizeof(T)
- ? &out[it.oofs(0)]
- : reinterpret_cast<T *>(storage.data());
- exec(it, tin, out, buf, *plan, fct);
- }
- }); // end of parallel region
- fct = T0(1); // factor has been applied, use 1 for remaining axes
+ while (it.remaining() > 0) {
+ it.advance(1);
+ auto buf = allow_inplace && it.stride_out() == sizeof(T)
+ ? &out[it.oofs(0)]
+ : reinterpret_cast<T *>(storage.data());
+ exec(it, tin, out, buf, *plan, fct);
+ }
+ }); // end of parallel region
+ fct = T0(1); // factor has been applied, use 1 for remaining axes
}
}
@@ -3553,8 +3383,7 @@ namespace pocketfft
template <typename T0, typename T, size_t vlen>
void operator()(const multi_iter<vlen> &it, const cndarr<cmplx<T0>> &in,
- ndarr<cmplx<T0>> &out, T *buf,
- const pocketfft_c<T0> &plan, T0 fct) const
+ ndarr<cmplx<T0>> &out, T *buf, const pocketfft_c<T0> &plan, T0 fct) const
{
copy_input(it, in, buf);
plan.exec(buf, fct, forward);
@@ -3563,8 +3392,8 @@ namespace pocketfft
};
template <typename T, size_t vlen>
- void copy_hartley(const multi_iter<vlen> &it,
- const vtype_t<T> *POCKETFFT_RESTRICT src, ndarr<T> &dst)
+ void copy_hartley(const multi_iter<vlen> &it, const vtype_t<T> *POCKETFFT_RESTRICT src,
+ ndarr<T> &dst)
{
for (size_t j = 0; j < vlen; ++j)
dst[it.oofs(j, 0)] = src[0][j];
@@ -3580,8 +3409,7 @@ namespace pocketfft
}
template <typename T, size_t vlen>
- void copy_hartley(const multi_iter<vlen> &it,
- const T *POCKETFFT_RESTRICT src, ndarr<T> &dst)
+ void copy_hartley(const multi_iter<vlen> &it, const T *POCKETFFT_RESTRICT src, ndarr<T> &dst)
{
dst[it.oofs(0)] = src[0];
size_t i = 1, i1 = 1, i2 = it.length_out() - 1;
@@ -3595,9 +3423,8 @@ namespace pocketfft
struct ExecHartley {
template <typename T0, typename T, size_t vlen>
- void operator()(const multi_iter<vlen> &it, const cndarr<T0> &in,
- ndarr<T0> &out, T *buf, const pocketfft_r<T0> &plan,
- T0 fct) const
+ void operator()(const multi_iter<vlen> &it, const cndarr<T0> &in, ndarr<T0> &out, T *buf,
+ const pocketfft_r<T0> &plan, T0 fct) const
{
copy_input(it, in, buf);
plan.exec(buf, fct, true);
@@ -3611,8 +3438,8 @@ namespace pocketfft
bool cosine;
template <typename T0, typename T, typename Tplan, size_t vlen>
- void operator()(const multi_iter<vlen> &it, const cndarr<T0> &in,
- ndarr<T0> &out, T *buf, const Tplan &plan, T0 fct) const
+ void operator()(const multi_iter<vlen> &it, const cndarr<T0> &in, ndarr<T0> &out, T *buf,
+ const Tplan &plan, T0 fct) const
{
copy_input(it, in, buf);
plan.exec(buf, fct, ortho, type, cosine);
@@ -3621,131 +3448,126 @@ namespace pocketfft
};
template <typename T>
- POCKETFFT_NOINLINE void general_r2c(const cndarr<T> &in,
- ndarr<cmplx<T>> &out, size_t axis,
+ POCKETFFT_NOINLINE void general_r2c(const cndarr<T> &in, ndarr<cmplx<T>> &out, size_t axis,
bool forward, T fct, size_t nthreads)
{
auto plan = get_plan<pocketfft_r<T>>(in.shape(axis));
size_t len = in.shape(axis);
- threading::thread_map(
- util::thread_count(nthreads, in.shape(), axis, VLEN<T>::val), [&] {
- constexpr auto vlen = VLEN<T>::val;
- auto storage = alloc_tmp<T>(in.shape(), len, sizeof(T));
- multi_iter<vlen> it(in, out, axis);
+ threading::thread_map(util::thread_count(nthreads, in.shape(), axis, VLEN<T>::val), [&] {
+ constexpr auto vlen = VLEN<T>::val;
+ auto storage = alloc_tmp<T>(in.shape(), len, sizeof(T));
+ multi_iter<vlen> it(in, out, axis);
#ifndef POCKETFFT_NO_VECTORS
- if (vlen > 1)
- while (it.remaining() >= vlen) {
- it.advance(vlen);
- auto tdatav = reinterpret_cast<vtype_t<T> *>(storage.data());
- copy_input(it, in, tdatav);
- plan->exec(tdatav, fct, true);
+ if (vlen > 1)
+ while (it.remaining() >= vlen) {
+ it.advance(vlen);
+ auto tdatav = reinterpret_cast<vtype_t<T> *>(storage.data());
+ copy_input(it, in, tdatav);
+ plan->exec(tdatav, fct, true);
+ for (size_t j = 0; j < vlen; ++j)
+ out[it.oofs(j, 0)].Set(tdatav[0][j]);
+ size_t i = 1, ii = 1;
+ if (forward)
+ for (; i < len - 1; i += 2, ++ii)
for (size_t j = 0; j < vlen; ++j)
- out[it.oofs(j, 0)].Set(tdatav[0][j]);
- size_t i = 1, ii = 1;
- if (forward)
- for (; i < len - 1; i += 2, ++ii)
- for (size_t j = 0; j < vlen; ++j)
- out[it.oofs(j, ii)].Set(tdatav[i][j], tdatav[i + 1][j]);
- else
- for (; i < len - 1; i += 2, ++ii)
- for (size_t j = 0; j < vlen; ++j)
- out[it.oofs(j, ii)].Set(tdatav[i][j], -tdatav[i + 1][j]);
- if (i < len)
- for (size_t j = 0; j < vlen; ++j)
- out[it.oofs(j, ii)].Set(tdatav[i][j]);
- }
+ out[it.oofs(j, ii)].Set(tdatav[i][j], tdatav[i + 1][j]);
+ else
+ for (; i < len - 1; i += 2, ++ii)
+ for (size_t j = 0; j < vlen; ++j)
+ out[it.oofs(j, ii)].Set(tdatav[i][j], -tdatav[i + 1][j]);
+ if (i < len)
+ for (size_t j = 0; j < vlen; ++j)
+ out[it.oofs(j, ii)].Set(tdatav[i][j]);
+ }
#endif
- while (it.remaining() > 0) {
- it.advance(1);
- auto tdata = reinterpret_cast<T *>(storage.data());
- copy_input(it, in, tdata);
- plan->exec(tdata, fct, true);
- out[it.oofs(0)].Set(tdata[0]);
- size_t i = 1, ii = 1;
- if (forward)
- for (; i < len - 1; i += 2, ++ii)
- out[it.oofs(ii)].Set(tdata[i], tdata[i + 1]);
- else
- for (; i < len - 1; i += 2, ++ii)
- out[it.oofs(ii)].Set(tdata[i], -tdata[i + 1]);
- if (i < len)
- out[it.oofs(ii)].Set(tdata[i]);
- }
- }); // end of parallel region
+ while (it.remaining() > 0) {
+ it.advance(1);
+ auto tdata = reinterpret_cast<T *>(storage.data());
+ copy_input(it, in, tdata);
+ plan->exec(tdata, fct, true);
+ out[it.oofs(0)].Set(tdata[0]);
+ size_t i = 1, ii = 1;
+ if (forward)
+ for (; i < len - 1; i += 2, ++ii)
+ out[it.oofs(ii)].Set(tdata[i], tdata[i + 1]);
+ else
+ for (; i < len - 1; i += 2, ++ii)
+ out[it.oofs(ii)].Set(tdata[i], -tdata[i + 1]);
+ if (i < len)
+ out[it.oofs(ii)].Set(tdata[i]);
+ }
+ }); // end of parallel region
}
template <typename T>
- POCKETFFT_NOINLINE void general_c2r(const cndarr<cmplx<T>> &in,
- ndarr<T> &out, size_t axis,
+ POCKETFFT_NOINLINE void general_c2r(const cndarr<cmplx<T>> &in, ndarr<T> &out, size_t axis,
bool forward, T fct, size_t nthreads)
{
auto plan = get_plan<pocketfft_r<T>>(out.shape(axis));
size_t len = out.shape(axis);
- threading::thread_map(
- util::thread_count(nthreads, in.shape(), axis, VLEN<T>::val), [&] {
- constexpr auto vlen = VLEN<T>::val;
- auto storage = alloc_tmp<T>(out.shape(), len, sizeof(T));
- multi_iter<vlen> it(in, out, axis);
+ threading::thread_map(util::thread_count(nthreads, in.shape(), axis, VLEN<T>::val), [&] {
+ constexpr auto vlen = VLEN<T>::val;
+ auto storage = alloc_tmp<T>(out.shape(), len, sizeof(T));
+ multi_iter<vlen> it(in, out, axis);
#ifndef POCKETFFT_NO_VECTORS
- if (vlen > 1)
- while (it.remaining() >= vlen) {
- it.advance(vlen);
- auto tdatav = reinterpret_cast<vtype_t<T> *>(storage.data());
- for (size_t j = 0; j < vlen; ++j)
- tdatav[0][j] = in[it.iofs(j, 0)].r;
- {
- size_t i = 1, ii = 1;
- if (forward)
- for (; i < len - 1; i += 2, ++ii)
- for (size_t j = 0; j < vlen; ++j) {
- tdatav[i][j] = in[it.iofs(j, ii)].r;
- tdatav[i + 1][j] = -in[it.iofs(j, ii)].i;
- }
- else
- for (; i < len - 1; i += 2, ++ii)
- for (size_t j = 0; j < vlen; ++j) {
- tdatav[i][j] = in[it.iofs(j, ii)].r;
- tdatav[i + 1][j] = in[it.iofs(j, ii)].i;
- }
- if (i < len)
- for (size_t j = 0; j < vlen; ++j)
- tdatav[i][j] = in[it.iofs(j, ii)].r;
- }
- plan->exec(tdatav, fct, false);
- copy_output(it, tdatav, out);
- }
-#endif
- while (it.remaining() > 0) {
- it.advance(1);
- auto tdata = reinterpret_cast<T *>(storage.data());
- tdata[0] = in[it.iofs(0)].r;
- {
- size_t i = 1, ii = 1;
- if (forward)
- for (; i < len - 1; i += 2, ++ii) {
- tdata[i] = in[it.iofs(ii)].r;
- tdata[i + 1] = -in[it.iofs(ii)].i;
+ if (vlen > 1)
+ while (it.remaining() >= vlen) {
+ it.advance(vlen);
+ auto tdatav = reinterpret_cast<vtype_t<T> *>(storage.data());
+ for (size_t j = 0; j < vlen; ++j)
+ tdatav[0][j] = in[it.iofs(j, 0)].r;
+ {
+ size_t i = 1, ii = 1;
+ if (forward)
+ for (; i < len - 1; i += 2, ++ii)
+ for (size_t j = 0; j < vlen; ++j) {
+ tdatav[i][j] = in[it.iofs(j, ii)].r;
+ tdatav[i + 1][j] = -in[it.iofs(j, ii)].i;
}
- else
- for (; i < len - 1; i += 2, ++ii) {
- tdata[i] = in[it.iofs(ii)].r;
- tdata[i + 1] = in[it.iofs(ii)].i;
+ else
+ for (; i < len - 1; i += 2, ++ii)
+ for (size_t j = 0; j < vlen; ++j) {
+ tdatav[i][j] = in[it.iofs(j, ii)].r;
+ tdatav[i + 1][j] = in[it.iofs(j, ii)].i;
}
- if (i < len)
- tdata[i] = in[it.iofs(ii)].r;
- }
- plan->exec(tdata, fct, false);
- copy_output(it, tdata, out);
+ if (i < len)
+ for (size_t j = 0; j < vlen; ++j)
+ tdatav[i][j] = in[it.iofs(j, ii)].r;
}
- }); // end of parallel region
+ plan->exec(tdatav, fct, false);
+ copy_output(it, tdatav, out);
+ }
+#endif
+ while (it.remaining() > 0) {
+ it.advance(1);
+ auto tdata = reinterpret_cast<T *>(storage.data());
+ tdata[0] = in[it.iofs(0)].r;
+ {
+ size_t i = 1, ii = 1;
+ if (forward)
+ for (; i < len - 1; i += 2, ++ii) {
+ tdata[i] = in[it.iofs(ii)].r;
+ tdata[i + 1] = -in[it.iofs(ii)].i;
+ }
+ else
+ for (; i < len - 1; i += 2, ++ii) {
+ tdata[i] = in[it.iofs(ii)].r;
+ tdata[i + 1] = in[it.iofs(ii)].i;
+ }
+ if (i < len)
+ tdata[i] = in[it.iofs(ii)].r;
+ }
+ plan->exec(tdata, fct, false);
+ copy_output(it, tdata, out);
+ }
+ }); // end of parallel region
}
struct ExecR2R {
bool r2c, forward;
template <typename T0, typename T, size_t vlen>
- void operator()(const multi_iter<vlen> &it, const cndarr<T0> &in,
- ndarr<T0> &out, T *buf, const pocketfft_r<T0> &plan,
- T0 fct) const
+ void operator()(const multi_iter<vlen> &it, const cndarr<T0> &in, ndarr<T0> &out, T *buf,
+ const pocketfft_r<T0> &plan, T0 fct) const
{
copy_input(it, in, buf);
if ((!r2c) && forward)
@@ -3760,33 +3582,28 @@ namespace pocketfft
};
template <typename T>
- void c2c(const shape_t &shape, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes, bool forward,
- const std::complex<T> *data_in, std::complex<T> *data_out, T fct,
- size_t nthreads = 1)
+ void c2c(const shape_t &shape, const stride_t &stride_in, const stride_t &stride_out,
+ const shape_t &axes, bool forward, const std::complex<T> *data_in,
+ std::complex<T> *data_out, T fct, size_t nthreads = 1)
{
if (util::prod(shape) == 0)
return;
- util::sanity_check(shape, stride_in, stride_out, data_in == data_out,
- axes);
+ util::sanity_check(shape, stride_in, stride_out, data_in == data_out, axes);
cndarr<cmplx<T>> ain(data_in, shape, stride_in);
ndarr<cmplx<T>> aout(data_out, shape, stride_out);
- general_nd<pocketfft_c<T>>(ain, aout, axes, fct, nthreads,
- ExecC2C{forward});
+ general_nd<pocketfft_c<T>>(ain, aout, axes, fct, nthreads, ExecC2C{forward});
}
template <typename T>
- void dct(const shape_t &shape, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes, int type,
- const T *data_in, T *data_out, T fct, bool ortho,
+ void dct(const shape_t &shape, const stride_t &stride_in, const stride_t &stride_out,
+ const shape_t &axes, int type, const T *data_in, T *data_out, T fct, bool ortho,
size_t nthreads = 1)
{
if ((type < 1) || (type > 4))
throw std::invalid_argument("invalid DCT type");
if (util::prod(shape) == 0)
return;
- util::sanity_check(shape, stride_in, stride_out, data_in == data_out,
- axes);
+ util::sanity_check(shape, stride_in, stride_out, data_in == data_out, axes);
cndarr<T> ain(data_in, shape, stride_in);
ndarr<T> aout(data_out, shape, stride_out);
const ExecDcst exec{ortho, type, true};
@@ -3799,17 +3616,15 @@ namespace pocketfft
}
template <typename T>
- void dst(const shape_t &shape, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes, int type,
- const T *data_in, T *data_out, T fct, bool ortho,
+ void dst(const shape_t &shape, const stride_t &stride_in, const stride_t &stride_out,
+ const shape_t &axes, int type, const T *data_in, T *data_out, T fct, bool ortho,
size_t nthreads = 1)
{
if ((type < 1) || (type > 4))
throw std::invalid_argument("invalid DST type");
if (util::prod(shape) == 0)
return;
- util::sanity_check(shape, stride_in, stride_out, data_in == data_out,
- axes);
+ util::sanity_check(shape, stride_in, stride_out, data_in == data_out, axes);
cndarr<T> ain(data_in, shape, stride_in);
ndarr<T> aout(data_out, shape, stride_out);
const ExecDcst exec{ortho, type, false};
@@ -3822,9 +3637,8 @@ namespace pocketfft
}
template <typename T>
- void r2c(const shape_t &shape_in, const stride_t &stride_in,
- const stride_t &stride_out, size_t axis, bool forward,
- const T *data_in, std::complex<T> *data_out, T fct,
+ void r2c(const shape_t &shape_in, const stride_t &stride_in, const stride_t &stride_out,
+ size_t axis, bool forward, const T *data_in, std::complex<T> *data_out, T fct,
size_t nthreads = 1)
{
if (util::prod(shape_in) == 0)
@@ -3838,30 +3652,26 @@ namespace pocketfft
}
template <typename T>
- void r2c(const shape_t &shape_in, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes, bool forward,
- const T *data_in, std::complex<T> *data_out, T fct,
+ void r2c(const shape_t &shape_in, const stride_t &stride_in, const stride_t &stride_out,
+ const shape_t &axes, bool forward, const T *data_in, std::complex<T> *data_out, T fct,
size_t nthreads = 1)
{
if (util::prod(shape_in) == 0)
return;
util::sanity_check(shape_in, stride_in, stride_out, false, axes);
- r2c(shape_in, stride_in, stride_out, axes.back(), forward, data_in,
- data_out, fct, nthreads);
+ r2c(shape_in, stride_in, stride_out, axes.back(), forward, data_in, data_out, fct, nthreads);
if (axes.size() == 1)
return;
shape_t shape_out(shape_in);
shape_out[axes.back()] = shape_in[axes.back()] / 2 + 1;
auto newaxes = shape_t{axes.begin(), --axes.end()};
- c2c(shape_out, stride_out, stride_out, newaxes, forward, data_out,
- data_out, T(1), nthreads);
+ c2c(shape_out, stride_out, stride_out, newaxes, forward, data_out, data_out, T(1), nthreads);
}
template <typename T>
- void c2r(const shape_t &shape_out, const stride_t &stride_in,
- const stride_t &stride_out, size_t axis, bool forward,
- const std::complex<T> *data_in, T *data_out, T fct,
+ void c2r(const shape_t &shape_out, const stride_t &stride_in, const stride_t &stride_out,
+ size_t axis, bool forward, const std::complex<T> *data_in, T *data_out, T fct,
size_t nthreads = 1)
{
if (util::prod(shape_out) == 0)
@@ -3875,16 +3685,15 @@ namespace pocketfft
}
template <typename T>
- void c2r(const shape_t &shape_out, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes, bool forward,
- const std::complex<T> *data_in, T *data_out, T fct,
+ void c2r(const shape_t &shape_out, const stride_t &stride_in, const stride_t &stride_out,
+ const shape_t &axes, bool forward, const std::complex<T> *data_in, T *data_out, T fct,
size_t nthreads = 1)
{
if (util::prod(shape_out) == 0)
return;
if (axes.size() == 1)
- return c2r(shape_out, stride_in, stride_out, axes[0], forward, data_in,
- data_out, fct, nthreads);
+ return c2r(shape_out, stride_in, stride_out, axes[0], forward, data_in, data_out, fct,
+ nthreads);
util::sanity_check(shape_out, stride_in, stride_out, false, axes);
auto shape_in = shape_out;
shape_in[axes.back()] = shape_out[axes.back()] / 2 + 1;
@@ -3892,61 +3701,51 @@ namespace pocketfft
stride_t stride_inter(shape_in.size());
stride_inter.back() = sizeof(cmplx<T>);
for (int i = int(shape_in.size()) - 2; i >= 0; --i)
- stride_inter[size_t(i)] =
- stride_inter[size_t(i + 1)] * ptrdiff_t(shape_in[size_t(i + 1)]);
+ stride_inter[size_t(i)] = stride_inter[size_t(i + 1)] * ptrdiff_t(shape_in[size_t(i + 1)]);
arr<std::complex<T>> tmp(nval);
auto newaxes = shape_t{axes.begin(), --axes.end()};
- c2c(shape_in, stride_in, stride_inter, newaxes, forward, data_in,
- tmp.data(), T(1), nthreads);
- c2r(shape_out, stride_inter, stride_out, axes.back(), forward, tmp.data(),
- data_out, fct, nthreads);
+ c2c(shape_in, stride_in, stride_inter, newaxes, forward, data_in, tmp.data(), T(1), nthreads);
+ c2r(shape_out, stride_inter, stride_out, axes.back(), forward, tmp.data(), data_out, fct,
+ nthreads);
}
template <typename T>
- void r2r_fftpack(const shape_t &shape, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes,
- bool real2hermitian, bool forward, const T *data_in,
+ void r2r_fftpack(const shape_t &shape, const stride_t &stride_in, const stride_t &stride_out,
+ const shape_t &axes, bool real2hermitian, bool forward, const T *data_in,
T *data_out, T fct, size_t nthreads = 1)
{
if (util::prod(shape) == 0)
return;
- util::sanity_check(shape, stride_in, stride_out, data_in == data_out,
- axes);
+ util::sanity_check(shape, stride_in, stride_out, data_in == data_out, axes);
cndarr<T> ain(data_in, shape, stride_in);
ndarr<T> aout(data_out, shape, stride_out);
- general_nd<pocketfft_r<T>>(ain, aout, axes, fct, nthreads,
- ExecR2R{real2hermitian, forward});
+ general_nd<pocketfft_r<T>>(ain, aout, axes, fct, nthreads, ExecR2R{real2hermitian, forward});
}
template <typename T>
void r2r_separable_hartley(const shape_t &shape, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes,
- const T *data_in, T *data_out, T fct,
- size_t nthreads = 1)
+ const stride_t &stride_out, const shape_t &axes, const T *data_in,
+ T *data_out, T fct, size_t nthreads = 1)
{
if (util::prod(shape) == 0)
return;
- util::sanity_check(shape, stride_in, stride_out, data_in == data_out,
- axes);
+ util::sanity_check(shape, stride_in, stride_out, data_in == data_out, axes);
cndarr<T> ain(data_in, shape, stride_in);
ndarr<T> aout(data_out, shape, stride_out);
- general_nd<pocketfft_r<T>>(ain, aout, axes, fct, nthreads, ExecHartley{},
- false);
+ general_nd<pocketfft_r<T>>(ain, aout, axes, fct, nthreads, ExecHartley{}, false);
}
template <typename T>
void r2r_genuine_hartley(const shape_t &shape, const stride_t &stride_in,
- const stride_t &stride_out, const shape_t &axes,
- const T *data_in, T *data_out, T fct,
- size_t nthreads = 1)
+ const stride_t &stride_out, const shape_t &axes, const T *data_in,
+ T *data_out, T fct, size_t nthreads = 1)
{
if (util::prod(shape) == 0)
return;
if (axes.size() == 1)
- return r2r_separable_hartley(shape, stride_in, stride_out, axes,
- data_in, data_out, fct, nthreads);
- util::sanity_check(shape, stride_in, stride_out, data_in == data_out,
- axes);
+ return r2r_separable_hartley(shape, stride_in, stride_out, axes, data_in, data_out, fct,
+ nthreads);
+ util::sanity_check(shape, stride_in, stride_out, data_in == data_out, axes);
shape_t tshp(shape);
tshp[axes.back()] = tshp[axes.back()] / 2 + 1;
arr<std::complex<T>> tdata(util::prod(tshp));
@@ -3954,8 +3753,7 @@ namespace pocketfft
tstride.back() = sizeof(std::complex<T>);
for (size_t i = tstride.size() - 1; i > 0; --i)
tstride[i - 1] = tstride[i] * ptrdiff_t(tshp[i]);
- r2c(shape, stride_in, tstride, axes, true, data_in, tdata.data(), fct,
- nthreads);
+ r2c(shape, stride_in, tstride, axes, true, data_in, tdata.data(), fct, nthreads);
cndarr<cmplx<T>> atmp(tdata.data(), tshp, tstride);
ndarr<T> aout(data_out, shape, stride_out);
simple_iter iin(atmp);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp
index 84d1300c8db..463292d5e31 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fft/rfft.hpp
@@ -15,8 +15,7 @@ namespace numpy
{
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -25,8 +24,7 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -35,28 +33,23 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
return r2c(in_array, n, axis, "", true, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_floating_point<T>::value,
- std::complex<T>>::type,
+ types::ndarray<std::enable_if_t<std::is_floating_point<T>::value, std::complex<T>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
return r2c(in_array, n, axis, norm, true, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::str const &norm)
@@ -66,8 +59,7 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
rfft(types::ndarray<T, pS> const &in_array, types::none_type n, long axis,
types::none_type norm)
@@ -77,22 +69,18 @@ namespace numpy
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::none_type norm)
+ rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::none_type norm)
{
auto tmp_array = _copy_to_double(in_array);
return r2c(tmp_array, n, axis, "", true, false);
}
template <class T, class pS>
- types::ndarray<typename std::enable_if<std::is_integral<T>::value,
- std::complex<double>>::type,
+ types::ndarray<std::enable_if_t<std::is_integral<T>::value, std::complex<double>>,
types::array_tuple<long, std::tuple_size<pS>::value>>
- rfft(types::ndarray<T, pS> const &in_array, long n, long axis,
- types::str const &norm)
+ rfft(types::ndarray<T, pS> const &in_array, long n, long axis, types::str const &norm)
{
auto tmp_array = _copy_to_double(in_array);
return r2c(tmp_array, n, axis, norm, true, false);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp
index dd5bc0889bc..21cc2829a97 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fill_diagonal.hpp
@@ -11,10 +11,9 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- types::none_type fill_diagonal(E &&expr,
- typename std::decay<E>::type::dtype fill_value)
+ types::none_type fill_diagonal(E &&expr, typename std::decay_t<E>::dtype fill_value)
{
- constexpr auto N = std::decay<E>::type::value;
+ constexpr auto N = std::decay_t<E>::value;
types::array_tuple<long, N> indices;
for (long i = 0, n = sutils::min(expr); i < n; ++i) {
std::fill(indices.begin(), indices.end(), i);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp b/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp
index 987a2069006..81e1b86d1eb 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/flatnonzero.hpp
@@ -23,8 +23,7 @@ namespace numpy
void _flatnonzero(I begin, I end, O &out, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _flatnonzero((*begin).begin(), (*begin).end(), out, i,
- utils::int_<N - 1>());
+ _flatnonzero((*begin).begin(), (*begin).end(), out, i, utils::int_<N - 1>());
}
} // namespace
template <class E>
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp b/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp
index 3bcdaf7f198..f4d6cf7f799 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/flip.hpp
@@ -14,8 +14,8 @@ namespace numpy
namespace details
{
template <class E, class S, size_t... I>
- auto flip(E const &expr, S const &slices,
- utils::index_sequence<I...>) -> decltype(expr(slices[I]...))
+ auto flip(E const &expr, S const &slices, std::index_sequence<I...>)
+ -> decltype(expr(slices[I]...))
{
return expr(slices[I]...);
}
@@ -24,11 +24,11 @@ namespace numpy
template <class E>
auto flip(E const &expr, long axis)
-> decltype(details::flip(expr, std::array<types::slice, E::value>{},
- utils::make_index_sequence<E::value>{}))
+ std::make_index_sequence<E::value>{}))
{
std::array<types::slice, E::value> slices;
slices[axis].step = -1;
- return details::flip(expr, slices, utils::make_index_sequence<E::value>{});
+ return details::flip(expr, slices, std::make_index_sequence<E::value>{});
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp
index d19474358fa..484ab65d408 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fliplr.hpp
@@ -11,14 +11,12 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto
- fliplr(E &&expr) -> decltype(std::forward<E>(expr)(
- types::cstride_slice<1>{builtins::None, builtins::None},
- types::slice{builtins::None, builtins::None, -1}))
+ auto fliplr(E &&expr)
+ -> decltype(std::forward<E>(expr)(types::cstride_slice<1>{builtins::None, builtins::None},
+ types::slice{builtins::None, builtins::None, -1}))
{
- return std::forward<E>(expr)(
- types::cstride_slice<1>{builtins::None, builtins::None},
- types::slice{builtins::None, builtins::None, -1});
+ return std::forward<E>(expr)(types::cstride_slice<1>{builtins::None, builtins::None},
+ types::slice{builtins::None, builtins::None, -1});
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp b/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp
index a5a0331f8ad..fa154962587 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/flipud.hpp
@@ -11,12 +11,10 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto
- flipud(E &&expr) -> decltype(std::forward<E>(
- expr)[types::slice{builtins::None, builtins::None, -1}])
+ auto flipud(E &&expr)
+ -> decltype(std::forward<E>(expr)[types::slice{builtins::None, builtins::None, -1}])
{
- return std::forward<E>(
- expr)[types::slice{builtins::None, builtins::None, -1}];
+ return std::forward<E>(expr)[types::slice{builtins::None, builtins::None, -1}];
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/float128.hpp b/contrib/python/pythran/pythran/pythonic/numpy/float128.hpp
index e5c2ea5b552..e56d3d8b851 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/float128.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/float128.hpp
@@ -28,4 +28,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::float128>::convert(numpy::functor::float128 const &c)
+{
+ return (PyObject *)&PyLongDoubleArrType_Type;
+}
+
+inline bool from_python<numpy::functor::float128>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyLongDoubleArrType_Type;
+}
+
+inline numpy::functor::float128 from_python<numpy::functor::float128>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/float32.hpp b/contrib/python/pythran/pythran/pythonic/numpy/float32.hpp
index 04b4a118650..b99a2f7a80c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/float32.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/float32.hpp
@@ -34,4 +34,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::float32>::convert(numpy::functor::float32 const &c)
+{
+ return (PyObject *)&PyFloatArrType_Type;
+}
+
+inline bool from_python<numpy::functor::float32>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyFloatArrType_Type;
+}
+
+inline numpy::functor::float32 from_python<numpy::functor::float32>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/float64.hpp b/contrib/python/pythran/pythran/pythonic/numpy/float64.hpp
index 3c5c179d797..6f12831e3dc 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/float64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/float64.hpp
@@ -33,4 +33,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::float64>::convert(numpy::functor::float64 const &c)
+{
+ return (PyObject *)&PyDoubleArrType_Type;
+}
+
+inline bool from_python<numpy::functor::float64>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyDoubleArrType_Type;
+}
+
+inline numpy::functor::float64 from_python<numpy::functor::float64>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp
index 721101c1b86..ccfd3fccf2e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/float_.hpp
@@ -15,4 +15,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::float_>::convert(numpy::functor::float_ const &c)
+{
+ return (PyObject *)&PyDoubleArrType_Type;
+}
+
+inline bool from_python<numpy::functor::float_>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyDoubleArrType_Type;
+}
+
+inline numpy::functor::float_ from_python<numpy::functor::float_>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp
index 57bf14cd1e1..1fa3d4e75d1 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/frexp.hpp
@@ -13,8 +13,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- typename std::enable_if<std::is_scalar<T>::value, std::tuple<T, int>>::type
- frexp(T val)
+ std::enable_if_t<std::is_scalar<T>::value, std::tuple<T, int>> frexp(T val)
{
int exp;
T significand = std::frexp(val, &exp);
@@ -24,36 +23,31 @@ namespace numpy
namespace
{
template <class E, class F, class G>
- void _frexp(E begin, E end, F significands_iter, G exps_iter,
- utils::int_<1>)
+ void _frexp(E begin, E end, F significands_iter, G exps_iter, utils::int_<1>)
{
for (; begin != end; ++begin, ++significands_iter, ++exps_iter)
*significands_iter = std::frexp(*begin, exps_iter);
}
template <class E, class F, class G, size_t N>
- void _frexp(E begin, E end, F significands_iter, G exps_iter,
- utils::int_<N>)
+ void _frexp(E begin, E end, F significands_iter, G exps_iter, utils::int_<N>)
{
for (; begin != end; ++begin, ++significands_iter, ++exps_iter)
- _frexp((*begin).begin(), (*begin).end(), (*significands_iter).begin(),
- (*exps_iter).begin(), utils::int_<N - 1>());
+ _frexp((*begin).begin(), (*begin).end(), (*significands_iter).begin(), (*exps_iter).begin(),
+ utils::int_<N - 1>());
}
} // namespace
template <class E>
- typename std::enable_if<
- !types::is_dtype<E>::value,
- std::tuple<types::ndarray<typename E::dtype, typename E::shape_t>,
- types::ndarray<int, typename E::shape_t>>>::type
+ std::enable_if_t<!types::is_dtype<E>::value,
+ std::tuple<types::ndarray<typename E::dtype, typename E::shape_t>,
+ types::ndarray<int, typename E::shape_t>>>
frexp(E const &arr)
{
auto arr_shape = sutils::getshape(arr);
- types::ndarray<typename E::dtype, typename E::shape_t> significands(
- arr_shape, builtins::None);
+ types::ndarray<typename E::dtype, typename E::shape_t> significands(arr_shape, builtins::None);
types::ndarray<int, typename E::shape_t> exps(arr_shape, builtins::None);
- _frexp(arr.begin(), arr.end(), significands.begin(), exps.begin(),
- utils::int_<E::value>());
+ _frexp(arr.begin(), arr.end(), significands.begin(), exps.begin(), utils::int_<E::value>());
return std::make_tuple(significands, exps);
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/frombuffer.hpp b/contrib/python/pythran/pythran/pythonic/numpy/frombuffer.hpp
new file mode 100644
index 00000000000..65886858665
--- /dev/null
+++ b/contrib/python/pythran/pythran/pythonic/numpy/frombuffer.hpp
@@ -0,0 +1,33 @@
+#ifndef PYTHONIC_NUMPY_FROMBUFFER_HPP
+#define PYTHONIC_NUMPY_FROMBUFFER_HPP
+
+#include "pythonic/include/numpy/frombuffer.hpp"
+
+#include "pythonic/types/list.hpp"
+#include "pythonic/types/ndarray.hpp"
+#include "pythonic/types/str.hpp"
+#include "pythonic/utils/functor.hpp"
+
+#include <limits>
+#include <sstream>
+
+PYTHONIC_NS_BEGIN
+
+namespace numpy
+{
+ template <class dtype>
+ types::ndarray<typename dtype::type, types::pshape<long>>
+ frombuffer(types::str const &string, dtype d, long count, long offset)
+ {
+ if (count < 0)
+ count = string.size() / sizeof(typename dtype::type);
+ types::pshape<long> shape = count;
+ utils::shared_ref<types::raw_array<typename dtype::type>> buffer(std::get<0>(shape));
+ auto const *tstring = reinterpret_cast<typename dtype::type const *>(string.c_str()) + offset;
+ std::copy(tstring, tstring + std::get<0>(shape), buffer->data);
+ return {buffer, shape};
+ }
+} // namespace numpy
+PYTHONIC_NS_END
+
+#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp
index 771062f49ed..d941bf21c92 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fromfile.hpp
@@ -18,12 +18,10 @@ namespace numpy
{
template <class dtype>
types::ndarray<typename dtype::type, types::pshape<long>>
- fromfile(types::str const &file_name, dtype d, long count,
- types::str const &sep, long offset)
+ fromfile(types::str const &file_name, dtype d, long count, types::str const &sep, long offset)
{
if (sep.size() != 0)
- throw types::NotImplementedError(
- "Sep input is not implemented yet, should be left empty");
+ throw types::NotImplementedError("Sep input is not implemented yet, should be left empty");
std::fstream fs;
fs.open(file_name.c_str(), std::fstream::in | std::fstream::binary);
if (fs.rdstate() != std::fstream::goodbit) {
@@ -40,8 +38,8 @@ namespace numpy
count = maxCount;
}
- types::ndarray<typename dtype::type, types::pshape<long>> res(
- types::pshape<long>{count}, types::none_type{});
+ types::ndarray<typename dtype::type, types::pshape<long>> res(types::pshape<long>{count},
+ types::none_type{});
fs.read((char *)res.buffer, sizeof(typename dtype::type) * count);
return res;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp
index 857ecf35cce..46327dbbde2 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fromfunction.hpp
@@ -17,17 +17,11 @@ namespace numpy
template <class F, class dtype, class purity_tag>
template <class pS>
- types::ndarray<typename std::remove_cv<typename std::remove_reference<
- typename std::result_of<F(dtype)>::type>::type>::type,
- pS>
- fromfunction_helper<F, 1, dtype, purity_tag>::operator()(F &&f,
- pS const &shape,
- dtype d)
+ types::ndarray<std::remove_cv_t<std::remove_reference_t<std::result_of_t<F(dtype)>>>, pS>
+ fromfunction_helper<F, 1, dtype, purity_tag>::operator()(F &&f, pS const &shape, dtype d)
{
- types::ndarray<typename std::remove_cv<typename std::remove_reference<
- typename std::result_of<F(dtype)>::type>::type>::type,
- pS>
- out(shape, builtins::None);
+ types::ndarray<std::remove_cv_t<std::remove_reference_t<std::result_of_t<F(dtype)>>>, pS> out(
+ shape, builtins::None);
long n = out.template shape<0>();
for (long i = 0; i < n; ++i)
out[i] = f(i);
@@ -36,18 +30,10 @@ namespace numpy
template <class F, class dtype, class purity_tag>
template <class pS>
- types::ndarray<
- typename std::remove_cv<typename std::remove_reference<
- typename std::result_of<F(dtype, dtype)>::type>::type>::type,
- pS>
- fromfunction_helper<F, 2, dtype, purity_tag>::operator()(F &&f,
- pS const &shape,
- dtype d)
+ types::ndarray<std::remove_cv_t<std::remove_reference_t<std::result_of_t<F(dtype, dtype)>>>, pS>
+ fromfunction_helper<F, 2, dtype, purity_tag>::operator()(F &&f, pS const &shape, dtype d)
{
- types::ndarray<
- typename std::remove_cv<typename std::remove_reference<
- typename std::result_of<F(dtype, dtype)>::type>::type>::type,
- pS>
+ types::ndarray<std::remove_cv_t<std::remove_reference_t<std::result_of_t<F(dtype, dtype)>>>, pS>
out(shape, builtins::None);
long n = out.template shape<0>();
long m = out.template shape<1>();
@@ -60,12 +46,11 @@ namespace numpy
template <class F, class pS, class dtype>
auto fromfunction(F &&f, pS const &shape, dtype d)
-> decltype(fromfunction_helper<F, std::tuple_size<pS>::value, dtype,
- typename pythonic::purity_of<F>::type>()(
- std::forward<F>(f), shape))
+ typename pythonic::purity_of<F>::type>()(std::forward<F>(f),
+ shape))
{
return fromfunction_helper<F, std::tuple_size<pS>::value, dtype,
- typename pythonic::purity_of<F>::type>()(
- std::forward<F>(f), shape);
+ typename pythonic::purity_of<F>::type>()(std::forward<F>(f), shape);
}
/* TODO: must specialize for higher order */
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp
index 7bbe112370c..9e03102ae22 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fromiter.hpp
@@ -11,13 +11,11 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class Iterable, class dtype>
- types::ndarray<typename std::remove_cv<typename std::remove_reference<
- Iterable>::type>::type::value_type,
+ types::ndarray<typename std::remove_cv_t<std::remove_reference_t<Iterable>>::value_type,
types::pshape<long>>
fromiter(Iterable &&iterable, dtype d, long count)
{
- using T = typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type::value_type;
+ using T = typename std::remove_cv_t<std::remove_reference_t<Iterable>>::value_type;
if (count < 0) {
types::list<T> buffer(0);
std::copy(iterable.begin(), iterable.end(), std::back_inserter(buffer));
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp b/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp
index d744824deb9..09dbd6cfaf0 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/fromstring.hpp
@@ -17,8 +17,7 @@ namespace numpy
{
template <class dtype>
types::ndarray<typename dtype::type, types::pshape<long>>
- fromstring(types::str const &string, dtype d, long count,
- types::str const &sep)
+ fromstring(types::str const &string, dtype d, long count, types::kwonly, types::str const &sep)
{
if (sep) {
types::list<typename dtype::type> res(0);
@@ -42,10 +41,8 @@ namespace numpy
if (count < 0)
count = string.size();
types::pshape<long> shape = count;
- utils::shared_ref<types::raw_array<typename dtype::type>> buffer(
- std::get<0>(shape));
- auto const *tstring =
- reinterpret_cast<typename dtype::type const *>(string.c_str());
+ utils::shared_ref<types::raw_array<typename dtype::type>> buffer(std::get<0>(shape));
+ auto const *tstring = reinterpret_cast<typename dtype::type const *>(string.c_str());
std::copy(tstring, tstring + std::get<0>(shape), buffer->data);
return {buffer, shape};
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/full.hpp b/contrib/python/pythran/pythran/pythonic/numpy/full.hpp
index cca07499544..b70ae9d7cae 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/full.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/full.hpp
@@ -12,38 +12,33 @@ namespace numpy
{
template <class pS, class F, class dtype>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- full(pS const &shape, F fill_value, dtype d)
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> full(pS const &shape, F fill_value,
+ dtype d)
{
return {(sutils::shape_t<pS>)shape, typename dtype::type(fill_value)};
}
template <class F, class dtype>
- types::ndarray<typename dtype::type, types::pshape<long>>
- full(long size, F fill_value, dtype d)
+ types::ndarray<typename dtype::type, types::pshape<long>> full(long size, F fill_value, dtype d)
{
return full(types::pshape<long>(size), fill_value, d);
}
template <long N, class F, class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
full(std::integral_constant<long, N>, F fill_value, dtype d)
{
- return full(types::pshape<std::integral_constant<long, N>>({}), fill_value,
- d);
+ return full(types::pshape<std::integral_constant<long, N>>({}), fill_value, d);
}
template <class pS, class F>
- types::ndarray<F, sutils::shape_t<pS>> full(pS const &shape, F fill_value,
- types::none_type)
+ types::ndarray<F, sutils::shape_t<pS>> full(pS const &shape, F fill_value, types::none_type)
{
return {(sutils::shape_t<pS>)shape, fill_value};
}
template <class F>
- types::ndarray<F, types::pshape<long>> full(long size, F fill_value,
- types::none_type nt)
+ types::ndarray<F, types::pshape<long>> full(long size, F fill_value, types::none_type nt)
{
return full(types::pshape<long>(size), fill_value, nt);
}
@@ -52,8 +47,7 @@ namespace numpy
types::ndarray<F, types::pshape<std::integral_constant<long, N>>>
full(std::integral_constant<long, N>, F fill_value, types::none_type nt)
{
- return full(types::pshape<std::integral_constant<long, N>>({}), fill_value,
- nt);
+ return full(types::pshape<std::integral_constant<long, N>>({}), fill_value, nt);
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp
index 721893baa4f..4ee5c279612 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/full_like.hpp
@@ -20,11 +20,9 @@ namespace numpy
template <class E, class F>
auto full_like(E const &expr, F fill_value, types::none_type)
- -> decltype(full(sutils::getshape(expr), fill_value,
- types::dtype_t<typename E::dtype>()))
+ -> decltype(full(sutils::getshape(expr), fill_value, types::dtype_t<typename E::dtype>()))
{
- return full(sutils::getshape(expr), fill_value,
- types::dtype_t<typename E::dtype>());
+ return full(sutils::getshape(expr), fill_value, types::dtype_t<typename E::dtype>());
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp b/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp
index de2e6f69372..6b4a55bf922 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/hstack.hpp
@@ -10,12 +10,10 @@ namespace numpy
{
template <class ArraySequence>
- auto hstack(ArraySequence &&seq)
- -> decltype(concatenate(std::forward<ArraySequence>(seq), 1))
+ auto hstack(ArraySequence &&seq) -> decltype(concatenate(std::forward<ArraySequence>(seq), 1))
{
auto constexpr concatenate_axis =
- (decltype(concatenate(std::forward<ArraySequence>(seq), 1))::value !=
- 1);
+ (decltype(concatenate(std::forward<ArraySequence>(seq), 1))::value != 1);
return concatenate(std::forward<ArraySequence>(seq), concatenate_axis);
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp b/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp
index d974c4c7cde..14b729bf9d9 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/imag.hpp
@@ -13,15 +13,13 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto imag(E &&expr) -> decltype(builtins::getattr(types::attr::IMAG{},
- std::forward<E>(expr)))
+ auto imag(E &&expr) -> decltype(builtins::getattr(types::attr::IMAG{}, std::forward<E>(expr)))
{
return builtins::getattr(types::attr::IMAG{}, std::forward<E>(expr));
}
template <class T>
- auto imag(types::list<T> const &expr)
- -> decltype(imag(numpy::functor::asarray{}(expr)))
+ auto imag(types::list<T> const &expr) -> decltype(imag(numpy::functor::asarray{}(expr)))
{
return imag(numpy::functor::asarray{}(expr));
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp b/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp
index d22b05549a2..5b2768fe511 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/indices.hpp
@@ -11,17 +11,14 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class pS, class dtype>
- types::ndarray<
- typename dtype::type,
- sutils::push_front_t<
- pS, std::integral_constant<long, std::tuple_size<pS>::value>>>
+ types::ndarray<typename dtype::type,
+ sutils::push_front_t<pS, std::integral_constant<long, std::tuple_size<pS>::value>>>
indices(pS const &shape, dtype)
{
auto constexpr N = std::tuple_size<pS>::value;
sutils::push_front_t<pS, std::integral_constant<long, N>> oshape;
- sutils::scopy_shape<1, -1>(oshape, shape, utils::make_index_sequence<N>());
- types::ndarray<typename dtype::type,
- sutils::push_front_t<pS, std::integral_constant<long, N>>>
+ sutils::scopy_shape<1, -1>(oshape, shape, std::make_index_sequence<N>());
+ types::ndarray<typename dtype::type, sutils::push_front_t<pS, std::integral_constant<long, N>>>
out(oshape, builtins::None);
typename dtype::type *iters[N];
for (size_t n = 0; n < N; ++n)
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp b/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp
index 8b71eda74db..ac46214fd57 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/insert.hpp
@@ -16,15 +16,12 @@ namespace numpy
{
template <class T, class pS, class I, class F>
- typename std::enable_if<types::is_iterable<I>::value &&
- types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
- insert(types::ndarray<T, pS> in, I const &indices, F const &data,
- types::none_type axis)
+ std::enable_if_t<types::is_iterable<I>::value && types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
+ insert(types::ndarray<T, pS> in, I const &indices, F const &data, types::none_type axis)
{
types::ndarray<T, types::pshape<long>> out(
- types::pshape<long>(long(
- in.flat_size() + std::min(indices.flat_size(), data.flat_size()))),
+ types::pshape<long>(long(in.flat_size() + std::min(indices.flat_size(), data.flat_size()))),
builtins::None);
auto out_iter = out.fbegin();
auto in_iter = in.fbegin();
@@ -39,31 +36,25 @@ namespace numpy
}
template <class T, class pS, class I, class F>
- typename std::enable_if<types::is_iterable<I>::value &&
- !types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
- insert(types::ndarray<T, pS> in, I const &indices, F const &data,
- types::none_type axis)
+ std::enable_if_t<types::is_iterable<I>::value && !types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
+ insert(types::ndarray<T, pS> in, I const &indices, F const &data, types::none_type axis)
{
return insert(in, indices, types::list<F>({data}), axis);
}
template <class T, class pS, class I, class F>
- typename std::enable_if<!types::is_iterable<I>::value &&
- types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
- insert(types::ndarray<T, pS> in, I const &indices, F const &data,
- types::none_type axis)
+ std::enable_if_t<!types::is_iterable<I>::value && types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
+ insert(types::ndarray<T, pS> in, I const &indices, F const &data, types::none_type axis)
{
return insert(in, types::list<I>({indices}), {data}, axis);
}
template <class T, class pS, class I, class F>
- typename std::enable_if<!types::is_iterable<I>::value &&
- !types::is_iterable<F>::value,
- types::ndarray<T, types::pshape<long>>>::type
- insert(types::ndarray<T, pS> in, I const &indices, F const &data,
- types::none_type axis)
+ std::enable_if_t<!types::is_iterable<I>::value && !types::is_iterable<F>::value,
+ types::ndarray<T, types::pshape<long>>>
+ insert(types::ndarray<T, pS> in, I const &indices, F const &data, types::none_type axis)
{
return insert(in, types::list<I>({indices}), types::list<F>({data}), axis);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/int16.hpp b/contrib/python/pythran/pythran/pythonic/numpy/int16.hpp
index 8da42923c6b..37a44901235 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/int16.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/int16.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::int16>::convert(numpy::functor::int16 const &c)
+{
+ return (PyObject *)&PyInt16ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::int16>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyInt16ArrType_Type;
+}
+
+inline numpy::functor::int16 from_python<numpy::functor::int16>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/int32.hpp b/contrib/python/pythran/pythran/pythonic/numpy/int32.hpp
index 463fcbe2ca8..48830d3a7e1 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/int32.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/int32.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::int32>::convert(numpy::functor::int32 const &c)
+{
+ return (PyObject *)&PyInt32ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::int32>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyInt32ArrType_Type;
+}
+
+inline numpy::functor::int32 from_python<numpy::functor::int32>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/int64.hpp b/contrib/python/pythran/pythran/pythonic/numpy/int64.hpp
index 2fd941f10b6..38c3342d683 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/int64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/int64.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::int64>::convert(numpy::functor::int64 const &c)
+{
+ return (PyObject *)&PyInt64ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::int64>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyInt64ArrType_Type;
+}
+
+inline numpy::functor::int64 from_python<numpy::functor::int64>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/int8.hpp b/contrib/python/pythran/pythran/pythonic/numpy/int8.hpp
index af22837c712..a6588673e88 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/int8.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/int8.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::int8>::convert(numpy::functor::int8 const &c)
+{
+ return (PyObject *)&PyInt8ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::int8>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyInt8ArrType_Type;
+}
+
+inline numpy::functor::int8 from_python<numpy::functor::int8>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/int_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/int_.hpp
index 6c336194f6c..5a87779114c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/int_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/int_.hpp
@@ -34,4 +34,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::int_>::convert(numpy::functor::int_ const &c)
+{
+ return (PyObject *)&PyLong_Type;
+}
+
+inline bool from_python<numpy::functor::int_>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyLong_Type || obj == (PyObject *)&PyLongArrType_Type;
+}
+
+inline numpy::functor::int_ from_python<numpy::functor::int_>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/intc.hpp b/contrib/python/pythran/pythran/pythonic/numpy/intc.hpp
index f47b6d8879c..7ef96eb5831 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/intc.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/intc.hpp
@@ -33,5 +33,35 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::intc>::convert(numpy::functor::intc const &c)
+{
+ if (sizeof(int) == 4)
+ return (PyObject *)&PyInt32ArrType_Type;
+ else
+ return (PyObject *)&PyInt64ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::intc>::is_convertible(PyObject *obj)
+{
+ if (sizeof(int) == 4)
+ return obj == (PyObject *)&PyInt32ArrType_Type;
+ else
+ return obj == (PyObject *)&PyInt64ArrType_Type;
+}
+
+inline numpy::functor::intc from_python<numpy::functor::intc>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/interp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/interp.hpp
index 3b0993a3410..4d12b59f2f3 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/interp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/interp.hpp
@@ -21,8 +21,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T1, class T2, class T3, typename t1, typename t2, typename t3>
- types::ndarray<interp_out_type<T3>, types::pshape<long>>
- interp(T1 x, T2 xp, T3 fp, t1 _left, t2 _right, t3 _period)
+ types::ndarray<interp_out_type<T3>, types::pshape<long>> interp(T1 x, T2 xp, T3 fp, t1 _left,
+ t2 _right, t3 _period)
{
interp_out_type<T3> left = _left;
interp_out_type<T3> right = _right;
@@ -32,8 +32,8 @@ namespace numpy
assert(xp.template shape<0>() == fp.template shape<0>());
interp_out_type<T3> outVal(0);
- types::ndarray<interp_out_type<T3>, types::pshape<long>> out = {
- (long)(x.template shape<0>()), outVal};
+ types::ndarray<interp_out_type<T3>, types::pshape<long>> out = {(long)(x.template shape<0>()),
+ outVal};
if (period) {
auto x_rem = pythonic::numpy::functor::remainder{}(x, period);
@@ -42,21 +42,17 @@ namespace numpy
auto xp_sorted = xp_rem[idx];
auto fp_sorted = fp[idx];
- auto left_pad_xp =
- types::ndarray<typename T2::dtype, types::pshape<long>>(
- types::pshape<long>(1), xp_sorted[-1] - period);
- auto right_pad_xp =
- types::ndarray<typename T2::dtype, types::pshape<long>>(
- types::pshape<long>(1), xp_sorted[0] + period);
+ auto left_pad_xp = types::ndarray<typename T2::dtype, types::pshape<long>>(
+ types::pshape<long>(1), xp_sorted[-1] - period);
+ auto right_pad_xp = types::ndarray<typename T2::dtype, types::pshape<long>>(
+ types::pshape<long>(1), xp_sorted[0] + period);
auto new_xp = pythonic::numpy::functor::concatenate{}(
pythonic::types::make_tuple(left_pad_xp, xp_sorted, right_pad_xp));
- auto left_pad_fp =
- types::ndarray<interp_out_type<T3>, types::pshape<long>>(
- types::pshape<long>(1), fp_sorted[-1]);
- auto right_pad_fp =
- types::ndarray<interp_out_type<T3>, types::pshape<long>>(
- types::pshape<long>(1), fp_sorted[0]);
+ auto left_pad_fp = types::ndarray<interp_out_type<T3>, types::pshape<long>>(
+ types::pshape<long>(1), fp_sorted[-1]);
+ auto right_pad_fp = types::ndarray<interp_out_type<T3>, types::pshape<long>>(
+ types::pshape<long>(1), fp_sorted[0]);
auto new_fp = pythonic::numpy::functor::concatenate{}(
pythonic::types::make_tuple(left_pad_fp, fp_sorted, right_pad_fp));
@@ -74,11 +70,9 @@ namespace numpy
// No parameter specified
template <class T1, class T2, class T3>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right,
- types::none_type period)
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right, types::none_type period)
{
auto _left = fp[0];
auto _right = fp[-1];
@@ -87,33 +81,27 @@ namespace numpy
// left specified
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
- interp(T1 x, T2 xp, T3 fp, t1 left, types::none_type right,
- types::none_type period)
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
+ interp(T1 x, T2 xp, T3 fp, t1 left, types::none_type right, types::none_type period)
{
auto _right = fp[-1];
return interp(x, xp, fp, left, _right, 0.);
}
// right specified
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, t1 right,
- types::none_type period)
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, t1 right, types::none_type period)
{
auto _left = fp[0];
return interp(x, xp, fp, _left, right, 0.);
}
// period specified
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right,
- t1 period)
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right, t1 period)
{
assert(period != 0);
return interp(x, xp, fp, 0., 0., period);
@@ -121,9 +109,8 @@ namespace numpy
// left and right specified
template <class T1, class T2, class T3, typename t1, typename t2>
- typename std::enable_if<
- !std::is_arithmetic<T1>::value,
- types::ndarray<interp_out_type<T3>, types::pshape<long>>>::type
+ std::enable_if_t<!std::is_arithmetic<T1>::value,
+ types::ndarray<interp_out_type<T3>, types::pshape<long>>>
interp(T1 x, T2 xp, T3 fp, t1 left, t2 right, types::none_type period)
{
return interp(x, xp, fp, left, right, 0.);
@@ -131,63 +118,49 @@ namespace numpy
// No parameter specified
template <class T1, class T2, class T3>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right,
- types::none_type period)
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right, types::none_type period)
{
auto _left = fp[0];
auto _right = fp[-1];
- auto temp_array =
- types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
+ auto temp_array = types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
return interp(temp_array, xp, fp, _left, _right, 0.)[0];
}
// left specified
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
- interp(T1 x, T2 xp, T3 fp, t1 left, types::none_type right,
- types::none_type period)
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
+ interp(T1 x, T2 xp, T3 fp, t1 left, types::none_type right, types::none_type period)
{
auto _right = fp[-1];
- auto temp_array =
- types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
+ auto temp_array = types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
return interp(temp_array, xp, fp, left, _right, 0.)[0];
}
// right specified
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, t1 right,
- types::none_type period)
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, t1 right, types::none_type period)
{
auto _left = fp[0];
- auto temp_array =
- types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
+ auto temp_array = types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
return interp(temp_array, xp, fp, _left, right, 0.)[0];
}
// period specified
template <class T1, class T2, class T3, typename t1>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
- interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right,
- t1 period)
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
+ interp(T1 x, T2 xp, T3 fp, types::none_type left, types::none_type right, t1 period)
{
assert(period != 0);
- auto temp_array =
- types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
+ auto temp_array = types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
return interp(temp_array, xp, fp, 0., 0., period)[0];
}
// left and right specified,
template <class T1, class T2, class T3, typename t1, typename t2>
- typename std::enable_if<std::is_arithmetic<T1>::value,
- interp_out_type<T3>>::type
+ std::enable_if_t<std::is_arithmetic<T1>::value, interp_out_type<T3>>
interp(T1 x, T2 xp, T3 fp, t1 left, t2 right, types::none_type period)
{
- auto temp_array =
- types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
+ auto temp_array = types::ndarray<double, types::pshape<long>>(types::pshape<long>(1), x);
return interp(temp_array, xp, fp, left, right, 0.)[0];
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/interp_core.hpp b/contrib/python/pythran/pythran/pythonic/numpy/interp_core.hpp
index 93da77f9990..9a1048099c5 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/interp_core.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/interp_core.hpp
@@ -28,8 +28,8 @@
PYTHONIC_NS_BEGIN
template <typename npy_intp, typename npy_double, class T>
-static npy_intp binary_search_with_guess(const npy_double key, const T &arr,
- npy_intp len, npy_intp guess)
+static npy_intp binary_search_with_guess(const npy_double key, const T &arr, npy_intp len,
+ npy_intp guess)
{
npy_intp imin = 0;
npy_intp imax = len;
@@ -65,8 +65,7 @@ static npy_intp binary_search_with_guess(const npy_double key, const T &arr,
if (key < arr[guess - 1]) {
imax = guess - 1;
/* last attempt to restrict search to items in cache */
- if (guess > LIKELY_IN_CACHE_SIZE &&
- key >= arr[guess - LIKELY_IN_CACHE_SIZE]) {
+ if (guess > LIKELY_IN_CACHE_SIZE && key >= arr[guess - LIKELY_IN_CACHE_SIZE]) {
imin = guess - LIKELY_IN_CACHE_SIZE;
}
} else {
@@ -85,8 +84,7 @@ static npy_intp binary_search_with_guess(const npy_double key, const T &arr,
/* key >= arr[guess + 2] */
imin = guess + 2;
/* last attempt to restrict search to items in cache */
- if (guess < len - LIKELY_IN_CACHE_SIZE - 1 &&
- key < arr[guess + LIKELY_IN_CACHE_SIZE]) {
+ if (guess < len - LIKELY_IN_CACHE_SIZE - 1 && key < arr[guess + LIKELY_IN_CACHE_SIZE]) {
imax = guess + LIKELY_IN_CACHE_SIZE;
}
}
@@ -187,13 +185,11 @@ static npy_intp binary_search_with_guess(const npy_double key, const T &arr,
// This is the output type, based on the type of T, which can be complex.
template <class T>
using out_type =
- typename std::conditional<types::is_complex<typename T::dtype>::value,
- std::complex<double>, double>::type;
+ std::conditional_t<types::is_complex<typename T::dtype>::value, std::complex<double>, double>;
-template <typename npy_intp, typename T5, class T1, class T2, class T3,
- class T4>
-void do_interp(const T1 &dz, const T2 &dx, const T3 &dy, T4 &dres,
- npy_intp lenxp, npy_intp lenx, T5 lval, T5 rval)
+template <typename npy_intp, typename T5, class T1, class T2, class T3, class T4>
+void do_interp(const T1 &dz, const T2 &dx, const T3 &dy, T4 &dres, npy_intp lenxp, npy_intp lenx,
+ T5 lval, T5 rval)
{
npy_intp i;
out_type<T3> *slopes = NULL;
@@ -246,8 +242,7 @@ void do_interp(const T1 &dz, const T2 &dx, const T3 &dy, T4 &dres,
dres[i] = dy[j];
} else {
const out_type<T3> slope =
- (slopes != NULL) ? slopes[j]
- : (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]);
+ (slopes != NULL) ? slopes[j] : (dy[j + 1] - dy[j]) / (dx[j + 1] - dx[j]);
dres[i] = slope * (x_val - dx[j]) + dy[j];
}
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/intersect1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/intersect1d.hpp
index ca9f974dfd6..0e4e67ffda7 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/intersect1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/intersect1d.hpp
@@ -17,9 +17,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E, class F>
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>
intersect1d(E const &e, F const &f)
{
using T = typename __combined<typename E::dtype, typename F::dtype>::type;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp
index c48e0006208..3e721e59829 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/isclose.hpp
@@ -16,8 +16,7 @@ namespace numpy
namespace wrapper
{
template <class T0, class T1>
- bool isclose(T0 const &u, T1 const &v, double rtol, double atol,
- bool equal_nan)
+ bool isclose(T0 const &u, T1 const &v, double rtol, double atol, bool equal_nan)
{
if (functor::isfinite()(u) && functor::isfinite()(v))
return functor::abs()(u - v) <= (atol + rtol * functor::abs()(v));
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp b/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp
index b2b529b73fc..65d4f29886c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/iscomplex.hpp
@@ -16,15 +16,13 @@ namespace numpy
namespace wrapper
{
template <class I>
- typename std::enable_if<types::is_complex<I>::value, bool>::type
- iscomplex(I const &a)
+ std::enable_if_t<types::is_complex<I>::value, bool> iscomplex(I const &a)
{
return a.imag() != 0.;
}
template <class I>
- constexpr typename std::enable_if<!types::is_complex<I>::value, bool>::type
- iscomplex(I const &a)
+ constexpr std::enable_if_t<!types::is_complex<I>::value, bool> iscomplex(I const &a)
{
return false;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp
index a946eeeee74..53ddf613b52 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/isnan.hpp
@@ -20,19 +20,14 @@ namespace numpy
}
template <class T>
- auto isnan(T const &v) ->
- typename std::enable_if<
- std::is_floating_point<typename std::decay<T>::type>::value,
- bool>::type
+ auto isnan(T const &v) -> std::enable_if_t<std::is_floating_point<std::decay_t<T>>::value, bool>
{
return std::isnan(v);
}
template <class T>
- auto isnan(T const &v) ->
- typename std::enable_if<
- !std::is_floating_point<typename std::decay<T>::type>::value,
- bool>::type
+ auto isnan(T const &v)
+ -> std::enable_if_t<!std::is_floating_point<std::decay_t<T>>::value, bool>
{
return false;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp
index 134fdc307d4..58be012e421 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/isreal.hpp
@@ -16,15 +16,13 @@ namespace numpy
namespace wrapper
{
template <class I>
- typename std::enable_if<types::is_complex<I>::value, bool>::type
- isreal(I const &a)
+ std::enable_if_t<types::is_complex<I>::value, bool> isreal(I const &a)
{
return a.imag() == 0.;
}
template <class I>
- typename std::enable_if<!types::is_complex<I>::value, bool>::type
- isreal(I const &a)
+ std::enable_if_t<!types::is_complex<I>::value, bool> isreal(I const &a)
{
return true;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp b/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp
index 45fdedec58b..0fdb4565d25 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/issctype.hpp
@@ -10,19 +10,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- constexpr auto issctype(E const &expr) ->
- typename std::enable_if<!types::is_dtype<E>::value &&
- !std::is_same<E, types::str>::value,
- bool>::type
+ constexpr auto issctype(E const &expr)
+ -> std::enable_if_t<!types::is_dtype<E>::value && !std::is_same<E, types::str>::value, bool>
{
return isscalar(typename E::type());
}
template <class E>
- constexpr auto issctype(E const &expr) ->
- typename std::enable_if<types::is_dtype<E>::value ||
- std::is_same<E, types::str>::value,
- bool>::type
+ constexpr auto issctype(E const &expr)
+ -> std::enable_if_t<types::is_dtype<E>::value || std::is_same<E, types::str>::value, bool>
{
return false;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp
index c8b1afa04bf..2acc4b13cfe 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/lexsort.hpp
@@ -54,8 +54,7 @@ namespace numpy
types::ndarray<long, types::pshape<long>> lexsort(pS const &keys)
{
long n = std::get<0>(keys).size();
- types::ndarray<long, types::pshape<long>> out(types::pshape<long>(n),
- builtins::None);
+ types::ndarray<long, types::pshape<long>> out(types::pshape<long>(n), builtins::None);
// fill with the original indices
std::iota(out.buffer, out.buffer + n, 0L);
// then sort using keys as the comparator
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp b/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp
index 7d873ab274c..c2c2cc0564c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/linalg/matrix_power.hpp
@@ -43,8 +43,7 @@ namespace numpy
} // namespace details
template <class E>
- auto matrix_power(E const &expr,
- long n) -> decltype(numpy::functor::array{}(expr))
+ auto matrix_power(E const &expr, long n) -> decltype(numpy::functor::array{}(expr))
{
if (n == 0)
return numpy::functor::identity{}(expr.template shape<0>(),
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp b/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp
index 1f24579776e..dcf6ef763d0 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/linalg/norm.hpp
@@ -20,28 +20,23 @@ namespace numpy
{
template <class Array>
auto norm(Array &&array, types::none_type ord, types::none_type axis)
- -> decltype(pythonic::numpy::functor::sqrt{}(
- pythonic::numpy::functor::sum{}(
- pythonic::builtins::pythran::functor::abssqr{}(
- std::forward<Array>(array)))))
+ -> decltype(pythonic::numpy::functor::sqrt{}(pythonic::numpy::functor::sum{}(
+ pythonic::builtins::pythran::functor::abssqr{}(std::forward<Array>(array)))))
{
return pythonic::numpy::functor::sqrt{}(pythonic::numpy::functor::sum{}(
- pythonic::builtins::pythran::functor::abssqr{}(
- std::forward<Array>(array))));
+ pythonic::builtins::pythran::functor::abssqr{}(std::forward<Array>(array))));
}
template <class Array>
norm_t<Array> norm(Array &&x, double ord, types::none_type)
{
- switch (std::decay<Array>::type::value) {
+ switch (std::decay_t<Array>::value) {
case 1:
return norm(std::forward<Array>(x), ord, 0L);
case 2:
- return norm(std::forward<Array>(x), ord,
- types::array_tuple<long, 2>{{0L, 1L}});
+ return norm(std::forward<Array>(x), ord, types::array_tuple<long, 2>{{0L, 1L}});
default:
- throw pythonic::builtins::NotImplementedError(
- "Invalid norm order for matrices.");
+ throw pythonic::builtins::NotImplementedError("Invalid norm order for matrices.");
}
}
@@ -50,27 +45,20 @@ namespace numpy
{
auto &&y = pythonic::numpy::functor::asfarray{}(x);
if (ord == inf)
- return pythonic::numpy::functor::max{}(
- pythonic::numpy::functor::abs{}(y), axis);
+ return pythonic::numpy::functor::max{}(pythonic::numpy::functor::abs{}(y), axis);
else if (ord == -inf)
- return pythonic::numpy::functor::min{}(
- pythonic::numpy::functor::abs{}(y), axis);
+ return pythonic::numpy::functor::min{}(pythonic::numpy::functor::abs{}(y), axis);
else if (ord == 0.)
return pythonic::numpy::functor::sum{}(y != 0., axis);
else if (ord == 1.)
- return pythonic::numpy::functor::sum{}(
- pythonic::numpy::functor::abs{}(y), axis);
+ return pythonic::numpy::functor::sum{}(pythonic::numpy::functor::abs{}(y), axis);
else if (ord == 2.)
return pythonic::numpy::functor::sqrt{}(pythonic::numpy::functor::sum{}(
- pythonic::numpy::functor::real{}(
- pythonic::numpy::functor::conj{}(y)*y),
- axis));
+ pythonic::numpy::functor::real{}(pythonic::numpy::functor::conj{}(y)*y), axis));
else {
return pythonic::numpy::functor::power{}(
pythonic::numpy::functor::sum{}(
- pythonic::numpy::functor::power{}(
- pythonic::numpy::functor::abs{}(y), ord),
- axis),
+ pythonic::numpy::functor::power{}(pythonic::numpy::functor::abs{}(y), ord), axis),
1. / ord);
}
}
@@ -85,8 +73,7 @@ namespace numpy
return norm(std::forward<Array>(x), ord, axis[0]);
}
template <class Array>
- norm_t<Array> norm(Array &&array, double ord,
- types::array_tuple<long, 2> axis)
+ norm_t<Array> norm(Array &&array, double ord, types::array_tuple<long, 2> axis)
{
throw pythonic::builtins::NotImplementedError("We need more dev!");
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp
index 9ee28f1276b..a832aab9bea 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/linspace.hpp
@@ -12,11 +12,16 @@ namespace numpy
{
template <class dtype>
types::ndarray<typename dtype::type, types::pshape<long>>
- linspace(double start, double stop, long num, bool endpoint, bool retstep,
- dtype d)
+ linspace(double start, double stop, long num, bool endpoint, bool retstep, dtype d)
{
assert(!retstep && "retstep not supported");
- double step = (stop - start) / (num - (endpoint ? 1 : 0));
+ if (num <= 1)
+ endpoint = 0;
+ double step = 1.;
+ if (stop == start || num == 0) // Special case, return [start] if num>0 and [] if num=0
+ stop = start + ((num > 0) ? 1 : 0);
+ else
+ step = (stop - start) / (num - (endpoint ? 1 : 0));
if (std::is_integral<typename dtype::type>::value)
return asarray(arange(start, stop + (endpoint ? step * .5 : 0), step), d);
else
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp
index b776d5e01ac..733dc3a040a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/logaddexp2.hpp
@@ -19,11 +19,9 @@ namespace numpy
{
template <class T0, class T1>
auto logaddexp2(T0 const &t0, T1 const &t1)
- -> decltype(functor::log2{}(functor::power{}(T0(2), t0) +
- functor::power{}(T1(2), t1)))
+ -> decltype(functor::log2{}(functor::power{}(T0(2), t0) + functor::power{}(T1(2), t1)))
{
- return functor::log2{}(functor::power{}(T0(2), t0) +
- functor::power{}(T1(2), t1));
+ return functor::log2{}(functor::power{}(T0(2), t0) + functor::power{}(T1(2), t1));
}
} // namespace wrapper
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp
index 6758609df34..0223fe8f452 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/logical_xor.hpp
@@ -15,8 +15,7 @@ namespace numpy
namespace wrapper
{
template <class T0, class T1>
- auto logical_xor(T0 const &t0,
- T1 const &t1) -> decltype((t0 && !t1) || (t1 && !t0))
+ auto logical_xor(T0 const &t0, T1 const &t1) -> decltype((t0 && !t1) || (t1 && !t0))
{
return (t0 && !t1) || (t1 && !t0);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp
index 8f33b1c38fa..50cba931575 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/logspace.hpp
@@ -11,11 +11,9 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
auto logspace(double start, double stop, long num, bool endpoint, double base)
- -> decltype(functor::power()(base, functor::linspace()(start, stop, num,
- endpoint)))
+ -> decltype(functor::power()(base, functor::linspace()(start, stop, num, endpoint)))
{
- return functor::power()(base,
- functor::linspace()(start, stop, num, endpoint));
+ return functor::power()(base, functor::linspace()(start, stop, num, endpoint));
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp b/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp
index a4266b7633b..b9ec64283ba 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/mean.hpp
@@ -16,19 +16,16 @@ namespace numpy
template <class E, class dtype>
auto mean(E const &expr, types::none_type axis, dtype d, types::none_type out,
types::false_immediate keepdims)
- -> decltype(sum(expr, axis, d) /
- details::dtype_or_double<dtype>(expr.flat_size()))
+ -> decltype(sum(expr, axis, d) / details::dtype_or_double<dtype>(expr.flat_size()))
{
- return sum(expr, axis, d) /
- details::dtype_or_double<dtype>(expr.flat_size());
+ return sum(expr, axis, d) / details::dtype_or_double<dtype>(expr.flat_size());
}
template <class E, class dtype>
auto mean(E const &expr, long axis, dtype d, types::none_type out,
types::false_immediate keepdims) -> decltype(sum(expr, axis, d))
{
- return sum(expr, axis, d) /=
- details::dtype_or_double<dtype>(sutils::getshape(expr)[axis]);
+ return sum(expr, axis, d) /= details::dtype_or_double<dtype>(sutils::getshape(expr)[axis]);
}
template <class E, class dtype>
@@ -37,13 +34,11 @@ namespace numpy
mean(E const &expr, types::none_type axis, dtype d, types::none_type out,
types::true_immediate keep_dims)
{
- return {typename details::make_scalar_pshape<E::value>::type(),
- mean(expr, axis, d, out)};
+ return {typename details::make_scalar_pshape<E::value>::type(), mean(expr, axis, d, out)};
}
template <class E, class dtype>
- auto mean(E const &expr, long axis, dtype d, types::none_type out,
- types::true_immediate keepdims)
+ auto mean(E const &expr, long axis, dtype d, types::none_type out, types::true_immediate keepdims)
-> decltype(expand_dims(mean(expr, axis, d), axis))
{
return expand_dims(mean(expr, axis, d), axis);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/median.hpp b/contrib/python/pythran/pythran/pythonic/numpy/median.hpp
index 939d2a3dd12..26c333765b7 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/median.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/median.hpp
@@ -18,13 +18,12 @@ namespace numpy
{
template <class T_out, class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value != 1, void>::type
+ std::enable_if_t<std::tuple_size<pS>::value != 1, void>
_median(T_out *out, types::ndarray<T, pS> const &tmp, long axis)
{
auto tmp_shape = sutils::getshape(tmp);
const long step =
- std::accumulate(tmp_shape.begin() + axis, tmp_shape.end(), 1L,
- std::multiplies<long>());
+ std::accumulate(tmp_shape.begin() + axis, tmp_shape.end(), 1L, std::multiplies<long>());
long const buffer_size = tmp_shape[axis];
T *buffer = utils::allocate<T>(buffer_size);
const long stepper = step / tmp_shape[axis];
@@ -39,15 +38,13 @@ namespace numpy
iter += stepper;
}
if (buffer_size % 2 == 1) {
- std::nth_element(buffer, buffer + buffer_size / 2, buffer_iter,
- ndarray::comparator<T>{});
+ std::nth_element(buffer, buffer + buffer_size / 2, buffer_iter, ndarray::comparator<T>{});
*out++ = buffer[buffer_size / 2];
} else {
- std::nth_element(buffer, buffer + buffer_size / 2, buffer_iter,
- ndarray::comparator<T>{});
+ std::nth_element(buffer, buffer + buffer_size / 2, buffer_iter, ndarray::comparator<T>{});
auto t0 = buffer[buffer_size / 2];
- std::nth_element(buffer, buffer + buffer_size / 2 - 1,
- buffer + buffer_size / 2, ndarray::comparator<T>{});
+ std::nth_element(buffer, buffer + buffer_size / 2 - 1, buffer + buffer_size / 2,
+ ndarray::comparator<T>{});
auto t1 = buffer[buffer_size / 2 - 1];
*out++ = (t0 + t1) / double(2);
}
@@ -62,8 +59,7 @@ namespace numpy
} // namespace
template <class T, class pS>
- decltype(std::declval<T>() + 1.) median(types::ndarray<T, pS> const &arr,
- types::none_type)
+ decltype(std::declval<T>() + 1.) median(types::ndarray<T, pS> const &arr, types::none_type)
{
size_t n = arr.flat_size();
T *tmp = utils::allocate<T>(n);
@@ -74,8 +70,7 @@ namespace numpy
utils::deallocate(tmp);
return t0;
} else {
- std::nth_element(tmp, tmp + n / 2 - 1, tmp + n / 2,
- ndarray::comparator<T>{});
+ std::nth_element(tmp, tmp + n / 2 - 1, tmp + n / 2, ndarray::comparator<T>{});
T t1 = tmp[n / 2 - 1];
utils::deallocate(tmp);
return (t0 + t1) / 2.;
@@ -83,11 +78,9 @@ namespace numpy
}
template <class T, class pS>
- typename std::enable_if<
- std::tuple_size<pS>::value != 1,
- types::ndarray<
- decltype(std::declval<T>() + 1.),
- types::array_tuple<long, std::tuple_size<pS>::value - 1>>>::type
+ std::enable_if_t<std::tuple_size<pS>::value != 1,
+ types::ndarray<decltype(std::declval<T>() + 1.),
+ types::array_tuple<long, std::tuple_size<pS>::value - 1>>>
median(types::ndarray<T, pS> const &arr, long axis)
{
constexpr auto N = std::tuple_size<pS>::value;
@@ -107,8 +100,7 @@ namespace numpy
}
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- decltype(std::declval<T>() + 1.)>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 1, decltype(std::declval<T>() + 1.)>
median(types::ndarray<T, pS> const &arr, long axis)
{
if (axis != 0)
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp
index 931e14a2127..379db2ef0c9 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/nanargmax.hpp
@@ -15,8 +15,7 @@ namespace numpy
namespace
{
template <class E, class F>
- void _nanargmax(E begin, E end, F &max, long &index, long &where,
- utils::int_<1>)
+ void _nanargmax(E begin, E end, F &max, long &index, long &where, utils::int_<1>)
{
for (; begin != end; ++begin, ++index) {
auto curr = *begin;
@@ -28,12 +27,10 @@ namespace numpy
}
template <class E, class F, size_t N>
- void _nanargmax(E begin, E end, F &max, long &index, long &where,
- utils::int_<N>)
+ void _nanargmax(E begin, E end, F &max, long &index, long &where, utils::int_<N>)
{
for (; begin != end; ++begin)
- _nanargmax((*begin).begin(), (*begin).end(), max, index, where,
- utils::int_<N - 1>());
+ _nanargmax((*begin).begin(), (*begin).end(), max, index, where, utils::int_<N - 1>());
}
} // namespace
@@ -43,8 +40,7 @@ namespace numpy
typename E::dtype max = -std::numeric_limits<typename E::dtype>::infinity();
long where = -1;
long index = 0;
- _nanargmax(expr.begin(), expr.end(), max, index, where,
- utils::int_<E::value>());
+ _nanargmax(expr.begin(), expr.end(), max, index, where, utils::int_<E::value>());
if (where >= 0)
return where;
else
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp
index 5a1ec075579..1be27a3548b 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/nanargmin.hpp
@@ -16,8 +16,7 @@ namespace numpy
namespace
{
template <class E, class F>
- void _nanargmin(E begin, E end, F &min, long &index, long &where,
- utils::int_<1>)
+ void _nanargmin(E begin, E end, F &min, long &index, long &where, utils::int_<1>)
{
for (; begin != end; ++begin, ++index) {
auto curr = *begin;
@@ -29,12 +28,10 @@ namespace numpy
}
template <class E, class F, size_t N>
- void _nanargmin(E begin, E end, F &min, long &index, long &where,
- utils::int_<N>)
+ void _nanargmin(E begin, E end, F &min, long &index, long &where, utils::int_<N>)
{
for (; begin != end; ++begin)
- _nanargmin((*begin).begin(), (*begin).end(), min, index, where,
- utils::int_<N - 1>());
+ _nanargmin((*begin).begin(), (*begin).end(), min, index, where, utils::int_<N - 1>());
}
} // namespace
@@ -44,8 +41,7 @@ namespace numpy
typename E::dtype min = std::numeric_limits<typename E::dtype>::infinity();
long where = -1;
long index = 0;
- _nanargmin(expr.begin(), expr.end(), min, index, where,
- utils::int_<E::value>());
+ _nanargmin(expr.begin(), expr.end(), min, index, where, utils::int_<E::value>());
if (where >= 0)
return where;
else
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp
index ed69f52f52f..01342ab16a3 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/nanmax.hpp
@@ -33,8 +33,7 @@ namespace numpy
{
bool found = false;
for (; begin != end; ++begin)
- found |= _nanmax((*begin).begin(), (*begin).end(), max,
- utils::int_<N - 1>());
+ found |= _nanmax((*begin).begin(), (*begin).end(), max, utils::int_<N - 1>());
return found;
}
} // namespace
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp
index 6f06df15ac3..2bf2b81b134 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/nanmin.hpp
@@ -33,8 +33,7 @@ namespace numpy
{
bool found = false;
for (; begin != end; ++begin)
- found |= _nanmin((*begin).begin(), (*begin).end(), min,
- utils::int_<N - 1>());
+ found |= _nanmin((*begin).begin(), (*begin).end(), min, utils::int_<N - 1>());
return found;
}
} // namespace
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp
index cf84d27eab6..d8d947a129d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray.hpp
@@ -11,27 +11,30 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
- template <class pS, class dtype>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- ndarray(pS const &shape, dtype)
- {
- return {(sutils::shape_t<pS>)shape, builtins::None};
- }
- template <class dtype>
- types::ndarray<typename dtype::type, types::pshape<long>> ndarray(long size,
- dtype d)
+ namespace anonymous
{
- return ndarray(types::pshape<long>(size), d);
- }
- template <long N, class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
- ndarray(std::integral_constant<long, N>, dtype d)
- {
- return ndarray(types::pshape<std::integral_constant<long, N>>({}), d);
- }
+ template <class pS, class dtype>
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> ndarray(pS const &shape, dtype)
+ {
+ return {(sutils::shape_t<pS>)shape, builtins::None};
+ }
+
+ template <class dtype>
+ types::ndarray<typename dtype::type, types::pshape<long>> ndarray(long size, dtype d)
+ {
+ return ndarray(types::pshape<long>(size), d);
+ }
+
+ template <long N, class dtype>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
+ ndarray(std::integral_constant<long, N>, dtype d)
+ {
+ return ndarray(types::pshape<std::integral_constant<long, N>>({}), d);
+ }
+
+ } // namespace anonymous
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp
index 1c260db223f..a7c1fcf66ed 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp
@@ -14,8 +14,7 @@ namespace numpy
namespace ndarray
{
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- flatten(types::ndarray<T, pS> const &a)
+ types::ndarray<T, types::pshape<long>> flatten(types::ndarray<T, pS> const &a)
{
return {a.mem, types::pshape<long>{a.flat_size()}};
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp
index e08caf0698a..a55c8bf546e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/item.hpp
@@ -24,15 +24,14 @@ namespace numpy
}
template <class E, size_t N>
- auto item(E &&expr,
- types::array_tuple<long, N> const &i) -> decltype(expr[i])
+ auto item(E &&expr, types::array_tuple<long, N> const &i) -> decltype(expr[i])
{
return expr[i];
}
// only for compatibility purpose, very bad impl
template <class E>
- typename std::decay<E>::type::dtype item(E &&expr, long i)
+ typename std::decay_t<E>::dtype item(E &&expr, long i)
{
if (i < 0)
i += expr.flat_size();
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp
index 9e0c29678dc..6e5e2b54627 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/reshape.hpp
@@ -17,33 +17,28 @@ namespace numpy
namespace misc
{
template <class P, size_t... Is>
- void set(P &p, long i, long v, utils::index_sequence<Is...>)
+ void set(P &p, long i, long v, std::index_sequence<Is...>)
{
(void)std::initializer_list<bool>{
(i == Is && (sutils::assign(std::get<Is>(p), v), true))...};
}
} // namespace misc
template <class T, class pS, class NpS>
- typename std::enable_if<!std::is_integral<NpS>::value,
- types::ndarray<T, NpS>>::type
+ std::enable_if_t<!std::is_integral<NpS>::value, types::ndarray<T, NpS>>
reshape(types::ndarray<T, pS> const &expr, NpS const &new_shape)
{
- long where = sutils::sfind(
- new_shape, -1,
- std::integral_constant<size_t, std::tuple_size<NpS>::value>(),
- [](long a, long b) { return a <= b; });
- long next = sutils::sfind(new_shape, -1, where,
- [](long a, long b) { return a <= b; });
+ long where = sutils::sfind(new_shape, -1,
+ std::integral_constant<size_t, std::tuple_size<NpS>::value>(),
+ [](long a, long b) { return a <= b; });
+ long next = sutils::sfind(new_shape, -1, where, [](long a, long b) { return a <= b; });
if (next >= 0) {
- throw pythonic::types::ValueError(
- "Reshape: can only specify one unknown dimension");
+ throw pythonic::types::ValueError("Reshape: can only specify one unknown dimension");
}
if (where >= 0) {
auto auto_shape = new_shape;
- misc::set(auto_shape, where,
- expr.flat_size() / -sutils::sprod(new_shape),
- utils::make_index_sequence<std::tuple_size<NpS>::value>());
+ misc::set(auto_shape, where, expr.flat_size() / -sutils::sprod(new_shape),
+ std::make_index_sequence<std::tuple_size<NpS>::value>());
return expr.reshape(auto_shape);
} else {
auto nshape = sutils::sprod(new_shape);
@@ -61,8 +56,7 @@ namespace numpy
}
}
template <class T, class pS, class NpS>
- typename std::enable_if<std::is_integral<NpS>::value,
- types::ndarray<T, types::pshape<long>>>::type
+ std::enable_if_t<std::is_integral<NpS>::value, types::ndarray<T, types::pshape<long>>>
reshape(types::ndarray<T, pS> const &expr, NpS const &new_shape)
{
auto n = expr.flat_size();
@@ -70,8 +64,7 @@ namespace numpy
return expr.reshape(types::pshape<long>(n));
}
if (n < new_shape) {
- types::ndarray<T, types::pshape<long>> out(
- types::pshape<long>{new_shape}, builtins::None);
+ types::ndarray<T, types::pshape<long>> out(types::pshape<long>{new_shape}, builtins::None);
auto iter = std::copy(expr.fbegin(), expr.fend(), out.fbegin());
for (long i = 1; i < new_shape / n; ++i)
iter = std::copy(out.fbegin(), out.fbegin() + n, iter);
@@ -83,10 +76,8 @@ namespace numpy
}
template <class T, class pS, class S0, class S1, class... S>
- auto reshape(types::ndarray<T, pS> const &expr, S0 i0, S1 i1,
- S const &...indices)
- -> decltype(reshape(expr,
- types::pshape<S0, S1, S...>{i0, i1, indices...}))
+ auto reshape(types::ndarray<T, pS> const &expr, S0 i0, S1 i1, S const &...indices)
+ -> decltype(reshape(expr, types::pshape<S0, S1, S...>{i0, i1, indices...}))
{
return reshape(expr, types::pshape<S0, S1, S...>{i0, i1, indices...});
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/sort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/sort.hpp
index a5860780f70..d1b392a1a9e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/sort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/sort.hpp
@@ -55,11 +55,32 @@ namespace numpy
};
template <class T>
- struct _comp;
+ struct _comp : std::less<T> {
+ };
+
+ template <>
+ struct _comp<float> {
+ bool operator()(float x, float y)
+ {
+ if (__builtin_expect(std::isnan(y), false))
+ return true;
+ return x < y;
+ }
+ };
+
+ template <>
+ struct _comp<double> {
+ bool operator()(double x, double y)
+ {
+ if (__builtin_expect(std::isnan(y), false))
+ return true;
+ return x < y;
+ }
+ };
+
template <class T>
struct _comp<std::complex<T>> {
- bool operator()(std::complex<T> const &i,
- std::complex<T> const &j) const
+ bool operator()(std::complex<T> const &i, std::complex<T> const &j) const
{
if (std::real(i) == std::real(j))
return std::imag(i) < std::imag(j);
@@ -69,20 +90,18 @@ namespace numpy
};
template <class T>
- using comparator =
- typename std::conditional<types::is_complex<T>::value, _comp<T>,
- std::less<T>>::type;
+ using comparator = _comp<T>;
template <class T, class pS, class Sorter>
- typename std::enable_if<std::tuple_size<pS>::value == 1, void>::type
- _sort(types::ndarray<T, pS> &out, long axis, Sorter sorter)
+ std::enable_if_t<std::tuple_size<pS>::value == 1, void> _sort(types::ndarray<T, pS> &out,
+ long axis, Sorter sorter)
{
sorter(out.begin(), out.end(), comparator<T>{});
}
template <class T, class pS, class Sorter>
- typename std::enable_if<std::tuple_size<pS>::value != 1, void>::type
- _sort(types::ndarray<T, pS> &out, long axis, Sorter sorter)
+ std::enable_if_t<std::tuple_size<pS>::value != 1, void> _sort(types::ndarray<T, pS> &out,
+ long axis, Sorter sorter)
{
constexpr auto N = std::tuple_size<pS>::value;
if (axis < 0)
@@ -90,14 +109,13 @@ namespace numpy
long const flat_size = out.flat_size();
if (axis == N - 1) {
const long step = out.template shape<N - 1>();
- for (T *out_iter = out.buffer, *end_iter = out.buffer + flat_size;
- out_iter != end_iter; out_iter += step)
+ for (T *out_iter = out.buffer, *end_iter = out.buffer + flat_size; out_iter != end_iter;
+ out_iter += step)
sorter(out_iter, out_iter + step, comparator<T>{});
} else {
auto out_shape = sutils::getshape(out);
- const long step =
- std::accumulate(out_shape.begin() + axis, out_shape.end(), 1L,
- std::multiplies<long>());
+ const long step = std::accumulate(out_shape.begin() + axis, out_shape.end(), 1L,
+ std::multiplies<long>());
long const buffer_size = out_shape[axis];
const long stepper = step / out_shape[axis];
const long n = flat_size / out_shape[axis];
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp
index 8c64f1cde10..05fbc517a26 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tofile.hpp
@@ -22,8 +22,7 @@ namespace numpy
types::str const &sep, types::str const &format)
{
if (sep.size() != 0)
- throw types::NotImplementedError(
- "Sep input is not implemented yet, should be left empty");
+ throw types::NotImplementedError("Sep input is not implemented yet, should be left empty");
if (format.size() != 0)
throw types::NotImplementedError(
"Format input is not implemented yet, should be left empty");
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp
index 8731ca87541..0cb4742942e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tolist.hpp
@@ -16,17 +16,15 @@ namespace numpy
{
template <class T, class pS>
- typename std::enable_if<std::tuple_size<pS>::value == 1,
- types::list<T>>::type
+ std::enable_if_t<std::tuple_size<pS>::value == 1, types::list<T>>
tolist(types::ndarray<T, pS> const &expr)
{
return {expr.fbegin(), expr.fend()};
}
template <class T, class pS>
- typename std::enable_if<
- std::tuple_size<pS>::value != 1,
- typename tolist_type<T, std::tuple_size<pS>::value>::type>::type
+ std::enable_if_t<std::tuple_size<pS>::value != 1,
+ typename tolist_type<T, std::tuple_size<pS>::value>::type>
tolist(types::ndarray<T, pS> const &expr)
{
typename tolist_type<T, std::tuple_size<pS>::value>::type out(0);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp
index 9b01099a71e..c21e9eece33 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndarray/tostring.hpp
@@ -18,8 +18,7 @@ namespace numpy
template <class T, class pS>
types::str tostring(types::ndarray<T, pS> const &expr)
{
- return types::str(reinterpret_cast<const char *>(expr.buffer),
- expr.flat_size() * sizeof(T));
+ return types::str(reinterpret_cast<const char *>(expr.buffer), expr.flat_size() * sizeof(T));
}
NUMPY_EXPR_TO_NDARRAY0_IMPL(tostring);
} // namespace ndarray
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp
index 5ef52f452c0..f7319d59d2a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndenumerate.hpp
@@ -32,8 +32,7 @@ namespace numpy
mult *= shape[j];
}
out[0] = index / mult;
- return std::tuple<types::array_tuple<long, E::value>, typename E::dtype>{
- out, *iter};
+ return std::tuple<types::array_tuple<long, E::value>, typename E::dtype>{out, *iter};
}
template <class E>
@@ -51,22 +50,19 @@ namespace numpy
}
template <class E>
- bool ndenumerate_iterator<E>::operator!=(
- ndenumerate_iterator<E> const &other) const
+ bool ndenumerate_iterator<E>::operator!=(ndenumerate_iterator<E> const &other) const
{
return index != other.index;
}
template <class E>
- bool
- ndenumerate_iterator<E>::operator<(ndenumerate_iterator<E> const &other) const
+ bool ndenumerate_iterator<E>::operator<(ndenumerate_iterator<E> const &other) const
{
return index < other.index;
}
template <class E>
- long
- ndenumerate_iterator<E>::operator-(ndenumerate_iterator<E> const &other) const
+ long ndenumerate_iterator<E>::operator-(ndenumerate_iterator<E> const &other) const
{
return index - other.index;
}
@@ -78,8 +74,7 @@ namespace numpy
template <class E>
_ndenumerate<E>::_ndenumerate(E const &expr)
- : ndenumerate_iterator<E>(expr, 0), expr(expr),
- end_iter(expr, expr.flat_size())
+ : ndenumerate_iterator<E>(expr, 0), expr(expr), end_iter(expr, expr.flat_size())
{
}
@@ -102,8 +97,7 @@ namespace numpy
}
template <class T, class pS>
- _ndenumerate<types::ndarray<T, pS>>
- ndenumerate(types::ndarray<T, pS> const &expr)
+ _ndenumerate<types::ndarray<T, pS>> ndenumerate(types::ndarray<T, pS> const &expr)
{
return {expr};
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp
index e32e6bab84f..edd102150be 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ndindex.hpp
@@ -17,8 +17,7 @@ namespace numpy
}
template <size_t N>
- ndindex_iterator<N>::ndindex_iterator(
- types::array_tuple<long, N> const &shape, long first)
+ ndindex_iterator<N>::ndindex_iterator(types::array_tuple<long, N> const &shape, long first)
: index(first), shape(shape)
{
}
@@ -76,8 +75,7 @@ namespace numpy
template <size_t N>
_ndindex<N>::_ndindex(types::array_tuple<long, N> const &shape)
: ndindex_iterator<N>(shape, 0), shape(shape),
- end_iter(shape, std::accumulate(shape.begin(), shape.end(), 1L,
- std::multiplies<long>()))
+ end_iter(shape, std::accumulate(shape.begin(), shape.end(), 1L, std::multiplies<long>()))
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp b/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp
index 5b22e8ba571..f4a7f9a3a6a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/nonzero.hpp
@@ -14,8 +14,7 @@ namespace numpy
namespace
{
template <class I, class O, size_t M>
- void _nonzero(I begin, I end, O &out, types::array_tuple<long, M> &curr,
- utils::int_<1>)
+ void _nonzero(I begin, I end, O &out, types::array_tuple<long, M> &curr, utils::int_<1>)
{
I start = begin;
for (; begin != end; ++begin) {
@@ -29,21 +28,19 @@ namespace numpy
}
template <class I, class O, size_t M, size_t N>
- void _nonzero(I begin, I end, O &out, types::array_tuple<long, M> &curr,
- utils::int_<N>)
+ void _nonzero(I begin, I end, O &out, types::array_tuple<long, M> &curr, utils::int_<N>)
{
I start = begin;
for (; begin != end; ++begin) {
curr[M - N] = begin - start;
- _nonzero((*begin).begin(), (*begin).end(), out, curr,
- utils::int_<N - 1>());
+ _nonzero((*begin).begin(), (*begin).end(), out, curr, utils::int_<N - 1>());
}
}
} // namespace
template <size_t... Is>
types::array_tuple<utils::shared_ref<types::raw_array<long>>, sizeof...(Is)>
- init_buffers(long sz, utils::index_sequence<Is...>)
+ init_buffers(long sz, std::index_sequence<Is...>)
{
auto fwd = [](long ret, long) { return ret; }; // just to avoid a warning
return {{fwd(sz, Is)...}}; // too much memory used
@@ -51,17 +48,15 @@ namespace numpy
template <class E>
auto nonzero(E const &expr)
- -> types::array_tuple<types::ndarray<long, types::array_tuple<long, 1>>,
- E::value>
+ -> types::array_tuple<types::ndarray<long, types::array_tuple<long, 1>>, E::value>
{
constexpr long N = E::value;
- typedef types::array_tuple<
- types::ndarray<long, types::array_tuple<long, 1>>, E::value>
+ typedef types::array_tuple<types::ndarray<long, types::array_tuple<long, 1>>, E::value>
out_type;
long sz = expr.flat_size();
- types::array_tuple<utils::shared_ref<types::raw_array<long>>, N>
- out_buffers = init_buffers(sz, utils::make_index_sequence<N>());
+ types::array_tuple<utils::shared_ref<types::raw_array<long>>, N> out_buffers =
+ init_buffers(sz, std::make_index_sequence<N>());
types::array_tuple<long *, N> out_iters;
for (size_t i = 0; i < N; ++i)
out_iters[i] = out_buffers[i]->data;
@@ -69,13 +64,11 @@ namespace numpy
types::array_tuple<long, N> indices;
_nonzero(expr.begin(), expr.end(), out_iters, indices, utils::int_<N>());
- types::array_tuple<long, 1> shape = {
- {(long)(out_iters[0] - out_buffers[0]->data)}};
+ types::array_tuple<long, 1> shape = {{(long)(out_iters[0] - out_buffers[0]->data)}};
out_type out;
for (size_t i = 0; i < N; ++i)
- out[i] = types::ndarray<long, types::array_tuple<long, 1>>(
- std::move(out_buffers[i]), shape);
+ out[i] = types::ndarray<long, types::array_tuple<long, 1>>(std::move(out_buffers[i]), shape);
return out;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp
index 13a94109807..59562a4c091 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ones.hpp
@@ -18,22 +18,19 @@ namespace numpy
}
template <class pS, class dtype>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- ones(pS const &shape, dtype d)
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> ones(pS const &shape, dtype d)
{
return {(sutils::shape_t<pS>)shape, typename dtype::type(1)};
}
template <class dtype>
- types::ndarray<typename dtype::type, types::pshape<long>> ones(long size,
- dtype d)
+ types::ndarray<typename dtype::type, types::pshape<long>> ones(long size, dtype d)
{
return ones(types::pshape<long>(size), d);
}
template <long N, class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
ones(std::integral_constant<long, N>, dtype d)
{
return ones(types::pshape<std::integral_constant<long, N>>({}), d);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp
index b6070aa733c..35ba00f7555 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ones_like.hpp
@@ -12,16 +12,14 @@ namespace numpy
{
template <class E, class dtype>
- auto ones_like(E const &expr,
- dtype d) -> decltype(ones(sutils::getshape(expr), d))
+ auto ones_like(E const &expr, dtype d) -> decltype(ones(sutils::getshape(expr), d))
{
return ones(sutils::getshape(expr), d);
}
template <class E>
auto ones_like(E const &expr, types::none_type)
- -> decltype(ones(sutils::getshape(expr),
- types::dtype_t<typename E::dtype>()))
+ -> decltype(ones(sutils::getshape(expr), types::dtype_t<typename E::dtype>()))
{
return ones(sutils::getshape(expr), types::dtype_t<typename E::dtype>());
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp b/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp
index 99d9983bffe..fd5539e5241 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/outer.hpp
@@ -13,41 +13,33 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T0, class pS0, class T1, class pS1>
- types::ndarray<decltype(std::declval<T0>() + std::declval<T1>()),
- types::pshape<long, long>>
+ types::ndarray<decltype(std::declval<T0>() + std::declval<T1>()), types::pshape<long, long>>
outer(types::ndarray<T0, pS0> const &a, types::ndarray<T1, pS1> const &b)
{
- types::ndarray<decltype(std::declval<T0>() + std::declval<T1>()),
- types::pshape<long, long>>
- out(types::pshape<long, long>{a.flat_size(), b.flat_size()},
- builtins::None);
+ types::ndarray<decltype(std::declval<T0>() + std::declval<T1>()), types::pshape<long, long>>
+ out(types::pshape<long, long>{a.flat_size(), b.flat_size()}, builtins::None);
auto iter = out.fbegin();
- for (auto iter_a = a.fbegin(), end_a = a.fend(); iter_a != end_a;
- ++iter_a) {
+ for (auto iter_a = a.fbegin(), end_a = a.fend(); iter_a != end_a; ++iter_a) {
auto val_a = *iter_a;
- iter = std::transform(b.fbegin(), b.fend(), iter,
- [=](T1 val) { return val_a * val; });
+ iter = std::transform(b.fbegin(), b.fend(), iter, [=](T1 val) { return val_a * val; });
}
return out;
}
template <class T0, class pS0, class E1>
- auto outer(types::ndarray<T0, pS0> const &a,
- E1 const &b) -> decltype(outer(a, asarray(b)))
+ auto outer(types::ndarray<T0, pS0> const &a, E1 const &b) -> decltype(outer(a, asarray(b)))
{
return outer(a, asarray(b));
}
template <class E0, class T1, class pS1>
- auto outer(E0 const &a,
- types::ndarray<T1, pS1> const &b) -> decltype(outer(asarray(a), b))
+ auto outer(E0 const &a, types::ndarray<T1, pS1> const &b) -> decltype(outer(asarray(a), b))
{
return outer(asarray(a), b);
}
template <class E0, class E1>
- auto outer(E0 const &a,
- E1 const &b) -> decltype(outer(asarray(a), asarray(b)))
+ auto outer(E0 const &a, E1 const &b) -> decltype(outer(asarray(a), asarray(b)))
{
return outer(asarray(a), asarray(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp b/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp
index 2074d7ca0f3..76f2f4f2b8c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/partial_sum.hpp
@@ -73,8 +73,7 @@ namespace numpy
} // namespace
template <class Op, class E, class dtype>
- types::ndarray<typename dtype::type, types::pshape<long>>
- partial_sum(E const &expr, dtype d)
+ types::ndarray<typename dtype::type, types::pshape<long>> partial_sum(E const &expr, dtype d)
{
const long count = expr.flat_size();
types::ndarray<typename dtype::type, types::pshape<long>> the_partial_sum{
@@ -85,9 +84,8 @@ namespace numpy
}
template <class Op, class E, class dtype>
- auto partial_sum(E const &expr, long axis, dtype d) ->
- typename std::enable_if<E::value == 1,
- decltype(partial_sum<Op, E, dtype>(expr))>::type
+ auto partial_sum(E const &expr, long axis, dtype d)
+ -> std::enable_if_t<E::value == 1, decltype(partial_sum<Op, E, dtype>(expr))>
{
if (axis != 0)
throw types::ValueError("axis out of bounds");
@@ -95,8 +93,8 @@ namespace numpy
}
template <class Op, class E, class dtype>
- typename std::enable_if<E::value != 1, partial_sum_type<Op, E, dtype>>::type
- partial_sum(E const &expr, long axis, dtype d)
+ std::enable_if_t<E::value != 1, partial_sum_type<Op, E, dtype>> partial_sum(E const &expr,
+ long axis, dtype d)
{
if (axis < 0 || size_t(axis) >= E::value)
throw types::ValueError("axis out of bounds");
@@ -109,9 +107,9 @@ namespace numpy
} else {
std::transform(
expr.begin(), expr.end(), the_partial_sum.begin(),
- [axis,
- d](typename std::iterator_traits<typename E::iterator>::value_type
- other) { return partial_sum<Op>(other, axis - 1, d); });
+ [axis, d](typename std::iterator_traits<typename E::iterator>::value_type other) {
+ return partial_sum<Op>(other, axis - 1, d);
+ });
}
return the_partial_sum;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/place.hpp b/contrib/python/pythran/pythran/pythonic/numpy/place.hpp
index 5cf1da62caa..1481963107d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/place.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/place.hpp
@@ -13,14 +13,13 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS, class Tp, class pSp, class F>
- types::none_type place(types::ndarray<T, pS> &expr,
- types::ndarray<Tp, pSp> const &mask, F const &values)
+ types::none_type place(types::ndarray<T, pS> &expr, types::ndarray<Tp, pSp> const &mask,
+ F const &values)
{
auto first = expr.fend();
auto viter = values.begin(), vend = values.end();
auto miter = mask.fbegin();
- for (auto iter = expr.fbegin(), end = expr.fend(); iter != end;
- ++iter, ++miter) {
+ for (auto iter = expr.fbegin(), end = expr.fend(); iter != end; ++iter, ++miter) {
if (*miter) {
if (first == expr.fend())
first = iter;
@@ -34,8 +33,7 @@ namespace numpy
}
template <class T, class pS, class M, class F>
- types::none_type place(types::ndarray<T, pS> &expr, M const &mask,
- F const &values)
+ types::none_type place(types::ndarray<T, pS> &expr, M const &mask, F const &values)
{
return place(expr, asarray(mask), values);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp
index 5db6f7036f3..53c2acda1fe 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto ptp(E const &expr,
- long axis) -> decltype(max(expr, axis) - min(expr, axis))
+ auto ptp(E const &expr, long axis) -> decltype(max(expr, axis) - min(expr, axis))
{
return max(expr, axis) - min(expr, axis);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/put.hpp b/contrib/python/pythran/pythran/pythonic/numpy/put.hpp
index fc7b27d34a0..377f9db5d39 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/put.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/put.hpp
@@ -14,8 +14,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class F, class T, class pS, class E>
- typename std::enable_if<types::is_numexpr_arg<F>::value,
- types::none_type>::type
+ std::enable_if_t<types::is_numexpr_arg<F>::value, types::none_type>
put(types::ndarray<T, pS> &expr, F const &ind, E const &v)
{
auto vind = asarray(ind);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp b/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp
index 8b9b9f14aaf..c1327de2f3e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/putmask.hpp
@@ -13,8 +13,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS, class E, class F>
- types::none_type putmask(types::ndarray<T, pS> &expr, E const &mask,
- F const &values)
+ types::none_type putmask(types::ndarray<T, pS> &expr, E const &mask, F const &values)
{
auto amask = asarray(mask);
auto avalues = asarray(values);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/bytes.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/bytes.hpp
index a4c870b98ca..0955dee35c8 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/bytes.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/bytes.hpp
@@ -21,9 +21,8 @@ namespace numpy
// dummy init + rewrite is faster than reserve && push_back
types::str result(std::string(length, 0));
std::uniform_int_distribution<long> distribution{0, 255};
- std::generate(result.chars().begin(), result.chars().end(), [&]() {
- return static_cast<char>(distribution(details::generator));
- });
+ std::generate(result.chars().begin(), result.chars().end(),
+ [&]() { return static_cast<char>(distribution(details::generator)); });
return result;
}
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp
index 1027cd81136..17eb978b42a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/choice.hpp
@@ -22,8 +22,7 @@ namespace numpy
* Implementation with long as first argument
**********************************************************/
template <class pS, class P>
- types::ndarray<long, pS> choice(long max, pS const &shape, bool replace,
- P const &p)
+ types::ndarray<long, pS> choice(long max, pS const &shape, bool replace, P const &p)
{
if (!replace)
throw pythonic::builtins::NotImplementedError(
@@ -38,16 +37,13 @@ namespace numpy
}
template <class P>
- types::ndarray<long, types::pshape<long>> choice(long max, long size,
- bool replace, P &&p)
+ types::ndarray<long, types::pshape<long>> choice(long max, long size, bool replace, P &&p)
{
- return choice(max, types::pshape<long>{size}, replace,
- std::forward<P>(p));
+ return choice(max, types::pshape<long>{size}, replace, std::forward<P>(p));
}
template <class T>
- auto choice(long max,
- T &&size) -> decltype(randint(0, max, std::forward<T>(size)))
+ auto choice(long max, T &&size) -> decltype(randint(0, max, std::forward<T>(size)))
{
return randint(0, max, std::forward<T>(size));
}
@@ -84,15 +80,14 @@ namespace numpy
}
template <class T>
- types::ndarray<typename T::dtype, types::pshape<long>> choice(T &&a,
- long size)
+ types::ndarray<typename T::dtype, types::pshape<long>> choice(T &&a, long size)
{
return choice(std::forward<T>(a), types::pshape<long>{size});
}
template <class T, class pS, class P>
- types::ndarray<typename T::dtype, pS> choice(T const &a, pS const &shape,
- bool replace, P const &p)
+ types::ndarray<typename T::dtype, pS> choice(T const &a, pS const &shape, bool replace,
+ P const &p)
{
// This is a numpy constraint
static_assert(T::value == 1, "ValueError: a must be 1-dimensional");
@@ -110,11 +105,10 @@ namespace numpy
}
template <class T, class P>
- types::ndarray<typename T::dtype, types::pshape<long>>
- choice(T &&a, long size, bool replace, P &&p)
+ types::ndarray<typename T::dtype, types::pshape<long>> choice(T &&a, long size, bool replace,
+ P &&p)
{
- return choice(std::forward<T>(a), types::pshape<long>{size}, replace,
- std::forward<P>(p));
+ return choice(std::forward<T>(a), types::pshape<long>{size}, replace, std::forward<P>(p));
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp
index ae3abd473fe..031ff917525 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/exponential.hpp
@@ -37,8 +37,7 @@ namespace numpy
inline double exponential(double scale, types::none_type d)
{
- return std::exponential_distribution<double>{1 /
- scale}(details::generator);
+ return std::exponential_distribution<double>{1 / scale}(details::generator);
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp
index d6dcf1bcd5a..95108b093ac 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/f.hpp
@@ -31,19 +31,16 @@ namespace numpy
return result;
}
- inline auto f(double dfnum, double dfden,
- long size) -> decltype(f(dfnum, dfden,
- types::array_tuple<long, 1>{{size}}))
+ inline auto f(double dfnum, double dfden, long size)
+ -> decltype(f(dfnum, dfden, types::array_tuple<long, 1>{{size}}))
{
return f(dfnum, dfden, types::array_tuple<long, 1>{{size}});
}
inline double f(double dfnum, double dfden, types::none_type d)
{
- return (std::chi_squared_distribution<double>{dfnum}(
- details::generator)*dfden) /
- (std::chi_squared_distribution<double>{dfden}(
- details::generator)*dfnum);
+ return (std::chi_squared_distribution<double>{dfnum}(details::generator)*dfden) /
+ (std::chi_squared_distribution<double>{dfden}(details::generator)*dfnum);
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp
index 9d6cc1fb831..ec24f59a823 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/gamma.hpp
@@ -19,8 +19,7 @@ namespace numpy
{
template <class pS>
- types::ndarray<double, pS> gamma(double shape, double scale,
- pS const &array_shape)
+ types::ndarray<double, pS> gamma(double shape, double scale, pS const &array_shape)
{
types::ndarray<double, pS> result{array_shape, types::none_type()};
std::gamma_distribution<double> distribution{shape, scale};
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp
index 666c6906f9a..dc145a88d4e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/gumbel.hpp
@@ -22,8 +22,7 @@ namespace numpy
types::ndarray<double, pS> gumbel(double loc, double scale, pS const &shape)
{
types::ndarray<double, pS> result{shape, types::none_type()};
- std::generate(result.fbegin(), result.fend(),
- [&]() { return gumbel(loc, scale); });
+ std::generate(result.fbegin(), result.fend(), [&]() { return gumbel(loc, scale); });
return result;
}
@@ -35,8 +34,7 @@ namespace numpy
inline double gumbel(double loc, double scale, types::none_type d)
{
- double U =
- std::uniform_real_distribution<double>{0., 1.}(details::generator);
+ double U = std::uniform_real_distribution<double>{0., 1.}(details::generator);
if (U < 1.0) {
return loc - scale * xsimd::log(-xsimd::log(U));
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp
index a000332971f..442b5f5d68e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/laplace.hpp
@@ -19,12 +19,10 @@ namespace numpy
{
template <class pS>
- types::ndarray<double, pS> laplace(double loc, double scale,
- pS const &shape)
+ types::ndarray<double, pS> laplace(double loc, double scale, pS const &shape)
{
types::ndarray<double, pS> result{shape, types::none_type()};
- std::generate(result.fbegin(), result.fend(),
- [&]() { return laplace(loc, scale); });
+ std::generate(result.fbegin(), result.fend(), [&]() { return laplace(loc, scale); });
return result;
}
@@ -36,8 +34,7 @@ namespace numpy
inline double laplace(double loc, double scale, types::none_type d)
{
- double U =
- std::uniform_real_distribution<double>{0., 1.}(details::generator);
+ double U = std::uniform_real_distribution<double>{0., 1.}(details::generator);
if (U >= 0.5) {
U = loc - scale * xsimd::log(2.0 - U - U);
} else if (U > 0.0) {
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp
index bb9cbb4e665..9cdb4a10bf1 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/logistic.hpp
@@ -19,12 +19,10 @@ namespace numpy
{
template <class pS>
- types::ndarray<double, pS> logistic(double loc, double scale,
- pS const &shape)
+ types::ndarray<double, pS> logistic(double loc, double scale, pS const &shape)
{
types::ndarray<double, pS> result{shape, types::none_type()};
- std::generate(result.fbegin(), result.fend(),
- [&]() { return logistic(loc, scale); });
+ std::generate(result.fbegin(), result.fend(), [&]() { return logistic(loc, scale); });
return result;
}
@@ -36,8 +34,7 @@ namespace numpy
inline double logistic(double loc, double scale, types::none_type d)
{
- double U =
- std::uniform_real_distribution<double>{0., 1.}(details::generator);
+ double U = std::uniform_real_distribution<double>{0., 1.}(details::generator);
if (U > 0.0) {
return loc + scale * xsimd::log(U / (1 - U));
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp
index be6b5705713..7676f7a0378 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/lognormal.hpp
@@ -19,8 +19,7 @@ namespace numpy
{
template <class pS>
- types::ndarray<double, pS> lognormal(double mean, double sigma,
- pS const &shape)
+ types::ndarray<double, pS> lognormal(double mean, double sigma, pS const &shape)
{
types::ndarray<double, pS> result{shape, types::none_type()};
std::lognormal_distribution<double> distribution{mean, sigma};
@@ -37,8 +36,7 @@ namespace numpy
inline double lognormal(double mean, double sigma, types::none_type d)
{
- return std::lognormal_distribution<double>{mean,
- sigma}(details::generator);
+ return std::lognormal_distribution<double>{mean, sigma}(details::generator);
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp
index 89bf6d377be..6c3c122cc85 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/logseries.hpp
@@ -23,8 +23,7 @@ namespace numpy
types::ndarray<double, pS> logseries(double p, pS const &shape)
{
types::ndarray<double, pS> result{shape, types::none_type()};
- std::generate(result.fbegin(), result.fend(),
- [&]() { return logseries(p); });
+ std::generate(result.fbegin(), result.fend(), [&]() { return logseries(p); });
return result;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp
index 1e09660f815..5277c489c2e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/negative_binomial.hpp
@@ -19,8 +19,7 @@ namespace numpy
{
template <class pS>
- types::ndarray<long, pS> negative_binomial(long n, double p,
- pS const &shape)
+ types::ndarray<long, pS> negative_binomial(long n, double p, pS const &shape)
{
types::ndarray<long, pS> result{shape, types::none_type()};
std::negative_binomial_distribution<long> distribution{n, p};
@@ -30,8 +29,7 @@ namespace numpy
}
inline auto negative_binomial(long n, double p, long size)
- -> decltype(negative_binomial(n, p,
- types::array_tuple<long, 1>{{size}}))
+ -> decltype(negative_binomial(n, p, types::array_tuple<long, 1>{{size}}))
{
return negative_binomial(n, p, types::array_tuple<long, 1>{{size}});
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp
index 8900b2a5c54..573bd56dbbc 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/pareto.hpp
@@ -23,9 +23,8 @@ namespace numpy
{
types::ndarray<double, pS> result{shape, types::none_type()};
std::exponential_distribution<double> distribution{};
- std::generate(result.fbegin(), result.fend(), [&]() {
- return expm1(distribution(details::generator) / a);
- });
+ std::generate(result.fbegin(), result.fend(),
+ [&]() { return expm1(distribution(details::generator) / a); });
return result;
}
@@ -38,8 +37,7 @@ namespace numpy
inline double pareto(double a, types::none_type d)
{
- return expm1(std::exponential_distribution<double>{}(details::generator) /
- a);
+ return expm1(std::exponential_distribution<double>{}(details::generator) / a);
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp
index 36db5bcdd4e..bf446c70442 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/power.hpp
@@ -36,9 +36,7 @@ namespace numpy
inline double power(double a, types::none_type d)
{
- return pow(
- -expm1(-std::exponential_distribution<double>{}(details::generator)),
- 1. / a);
+ return pow(-expm1(-std::exponential_distribution<double>{}(details::generator)), 1. / a);
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp
index 677fd5e6ff4..2f131318770 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/rand.hpp
@@ -15,8 +15,7 @@ namespace numpy
{
template <class... T>
- types::ndarray<double, types::array_tuple<long, sizeof...(T)>>
- rand(T... shape)
+ types::ndarray<double, types::array_tuple<long, sizeof...(T)>> rand(T... shape)
{
return random(types::array_tuple<long, sizeof...(T)>{{shape...}});
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp
index 9911415453b..244694fe5e3 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/randint.hpp
@@ -17,8 +17,7 @@ namespace numpy
{
template <class pS>
- typename std::enable_if<!std::is_integral<pS>::value,
- types::ndarray<long, pS>>::type
+ std::enable_if_t<!std::is_integral<pS>::value, types::ndarray<long, pS>>
randint(long min, long max, pS const &shape)
{
types::ndarray<long, pS> result{shape, types::none_type()};
@@ -29,16 +28,14 @@ namespace numpy
}
template <class pS>
- typename std::enable_if<std::is_integral<pS>::value,
- types::ndarray<long, types::pshape<long>>>::type
+ std::enable_if_t<std::is_integral<pS>::value, types::ndarray<long, types::pshape<long>>>
randint(long min, long max, pS const &shape)
{
return randint(min, max, types::pshape<long>{shape});
}
template <class pS>
- auto randint(long max, types::none_type,
- pS const &shape) -> decltype(randint(0, max, shape))
+ auto randint(long max, types::none_type, pS const &shape) -> decltype(randint(0, max, shape))
{
return randint(0, max, shape);
}
@@ -51,14 +48,12 @@ namespace numpy
inline long randint(long max, types::none_type)
{
- return std::uniform_int_distribution<long>{0,
- max - 1}(details::generator);
+ return std::uniform_int_distribution<long>{0, max - 1}(details::generator);
}
inline long randint(long min, long max)
{
- return std::uniform_int_distribution<long>{min,
- max - 1}(details::generator);
+ return std::uniform_int_distribution<long>{min, max - 1}(details::generator);
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp
index c732058fd32..ee0287cd39a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/randn.hpp
@@ -15,11 +15,9 @@ namespace numpy
{
template <class... T>
- types::ndarray<double, types::array_tuple<long, sizeof...(T)>>
- randn(T... shape)
+ types::ndarray<double, types::array_tuple<long, sizeof...(T)>> randn(T... shape)
{
- return standard_normal(
- types::array_tuple<long, sizeof...(T)>{{shape...}});
+ return standard_normal(types::array_tuple<long, sizeof...(T)>{{shape...}});
}
inline double randn()
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp
index 7bd6e85e9e1..ceb0885c564 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/random.hpp
@@ -28,8 +28,7 @@ namespace numpy
return result;
}
- inline auto
- random(long size) -> decltype(random(types::array_tuple<long, 1>{{size}}))
+ inline auto random(long size) -> decltype(random(types::array_tuple<long, 1>{{size}}))
{
return random(types::array_tuple<long, 1>{{size}});
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp
index 659d2d66d72..29d51ebdce0 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/rayleigh.hpp
@@ -23,8 +23,7 @@ namespace numpy
types::ndarray<double, pS> rayleigh(double scale, pS const &array_shape)
{
types::ndarray<double, pS> result{array_shape, types::none_type()};
- std::generate(result.fbegin(), result.fend(),
- [&]() { return rayleigh(scale); });
+ std::generate(result.fbegin(), result.fend(), [&]() { return rayleigh(scale); });
return result;
}
@@ -36,9 +35,8 @@ namespace numpy
inline double rayleigh(double scale, types::none_type d)
{
- return scale *
- sqrt(-2.0 * log(1.0 - std::uniform_real_distribution<double>{
- 0., 1.}(details::generator)));
+ return scale * sqrt(-2.0 * log(1.0 - std::uniform_real_distribution<double>{0., 1.}(
+ details::generator)));
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp b/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp
index 29df0df1b55..fd8a34487ab 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/random/uniform.hpp
@@ -20,12 +20,10 @@ namespace numpy
{
template <class pS>
- types::ndarray<double, pS> uniform(double low, double high,
- pS const &array_shape)
+ types::ndarray<double, pS> uniform(double low, double high, pS const &array_shape)
{
types::ndarray<double, pS> result{array_shape, types::none_type()};
- std::generate(result.fbegin(), result.fend(),
- [&]() { return uniform(low, high); });
+ std::generate(result.fbegin(), result.fend(), [&]() { return uniform(low, high); });
return result;
}
@@ -37,8 +35,7 @@ namespace numpy
inline double uniform(double low, double high, types::none_type d)
{
- return std::uniform_real_distribution<double>{low,
- high}(details::generator);
+ return std::uniform_real_distribution<double>{low, high}(details::generator);
}
} // namespace random
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp
index f8257fa3996..30a0e282a35 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ravel.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- ravel(types::ndarray<T, pS> const &expr)
+ types::ndarray<T, types::pshape<long>> ravel(types::ndarray<T, pS> const &expr)
{
return expr.reshape(types::pshape<long>{expr.flat_size()});
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/real.hpp b/contrib/python/pythran/pythran/pythonic/numpy/real.hpp
index 28a4143ff89..60bf72516ff 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/real.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/real.hpp
@@ -13,15 +13,13 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class E>
- auto real(E &&expr) -> decltype(builtins::getattr(types::attr::REAL{},
- std::forward<E>(expr)))
+ auto real(E &&expr) -> decltype(builtins::getattr(types::attr::REAL{}, std::forward<E>(expr)))
{
return builtins::getattr(types::attr::REAL{}, std::forward<E>(expr));
}
template <class T>
- auto real(types::list<T> const &expr)
- -> decltype(real(numpy::functor::asarray{}(expr)))
+ auto real(types::list<T> const &expr) -> decltype(real(numpy::functor::asarray{}(expr)))
{
return real(numpy::functor::asarray{}(expr));
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp b/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp
index e1b2588f140..b32b7251f5c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/reduce.hpp
@@ -24,8 +24,7 @@ namespace numpy
F operator()(E &&e, F acc)
{
for (auto &&value : std::forward<E>(e))
- acc = _reduce<Op, N - 1, vector_form>{}(
- std::forward<decltype(value)>(value), acc);
+ acc = _reduce<Op, N - 1, vector_form>{}(std::forward<decltype(value)>(value), acc);
return acc;
}
@@ -49,10 +48,8 @@ namespace numpy
template <class E, class F, class... Indices>
F operator()(E &&e, F acc, Indices... indices)
{
- for (long i = 0, n = e.template shape<std::decay<E>::type::value - N>();
- i < n; ++i) {
- acc = _reduce<Op, N - 1, types::novectorize_nobroadcast>{}(
- e, acc, indices..., i);
+ for (long i = 0, n = e.template shape<std::decay_t<E>::value - N>(); i < n; ++i) {
+ acc = _reduce<Op, N - 1, types::novectorize_nobroadcast>{}(e, acc, indices..., i);
}
return acc;
}
@@ -63,8 +60,7 @@ namespace numpy
template <class E, class F, class... Indices>
F operator()(E &&e, F acc, Indices... indices)
{
- for (long i = 0, n = e.template shape<std::decay<E>::type::value - 1>();
- i < n; ++i) {
+ for (long i = 0, n = e.template shape<std::decay_t<E>::value - 1>(); i < n; ++i) {
Op{}(acc, e.load(indices..., i));
}
return acc;
@@ -111,8 +107,7 @@ namespace numpy
template <class E, class F>
F operator()(E &&e, F acc)
{
- return vreduce<types::vectorizer_nobroadcast, Op>(std::forward<E>(e),
- acc);
+ return vreduce<types::vectorizer_nobroadcast, Op>(std::forward<E>(e), acc);
}
};
#else
@@ -151,16 +146,14 @@ namespace numpy
}
};
template <class Op, class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, E>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, E>
reduce(E const &expr, types::none_type)
{
return expr;
}
template <class Op, class E>
- typename std::enable_if<
- std::is_scalar<E>::value || types::is_complex<E>::value, E>::type
+ std::enable_if_t<std::is_scalar<E>::value || types::is_complex<E>::value, E>
reduce(E const &array, long axis)
{
if (axis != 0)
@@ -169,20 +162,19 @@ namespace numpy
}
template <class Op, class E, class dtype>
- typename std::enable_if<types::is_numexpr_arg<E>::value,
- reduce_result_type<Op, E, dtype>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value, reduce_result_type<Op, E, dtype>>
reduce(E const &expr, types::none_type axis, dtype)
{
using rrt = reduce_result_type<Op, E, dtype>;
- bool constexpr is_vectorizable =
- E::is_vectorizable && !std::is_same<typename E::dtype, bool>::value &&
- std::is_same<rrt, typename E::dtype>::value;
+ bool constexpr is_vectorizable = E::is_vectorizable &&
+ !std::is_same<typename E::dtype, bool>::value &&
+ std::is_same<rrt, typename E::dtype>::value;
rrt p = utils::neutral<Op, rrt>::value;
return reduce_helper<Op, E, is_vectorizable>{}(expr, p);
}
template <class Op, class E, class dtype>
- typename std::enable_if<E::value == 1, reduce_result_type<Op, E, dtype>>::type
+ std::enable_if_t<E::value == 1, reduce_result_type<Op, E, dtype>>
reduce(E const &array, long axis, dtype d, types::none_type)
{
if (axis != 0)
@@ -191,8 +183,8 @@ namespace numpy
}
template <class Op, class E, class Out>
- typename std::enable_if<E::value == 1, reduce_result_type<Op, E>>::type
- reduce(E const &array, long axis, types::none_type, Out &&out)
+ std::enable_if_t<E::value == 1, reduce_result_type<Op, E>> reduce(E const &array, long axis,
+ types::none_type, Out &&out)
{
if (axis != 0)
throw types::ValueError("axis out of bounds");
@@ -202,60 +194,46 @@ namespace numpy
template <class Op, size_t N>
struct _reduce_axisb {
template <class E, class F, class EIndices, class FIndices>
- void operator()(E &&e, F &&f, long axis, EIndices &&e_indices,
- FIndices &&f_indices)
+ void operator()(E &&e, F &&f, long axis, EIndices &&e_indices, FIndices &&f_indices)
{
- for (long i = 0, n = e.template shape<std::decay<E>::type::value - N>();
- i < n; ++i) {
- _reduce_axisb<Op, N - 1>{}(
- e, f, axis, std::tuple_cat(e_indices, std::make_tuple(i)),
- std::tuple_cat(f_indices, std::make_tuple(i)));
+ for (long i = 0, n = e.template shape<std::decay_t<E>::value - N>(); i < n; ++i) {
+ _reduce_axisb<Op, N - 1>{}(e, f, axis, std::tuple_cat(e_indices, std::make_tuple(i)),
+ std::tuple_cat(f_indices, std::make_tuple(i)));
}
}
};
template <class Op>
struct _reduce_axisb<Op, 0> {
- template <class E, class F, class EIndices, class FIndices, size_t... Es,
- size_t... Fs>
+ template <class E, class F, class EIndices, class FIndices, size_t... Es, size_t... Fs>
void helper(E &&e, F &&f, EIndices &&e_indices, FIndices &&f_indices,
- utils::index_sequence<Es...>, utils::index_sequence<Fs...>)
+ std::index_sequence<Es...>, std::index_sequence<Fs...>)
{
- f.template update<Op>(e.load(std::get<Es>(e_indices)...),
- (long)std::get<Fs>(f_indices)...);
+ f.template update<Op>(e.load(std::get<Es>(e_indices)...), (long)std::get<Fs>(f_indices)...);
}
template <class E, class F, class EIndices, class FIndices>
- void operator()(E &&e, F &&f, long axis, EIndices &&e_indices,
- FIndices &&f_indices)
+ void operator()(E &&e, F &&f, long axis, EIndices &&e_indices, FIndices &&f_indices)
{
- helper(
- std::forward<E>(e), std::forward<F>(f), e_indices, f_indices,
- utils::make_index_sequence<
- std::tuple_size<typename std::decay<EIndices>::type>::value>(),
- utils::make_index_sequence<
- std::tuple_size<typename std::decay<FIndices>::type>::value>());
+ helper(std::forward<E>(e), std::forward<F>(f), e_indices, f_indices,
+ std::make_index_sequence<std::tuple_size<std::decay_t<EIndices>>::value>(),
+ std::make_index_sequence<std::tuple_size<std::decay_t<FIndices>>::value>());
}
};
template <class Op, size_t N>
struct _reduce_axis {
template <class E, class F, class EIndices, class FIndices>
- void operator()(E &&e, F &&f, long axis, EIndices &&e_indices,
- FIndices &&f_indices)
+ void operator()(E &&e, F &&f, long axis, EIndices &&e_indices, FIndices &&f_indices)
{
- if (axis == std::decay<E>::type::value - N) {
- for (long i = 0, n = e.template shape<std::decay<E>::type::value - N>();
- i < n; ++i) {
- _reduce_axisb<Op, N - 1>{}(
- e, f, axis, std::tuple_cat(e_indices, std::make_tuple(i)),
- std::forward<FIndices>(f_indices));
+ if (axis == std::decay_t<E>::value - N) {
+ for (long i = 0, n = e.template shape<std::decay_t<E>::value - N>(); i < n; ++i) {
+ _reduce_axisb<Op, N - 1>{}(e, f, axis, std::tuple_cat(e_indices, std::make_tuple(i)),
+ std::forward<FIndices>(f_indices));
}
} else {
- for (long i = 0, n = e.template shape<std::decay<E>::type::value - N>();
- i < n; ++i) {
- _reduce_axis<Op, N - 1>{}(
- e, f, axis, std::tuple_cat(e_indices, std::make_tuple(i)),
- std::tuple_cat(f_indices, std::make_tuple(i)));
+ for (long i = 0, n = e.template shape<std::decay_t<E>::value - N>(); i < n; ++i) {
+ _reduce_axis<Op, N - 1>{}(e, f, axis, std::tuple_cat(e_indices, std::make_tuple(i)),
+ std::tuple_cat(f_indices, std::make_tuple(i)));
}
}
}
@@ -263,15 +241,14 @@ namespace numpy
template <class Op>
struct _reduce_axis<Op, 0> {
template <class E, class F, class EIndices, class FIndices>
- void operator()(E &&e, F &&f, long axis, EIndices &&e_indices,
- FIndices &&f_indices)
+ void operator()(E &&e, F &&f, long axis, EIndices &&e_indices, FIndices &&f_indices)
{
}
};
template <class Op, class E, class dtype>
- typename std::enable_if<E::value != 1, reduced_type<E, Op, dtype>>::type
- reduce(E const &array, long axis, dtype, types::none_type)
+ std::enable_if_t<E::value != 1, reduced_type<E, Op, dtype>> reduce(E const &array, long axis,
+ dtype, types::none_type)
{
if (axis < 0)
axis += E::value;
@@ -282,30 +259,27 @@ namespace numpy
auto next = std::copy(tmp.begin(), tmp.begin() + axis, shp.begin());
std::copy(tmp.begin() + axis + 1, tmp.end(), next);
reduced_type<E, Op, dtype> out{shp, builtins::None};
- std::fill(out.begin(), out.end(),
- utils::neutral<Op, typename E::dtype>::value);
+ std::fill(out.begin(), out.end(), utils::neutral<Op, typename E::dtype>::value);
return reduce<Op>(array, axis, types::none_type{}, out);
}
template <class Op, class E, class Out>
- typename std::enable_if<E::value != 1, reduced_type<E, Op>>::type
- reduce(E const &array, long axis, types::none_type, Out &&out)
+ std::enable_if_t<E::value != 1, reduced_type<E, Op>> reduce(E const &array, long axis,
+ types::none_type, Out &&out)
{
if (axis < 0)
axis += E::value;
if (axis < 0 || size_t(axis) >= E::value)
throw types::ValueError("axis out of bounds");
if (utils::no_broadcast(array)) {
- std::fill(out.begin(), out.end(),
- utils::neutral<Op, typename E::dtype>::value);
- _reduce_axis<Op, E::value>{}(array, std::forward<Out>(out), axis,
- std::make_tuple(), std::make_tuple());
+ std::fill(out.begin(), out.end(), utils::neutral<Op, typename E::dtype>::value);
+ _reduce_axis<Op, E::value>{}(array, std::forward<Out>(out), axis, std::make_tuple(),
+ std::make_tuple());
return std::forward<Out>(out);
} else {
if (axis == 0) {
- std::fill(out.begin(), out.end(),
- utils::neutral<Op, typename E::dtype>::value);
- return _reduce<Op, 1, types::novectorize /* not on scalars*/>{}(
- array, std::forward<Out>(out));
+ std::fill(out.begin(), out.end(), utils::neutral<Op, typename E::dtype>::value);
+ return _reduce<Op, 1, types::novectorize /* not on scalars*/>{}(array,
+ std::forward<Out>(out));
} else {
std::transform(array.begin(), array.end(), out.begin(),
[axis](typename E::const_iterator::value_type other) {
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp b/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp
index a7acb2d9060..c8c4fe311e9 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/repeat.hpp
@@ -21,25 +21,24 @@ namespace numpy
axis += N;
auto shape = sutils::getshape(expr);
- const long stride = std::accumulate(shape.begin() + axis + 1, shape.end(),
- 1L, std::multiplies<long>());
+ const long stride =
+ std::accumulate(shape.begin() + axis + 1, shape.end(), 1L, std::multiplies<long>());
shape[axis] *= repeats;
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> out(
- shape, builtins::None);
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> out(shape,
+ builtins::None);
auto out_iter = out.fbegin();
- for (auto iter = expr.fbegin(), end = expr.fend(); iter != end;
- iter += stride)
+ for (auto iter = expr.fbegin(), end = expr.fend(); iter != end; iter += stride)
for (int i = 0; i < repeats; ++i)
out_iter = std::copy(iter, iter + stride, out_iter);
return out;
}
template <class T, class pS>
- types::ndarray<T, types::pshape<long>>
- repeat(types::ndarray<T, pS> const &expr, long repeats, types::none_type axis)
+ types::ndarray<T, types::pshape<long>> repeat(types::ndarray<T, pS> const &expr, long repeats,
+ types::none_type axis)
{
- types::ndarray<T, types::pshape<long>> out(
- types::pshape<long>{expr.flat_size() * repeats}, builtins::None);
+ types::ndarray<T, types::pshape<long>> out(types::pshape<long>{expr.flat_size() * repeats},
+ builtins::None);
auto out_iter = out.fbegin();
for (auto iter = expr.fbegin(), end = expr.fend(); iter != end; ++iter)
for (int i = 0; i < repeats; ++i)
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp b/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp
index a17d1db88dc..e61a2b6ae2c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/roll.hpp
@@ -31,8 +31,8 @@ namespace numpy
namespace
{
template <class To, class From, size_t N>
- To _roll(To to, From from, long shift, long axis,
- types::array_tuple<long, N> const &shape, utils::int_<N - 1>)
+ To _roll(To to, From from, long shift, long axis, types::array_tuple<long, N> const &shape,
+ utils::int_<N - 1>)
{
long dim = shape[N - 1];
if (axis == N - 1) {
@@ -45,23 +45,20 @@ namespace numpy
}
template <class To, class From, size_t N, size_t M>
- typename std::enable_if<M != N - 1, To>::type
- _roll(To to, From from, long shift, long axis,
- types::array_tuple<long, N> const &shape, utils::int_<M>)
+ std::enable_if_t<M != N - 1, To> _roll(To to, From from, long shift, long axis,
+ types::array_tuple<long, N> const &shape, utils::int_<M>)
{
long dim = shape[M];
- long offset = std::accumulate(shape.begin() + M + 1, shape.end(), 1L,
- std::multiplies<long>());
+ long offset =
+ std::accumulate(shape.begin() + M + 1, shape.end(), 1L, std::multiplies<long>());
if (axis == M) {
const From split = from + (dim - shift) * offset;
- for (From iter = split, end = from + dim * offset; iter != end;
- iter += offset)
+ for (From iter = split, end = from + dim * offset; iter != end; iter += offset)
to = _roll(to, iter, shift, axis, shape, utils::int_<M + 1>());
for (From iter = from, end = split; iter != end; iter += offset)
to = _roll(to, iter, shift, axis, shape, utils::int_<M + 1>());
} else {
- for (From iter = from, end = from + dim * offset; iter != end;
- iter += offset)
+ for (From iter = from, end = from + dim * offset; iter != end; iter += offset)
to = _roll(to, iter, shift, axis, shape, utils::int_<M + 1>());
}
return to;
@@ -69,8 +66,7 @@ namespace numpy
} // namespace
template <class T, class pS>
- types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, long shift,
- long axis)
+ types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, long shift, long axis)
{
auto expr_shape = sutils::array(expr._shape);
if (expr_shape[axis] == 0)
@@ -81,16 +77,15 @@ namespace numpy
shift %= expr_shape[axis];
types::ndarray<T, pS> out(expr._shape, builtins::None);
- _roll(out.fbegin(), expr.fbegin(), shift, axis, expr_shape,
- utils::int_<0>());
+ _roll(out.fbegin(), expr.fbegin(), shift, axis, expr_shape, utils::int_<0>());
return out;
}
namespace
{
template <class To, class From, size_t N>
- To _rolls(To to, From from, long shifts[N],
- types::array_tuple<long, N> const &shape, utils::int_<N - 1>)
+ To _rolls(To to, From from, long shifts[N], types::array_tuple<long, N> const &shape,
+ utils::int_<N - 1>)
{
long dim = shape[N - 1];
if (long shift = shifts[N - 1]) {
@@ -103,23 +98,21 @@ namespace numpy
}
template <class To, class From, size_t N, size_t M>
- typename std::enable_if<M != N - 1, To>::type
- _rolls(To to, From from, long shifts[N],
- types::array_tuple<long, N> const &shape, utils::int_<M>)
+ std::enable_if_t<M != N - 1, To> _rolls(To to, From from, long shifts[N],
+ types::array_tuple<long, N> const &shape,
+ utils::int_<M>)
{
long dim = shape[M];
- long offset = std::accumulate(shape.begin() + M + 1, shape.end(), 1L,
- std::multiplies<long>());
+ long offset =
+ std::accumulate(shape.begin() + M + 1, shape.end(), 1L, std::multiplies<long>());
if (long shift = shifts[M]) {
const From split = from + (dim - shift) * offset;
- for (From iter = split, end = from + dim * offset; iter != end;
- iter += offset)
+ for (From iter = split, end = from + dim * offset; iter != end; iter += offset)
to = _rolls(to, iter, shifts, shape, utils::int_<M + 1>());
for (From iter = from; iter != split; iter += offset)
to = _rolls(to, iter, shifts, shape, utils::int_<M + 1>());
} else {
- for (From iter = from, end = from + dim * offset; iter != end;
- iter += offset)
+ for (From iter = from, end = from + dim * offset; iter != end; iter += offset)
to = _rolls(to, iter, shifts, shape, utils::int_<M + 1>());
}
return to;
@@ -127,8 +120,7 @@ namespace numpy
} // namespace
template <class T, class pS, size_t N>
- types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr,
- types::array_tuple<long, N> shifts,
+ types::ndarray<T, pS> roll(types::ndarray<T, pS> const &expr, types::array_tuple<long, N> shifts,
types::array_tuple<long, N> axes)
{
constexpr long ndim = types::ndarray<T, pS>::value;
@@ -145,8 +137,7 @@ namespace numpy
}
types::ndarray<T, pS> out(expr._shape, builtins::None);
- _rolls(out.fbegin(), expr.fbegin(), axes_shifts, expr_shape,
- utils::int_<0>());
+ _rolls(out.fbegin(), expr.fbegin(), axes_shifts, expr_shape, utils::int_<0>());
return out;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp b/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp
index fc88ab0f1b7..b7b9ea2ccec 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/searchsorted.hpp
@@ -36,14 +36,13 @@ namespace numpy
else if (side[0] == "r")
return false;
else
- throw types::ValueError("'" + side +
- "' is an invalid value for keyword 'side'");
+ throw types::ValueError("'" + side + "' is an invalid value for keyword 'side'");
}
} // namespace details
template <class T, class U>
- typename std::enable_if<!types::is_numexpr_arg<T>::value, long>::type
- searchsorted(U const &a, T const &v, types::str const &side)
+ std::enable_if_t<!types::is_numexpr_arg<T>::value, long> searchsorted(U const &a, T const &v,
+ types::str const &side)
{
bool left = details::issearchsortedleft(side);
return details::searchsorted(a, v, left);
@@ -52,37 +51,31 @@ namespace numpy
namespace
{
template <class E, class I0, class I1>
- void _search_sorted(E const &a, I0 ibegin, I0 iend, I1 obegin, bool left,
- utils::int_<1>)
+ void _search_sorted(E const &a, I0 ibegin, I0 iend, I1 obegin, bool left, utils::int_<1>)
{
for (; ibegin != iend; ++ibegin, ++obegin)
*obegin = details::searchsorted(a, *ibegin, left);
}
template <class E, class I0, class I1, size_t N>
- void _search_sorted(E const &a, I0 ibegin, I0 iend, I1 obegin, bool left,
- utils::int_<N>)
+ void _search_sorted(E const &a, I0 ibegin, I0 iend, I1 obegin, bool left, utils::int_<N>)
{
for (; ibegin != iend; ++ibegin, ++obegin)
- _search_sorted(a, (*ibegin).begin(), (*ibegin).end(), (*obegin).begin(),
- left, utils::int_<N - 1>());
+ _search_sorted(a, (*ibegin).begin(), (*ibegin).end(), (*obegin).begin(), left,
+ utils::int_<N - 1>());
}
} // namespace
template <class E, class T>
- typename std::enable_if<
- types::is_numexpr_arg<E>::value,
- types::ndarray<long, types::array_tuple<long, E::value>>>::type
+ std::enable_if_t<types::is_numexpr_arg<E>::value,
+ types::ndarray<long, types::array_tuple<long, E::value>>>
searchsorted(T const &a, E const &v, types::str const &side)
{
- static_assert(T::value == 1,
- "Not Implemented : searchsorted for dimension != 1");
+ static_assert(T::value == 1, "Not Implemented : searchsorted for dimension != 1");
bool left = details::issearchsortedleft(side);
- types::ndarray<long, types::array_tuple<long, E::value>> out(
- asarray(v)._shape, builtins::None);
- _search_sorted(a, v.begin(), v.end(), out.begin(), left,
- utils::int_<E::value>());
+ types::ndarray<long, types::array_tuple<long, E::value>> out(asarray(v)._shape, builtins::None);
+ _search_sorted(a, v.begin(), v.end(), out.begin(), left, utils::int_<E::value>());
return out;
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/select.hpp b/contrib/python/pythran/pythran/pythonic/numpy/select.hpp
index 3b00ce46ef0..18d781745a1 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/select.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/select.hpp
@@ -17,12 +17,11 @@ namespace numpy
// is computed without information from neighbor.
//
template <class Ichoice, class Icond, class Iout, class Isel>
- long _select(Ichoice ibegin, Ichoice iend, Iout obegin, Isel sbegin,
- Icond cbegin, long size, utils::int_<1>)
+ long _select(Ichoice ibegin, Ichoice iend, Iout obegin, Isel sbegin, Icond cbegin, long size,
+ utils::int_<1>)
{
static_assert(std::is_same<Ichoice, int>::value, "");
- for (; ibegin != iend && size != 0;
- ++ibegin, ++obegin, ++sbegin, ++cbegin) {
+ for (; ibegin != iend && size != 0; ++ibegin, ++obegin, ++sbegin, ++cbegin) {
// If elements it not already selected && condition match, copy it!
if (!*sbegin && *cbegin) {
*obegin = *ibegin;
@@ -34,14 +33,12 @@ namespace numpy
}
template <class Ichoice, class Icond, class Iout, class Isel, size_t N>
- long _select(Ichoice ibegin, Ichoice iend, Iout obegin, Isel sbegin,
- Icond cbegin, long size, utils::int_<N>)
+ long _select(Ichoice ibegin, Ichoice iend, Iout obegin, Isel sbegin, Icond cbegin, long size,
+ utils::int_<N>)
{
- for (; ibegin != iend && size != 0;
- ++ibegin, ++obegin, ++sbegin, ++cbegin)
- size = _select((*ibegin).begin(), (*ibegin).end(), (*obegin).begin(),
- (*sbegin).begin(), (*cbegin).begin(), size,
- utils::int_<N - 1>());
+ for (; ibegin != iend && size != 0; ++ibegin, ++obegin, ++sbegin, ++cbegin)
+ size = _select((*ibegin).begin(), (*ibegin).end(), (*obegin).begin(), (*sbegin).begin(),
+ (*cbegin).begin(), size, utils::int_<N - 1>());
return size;
}
} // namespace
@@ -52,15 +49,13 @@ namespace numpy
{
constexpr size_t N = L::value - 1;
auto &&choicelist0_shape = sutils::getshape(choicelist[0]);
- types::ndarray<typename L::dtype, types::array_tuple<long, N>> out(
- choicelist0_shape, _default);
- types::ndarray<typename L::dtype, types::array_tuple<long, N>> selected(
- choicelist0_shape, false);
+ types::ndarray<typename L::dtype, types::array_tuple<long, N>> out(choicelist0_shape, _default);
+ types::ndarray<typename L::dtype, types::array_tuple<long, N>> selected(choicelist0_shape,
+ false);
long size = selected.flat_size();
for (long i = 0; i < condlist.size() && size != 0; i++)
- size =
- _select(choicelist[i].begin(), choicelist[i].end(), out.begin(),
- selected.begin(), condlist.begin(), size, utils::int_<N>());
+ size = _select(choicelist[i].begin(), choicelist[i].end(), out.begin(), selected.begin(),
+ condlist.begin(), size, utils::int_<N>());
return out;
}
@@ -68,8 +63,8 @@ namespace numpy
types::ndarray<typename L::dtype, sutils::pop_head_t<typename L::shape_t>>
select_helper(C const &condlist, L const &choicelist, T _default)
{
- types::ndarray<typename L::dtype, sutils::pop_head_t<typename L::shape_t>>
- out(sutils::getshape(choicelist[0]), _default);
+ types::ndarray<typename L::dtype, sutils::pop_head_t<typename L::shape_t>> out(
+ sutils::getshape(choicelist[0]), _default);
for (long i = 0; i < out.flat_size(); ++i)
for (long j = 0; j < (long)condlist.size(); ++j)
if (condlist[j].buffer[i]) {
@@ -80,40 +75,34 @@ namespace numpy
}
template <class T, class TpS, class U, class UpS>
- typename std::enable_if<std::tuple_size<TpS>::value ==
- std::tuple_size<UpS>::value,
- types::ndarray<T, TpS>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, TpS>>
select(types::list<types::ndarray<U, UpS>> const &condlist,
types::list<types::ndarray<T, TpS>> const &choicelist, T _default)
{
return select_helper(condlist, choicelist, _default);
}
template <class T, class TpS, class U, class UpS, size_t M>
- typename std::enable_if<std::tuple_size<TpS>::value ==
- std::tuple_size<UpS>::value,
- types::ndarray<T, TpS>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, TpS>>
select(types::static_list<types::ndarray<U, UpS>, M> const &condlist,
- types::static_list<types::ndarray<T, TpS>, M> const &choicelist,
- T _default)
+ types::static_list<types::ndarray<T, TpS>, M> const &choicelist, T _default)
{
return select_helper(condlist, choicelist, _default);
}
template <class T, class TpS, class U, class UpS, size_t M>
- typename std::enable_if<std::tuple_size<TpS>::value ==
- std::tuple_size<UpS>::value,
- types::ndarray<T, TpS>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, TpS>>
select(types::static_list<types::ndarray<U, UpS>, M> const &condlist,
types::list<types::ndarray<T, TpS>> const &choicelist, T _default)
{
return select_helper(condlist, choicelist, _default);
}
template <class T, class TpS, class U, class UpS, size_t M>
- typename std::enable_if<std::tuple_size<TpS>::value ==
- std::tuple_size<UpS>::value,
- types::ndarray<T, TpS>>::type
+ std::enable_if_t<std::tuple_size<TpS>::value == std::tuple_size<UpS>::value,
+ types::ndarray<T, TpS>>
select(types::list<types::ndarray<U, UpS>> const &condlist,
- types::static_list<types::ndarray<T, TpS>, M> const &choicelist,
- T _default)
+ types::static_list<types::ndarray<T, TpS>, M> const &choicelist, T _default)
{
return select_helper(condlist, choicelist, _default);
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/setdiff1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/setdiff1d.hpp
index 0325efcc435..b2b5b62bd0c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/setdiff1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/setdiff1d.hpp
@@ -19,12 +19,10 @@ namespace numpy
namespace impl
{
- template <typename InputIterator1, typename InputIterator2,
- typename OutputIterator>
- OutputIterator
- set_difference_unique(InputIterator1 first1, InputIterator1 last1,
- InputIterator2 first2, InputIterator2 last2,
- OutputIterator result)
+ template <typename InputIterator1, typename InputIterator2, typename OutputIterator>
+ OutputIterator set_difference_unique(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, InputIterator2 last2,
+ OutputIterator result)
{
while (first1 != last1 && first2 != last2) {
auto const t1 = *first1;
@@ -72,11 +70,10 @@ namespace numpy
dtype *out_last;
if (assume_unique) {
- out_last = std::set_difference(far1.fbegin(), far1.fend(), far2.fbegin(),
- far2.fend(), out);
+ out_last = std::set_difference(far1.fbegin(), far1.fend(), far2.fbegin(), far2.fend(), out);
} else {
- out_last = impl::set_difference_unique(far1.fbegin(), far1.fend(),
- far2.fbegin(), far2.fend(), out);
+ out_last =
+ impl::set_difference_unique(far1.fbegin(), far1.fend(), far2.fbegin(), far2.fend(), out);
}
auto size = out_last - out;
out = utils::reallocate(out, size);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/short_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/short_.hpp
index a4e9b5dd8f1..272796a7220 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/short_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/short_.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::short_>::convert(numpy::functor::short_ const &c)
+{
+ return (PyObject *)&PyShortArrType_Type;
+}
+
+inline bool from_python<numpy::functor::short_>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyShortArrType_Type;
+}
+
+inline numpy::functor::short_ from_python<numpy::functor::short_>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp
index 1fb91dccdcc..528eed05b15 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/sort.hpp
@@ -9,8 +9,8 @@ namespace numpy
{
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
- sort(E const &expr, long axis)
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> sort(E const &expr,
+ long axis)
{
auto out = functor::array{}(expr);
ndarray::sort(out, axis);
@@ -18,8 +18,8 @@ namespace numpy
}
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, 1>>
- sort(E const &expr, types::none_type)
+ types::ndarray<typename E::dtype, types::array_tuple<long, 1>> sort(E const &expr,
+ types::none_type)
{
auto out = functor::array{}(expr).flat();
ndarray::sort(out, types::none_type{});
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/split.hpp b/contrib/python/pythran/pythran/pythonic/numpy/split.hpp
index 9e22cef39d2..74aa50c0a2a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/split.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/split.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T, class pS>
- types::list<
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>
+ types::list<types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>
split(types::ndarray<T, pS> const &a, long nb_split)
{
if (a.flat_size() % nb_split != 0)
@@ -21,18 +20,16 @@ namespace numpy
}
template <class T, class pS, class I>
- typename std::enable_if<
+ std::enable_if_t<
types::is_iterable<I>::value,
- types::list<types::ndarray<
- T, types::array_tuple<long, std::tuple_size<pS>::value>>>>::type
+ types::list<types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>>
split(types::ndarray<T, pS> const &a, I const &split_mask)
{
return array_split(a, split_mask);
}
template <class E, class I>
- types::list<
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>>
+ types::list<types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>>
split(E const &a, I const &)
{
throw std::runtime_error("split only partially implemented");
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp b/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp
index 2d5de6b7091..d286f048b10 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/stack.hpp
@@ -19,13 +19,10 @@ namespace numpy
if (builtins::len(args) == 0)
throw pythonic::types::ValueError("need at least one array to stack");
auto shape = sutils::getshape(args[0]);
- constexpr long N =
- std::tuple_size<decltype(shape)>::value; // The length of the shape
- // array.
- auto values = sutils::array(
- shape); // You can't do shape[i] but you can do shape.array()[i]
- types::array_tuple<long, N + 1>
- new_shape; // A new array that's 1 element longer than shape.
+ constexpr long N = std::tuple_size<decltype(shape)>::value; // The length of the shape
+ // array.
+ auto values = sutils::array(shape); // You can't do shape[i] but you can do shape.array()[i]
+ types::array_tuple<long, N + 1> new_shape; // A new array that's 1 element longer than shape.
// Insert a "0" at the position indicated by axis.
for (long i = 0; i < N + 1; i++) {
if (i < axis)
@@ -37,9 +34,8 @@ namespace numpy
}
// Create a new empty list.
- types::list<types::ndarray<
- typename ArraySequence::value_type::dtype,
- types::array_tuple<long, ArraySequence::value_type::value + 1>>>
+ types::list<types::ndarray<typename ArraySequence::value_type::dtype,
+ types::array_tuple<long, ArraySequence::value_type::value + 1>>>
bi(0);
// Push the resized arrays into the list.
for (auto &&arg : args) {
@@ -49,27 +45,24 @@ namespace numpy
return concatenate(bi, axis);
}
template <size_t... Is, class... Tys>
- types::ndarray<
- typename details::stack_helper_t<Tys...>::dtype,
- types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>>
- stack(std::tuple<Tys...> const &args, long axis, utils::index_sequence<Is...>)
+ types::ndarray<typename details::stack_helper_t<Tys...>::dtype,
+ types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>>
+ stack(std::tuple<Tys...> const &args, long axis, std::index_sequence<Is...>)
{
types::array_tuple<
- types::ndarray<
- typename details::stack_helper_t<Tys...>::dtype,
- types::array_tuple<long, details::stack_helper_t<Tys...>::value>>,
+ types::ndarray<typename details::stack_helper_t<Tys...>::dtype,
+ types::array_tuple<long, details::stack_helper_t<Tys...>::value>>,
sizeof...(Tys)>
vargs{{std::get<Is>(args)...}};
return stack(vargs, axis);
}
template <class... Tys>
- types::ndarray<
- typename details::stack_helper_t<Tys...>::dtype,
- types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>>
+ types::ndarray<typename details::stack_helper_t<Tys...>::dtype,
+ types::array_tuple<long, details::stack_helper_t<Tys...>::value + 1>>
stack(std::tuple<Tys...> const &args, long axis)
{
- return stack(args, axis, utils::make_index_sequence<sizeof...(Tys)>());
+ return stack(args, axis, std::make_index_sequence<sizeof...(Tys)>());
}
} // namespace numpy
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp b/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp
index 76be6d48b30..478fbefc2ae 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/std_.hpp
@@ -10,8 +10,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class... Args>
- auto std_(Args &&...args)
- -> decltype(functor::sqrt{}(var(std::forward<Args>(args)...)))
+ auto std_(Args &&...args) -> decltype(functor::sqrt{}(var(std::forward<Args>(args)...)))
{
return functor::sqrt{}(var(std::forward<Args>(args)...));
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp b/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp
index bc83a64a458..ac162e8c82a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/swapaxes.hpp
@@ -10,12 +10,10 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- auto swapaxes(T &&a, int axis1, int axis2)
- -> decltype(functor::transpose{}(
- std::forward<T>(a),
- std::declval<types::array_tuple<long, std::decay<T>::type::value>>()))
+ auto swapaxes(T &&a, int axis1, int axis2) -> decltype(functor::transpose{}(
+ std::forward<T>(a), std::declval<types::array_tuple<long, std::decay_t<T>::value>>()))
{
- constexpr long N = std::decay<T>::type::value;
+ constexpr long N = std::decay_t<T>::value;
types::array_tuple<long, N> t;
for (unsigned long i = 0; i < N; ++i)
t[i] = i;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/take.hpp b/contrib/python/pythran/pythran/pythonic/numpy/take.hpp
index 7ab952f8702..de7d2d90765 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/take.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/take.hpp
@@ -8,8 +8,7 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class F, class T>
- auto take(T &&expr, F &&indices)
- -> decltype(std::forward<T>(expr)[std::forward<T>(indices)])
+ auto take(T &&expr, F &&indices) -> decltype(std::forward<T>(expr)[std::forward<T>(indices)])
{
return expr[indices];
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp b/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp
index a9590003a3f..17b98ae7275 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/tile.hpp
@@ -28,8 +28,8 @@ namespace numpy
} // namespace
template <class E>
- types::ndarray<typename E::dtype, types::array_tuple<long, E::value>>
- tile(E const &expr, long reps)
+ types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> tile(E const &expr,
+ long reps)
{
size_t n = expr.flat_size();
types::ndarray<typename E::dtype, types::array_tuple<long, E::value>> out(
@@ -42,15 +42,11 @@ namespace numpy
}
template <size_t Shift, class R, class S, size_t... Is>
- types::array_tuple<long, sizeof...(Is)>
- tile_init_shape(R const &reps, S const &expr_shape,
- utils::index_sequence<Is...>)
+ types::array_tuple<long, sizeof...(Is)> tile_init_shape(R const &reps, S const &expr_shape,
+ std::index_sequence<Is...>)
{
constexpr size_t M = S::value;
- return {
- {(reps[Is] * ((Is < Shift) ? 1
- : expr_shape.template shape < (Is < M) ? Is
- : 0 > ()))...}};
+ return {{(reps[Is] * ((Is < Shift) ? 1 : expr_shape.template shape<(Is < M) ? Is : 0>()))...}};
}
template <class E, size_t N>
@@ -58,15 +54,13 @@ namespace numpy
tile(E const &expr, types::array_tuple<long, N> const &reps)
{
size_t n = expr.flat_size();
- types::array_tuple<long, N> shape = tile_init_shape<N - E::value>(
- reps, expr, utils::make_index_sequence<N>());
+ types::array_tuple<long, N> shape =
+ tile_init_shape<N - E::value>(reps, expr, std::make_index_sequence<N>());
long last_rep = (E::value == N) ? std::get<N - 1>(reps) : 1;
- types::ndarray<typename E::dtype, types::array_tuple<long, N>> out(
- shape, builtins::None);
+ types::ndarray<typename E::dtype, types::array_tuple<long, N>> out(shape, builtins::None);
auto out_iter = out.fbegin();
- _tile(expr.begin(), expr.end(), out_iter, last_rep,
- utils::int_<E::value>());
+ _tile(expr.begin(), expr.end(), out_iter, last_rep, utils::int_<E::value>());
size_t nreps = out.flat_size() / (n * last_rep);
for (size_t i = 1; i < nreps; ++i)
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp b/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp
index 9ec8b874a0b..a3cc620763f 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/trace.hpp
@@ -18,8 +18,7 @@ namespace numpy
typename T::dtype res = 0;
long y_offset = std::max(-offset, 0);
long x_offset = std::max(0, offset);
- long size = std::min(expr.flat_size() - y_offset,
- expr.fast(0).flat_size() - x_offset);
+ long size = std::min(expr.flat_size() - y_offset, expr.fast(0).flat_size() - x_offset);
if (offset < 0)
for (long i = 0; i < size; i++)
res += expr.fast(i + offset).fast(i);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp b/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp
index 36f5fdba803..93972d221f7 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/transpose.hpp
@@ -16,8 +16,8 @@ namespace numpy
namespace
{
template <class T, class pS, class O, class Indices, class S, class Perm>
- O const *_transposer(types::ndarray<T, pS> &expr, O const *iter,
- Indices &indices, S const &shape, Perm const &perm,
+ O const *_transposer(types::ndarray<T, pS> &expr, O const *iter, Indices &indices,
+ S const &shape, Perm const &perm,
utils::int_<std::tuple_size<pS>::value - 1>)
{
for (long i = 0, n = shape[std::tuple_size<pS>::value - 1]; i < n; ++i) {
@@ -28,25 +28,21 @@ namespace numpy
return iter;
}
- template <class T, class pS, class O, class Indices, class S, class Perm,
- size_t I>
- typename std::enable_if<std::tuple_size<pS>::value - 1 != I,
- O const *>::type
- _transposer(types::ndarray<T, pS> &expr, O const *iter, Indices &indices,
- S const &shape, Perm const &perm, utils::int_<I>)
+ template <class T, class pS, class O, class Indices, class S, class Perm, size_t I>
+ std::enable_if_t<std::tuple_size<pS>::value - 1 != I, O const *>
+ _transposer(types::ndarray<T, pS> &expr, O const *iter, Indices &indices, S const &shape,
+ Perm const &perm, utils::int_<I>)
{
for (long i = 0, n = shape[I]; i < n; ++i) {
indices[perm[I]] = i;
- iter =
- _transposer(expr, iter, indices, shape, perm, utils::int_<I + 1>());
+ iter = _transposer(expr, iter, indices, shape, perm, utils::int_<I + 1>());
}
indices[perm[I]] = 0;
return iter;
}
template <class T, class pS>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- _transposer(types::ndarray<T, pS> const &a,
- long const l[std::tuple_size<pS>::value])
+ _transposer(types::ndarray<T, pS> const &a, long const l[std::tuple_size<pS>::value])
{
auto shape = sutils::getshape(a);
types::array_tuple<long, std::tuple_size<pS>::value> shp;
@@ -57,8 +53,8 @@ namespace numpy
for (std::size_t i = 0; i < std::tuple_size<pS>::value; ++i)
perm[l[i]] = i;
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- new_array(shp, builtins::None);
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>> new_array(
+ shp, builtins::None);
auto const *iter = a.buffer;
types::array_tuple<long, std::tuple_size<pS>::value> indices;
@@ -69,11 +65,9 @@ namespace numpy
} // namespace
template <class T, class pS>
- typename std::enable_if<
- (std::tuple_size<pS>::value > 2),
- types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>::
- type
- transpose(types::ndarray<T, pS> const &a)
+ std::enable_if_t<(std::tuple_size<pS>::value > 2),
+ types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>>
+ transpose(types::ndarray<T, pS> const &a)
{
long t[std::tuple_size<pS>::value];
for (unsigned long i = 0; i < std::tuple_size<pS>::value; ++i)
@@ -83,8 +77,7 @@ namespace numpy
template <class T, class pS, size_t M>
types::ndarray<T, types::array_tuple<long, std::tuple_size<pS>::value>>
- transpose(types::ndarray<T, pS> const &a,
- types::array_tuple<long, M> const &t)
+ transpose(types::ndarray<T, pS> const &a, types::array_tuple<long, M> const &t)
{
static_assert(std::tuple_size<pS>::value == M, "axes don't match array");
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp b/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp
index 8e42ba0e0b7..1fa911559be 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/tri.hpp
@@ -11,8 +11,8 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class dtype>
- types::ndarray<typename dtype::type, types::pshape<long, long>>
- tri(long N, long M, long k, dtype d)
+ types::ndarray<typename dtype::type, types::pshape<long, long>> tri(long N, long M, long k,
+ dtype d)
{
if (M == -1)
M = N;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/trim_zeros.hpp b/contrib/python/pythran/pythran/pythonic/numpy/trim_zeros.hpp
index 89b8be558ad..c2f1afab873 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/trim_zeros.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/trim_zeros.hpp
@@ -11,17 +11,15 @@ PYTHONIC_NS_BEGIN
namespace numpy
{
template <class T>
- types::numpy_gexpr<T, types::cstride_normalized_slice<1>>
- trim_zeros(T const &expr, types::str const &trim)
+ types::numpy_gexpr<T, types::cstride_normalized_slice<1>> trim_zeros(T const &expr,
+ types::str const &trim)
{
- static_assert(T::value == 1,
- "Not implemented : trim_zeroes only works for 1D array");
+ static_assert(T::value == 1, "Not implemented : trim_zeroes only works for 1D array");
long begin = 0;
long end = expr.flat_size();
if (trim.find("f") != -1)
- begin = std::find_if(expr.begin(), expr.end(),
- [](typename T::dtype i) { return i != 0; }) -
+ begin = std::find_if(expr.begin(), expr.end(), [](typename T::dtype i) { return i != 0; }) -
expr.begin();
if (trim.find("b") != -1)
while (*(expr.begin() + --end) != 0)
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ubyte.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ubyte.hpp
index 67936f26531..bd7cc69e914 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ubyte.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ubyte.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::ubyte>::convert(numpy::functor::ubyte const &c)
+{
+ return (PyObject *)&PyUByteArrType_Type;
+}
+
+inline bool from_python<numpy::functor::ubyte>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUByteArrType_Type;
+}
+
+inline numpy::functor::ubyte from_python<numpy::functor::ubyte>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp
index 601fbd98017..bead84becae 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ufunc_accumulate.hpp
@@ -15,11 +15,9 @@ namespace numpy
{
template <class T, class dtype>
auto accumulate(T &&a, long axis, dtype d)
- -> decltype(partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a),
- axis, d))
+ -> decltype(partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a), axis, d))
{
- return partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a), axis,
- d);
+ return partial_sum<numpy::functor::UFUNC_NAME>(std::forward<T>(a), axis, d);
}
} // namespace UFUNC_NAME
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/uint.hpp b/contrib/python/pythran/pythran/pythonic/numpy/uint.hpp
index 75e75d28360..1fca195c63c 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/uint.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/uint.hpp
@@ -34,4 +34,35 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::uint>::convert(numpy::functor::uint const &c)
+{
+ return (PyObject *)&PyUIntArrType_Type;
+}
+
+inline bool from_python<numpy::functor::uint>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUIntArrType_Type ||
+#if NPY_SIZEOF_INTP == NPY_SIZEOF_LONG
+ obj == (PyObject *)&PyUInt64ArrType_Type
+#else
+ obj == (PyObject *)&PyUInt32ArrType_Type
+#endif
+ ;
+}
+
+inline numpy::functor::uint from_python<numpy::functor::uint>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/uint16.hpp b/contrib/python/pythran/pythran/pythonic/numpy/uint16.hpp
index 136b6ebbf98..7aa980af3e7 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/uint16.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/uint16.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::uint16>::convert(numpy::functor::uint16 const &c)
+{
+ return (PyObject *)&PyUInt16ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::uint16>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUInt16ArrType_Type;
+}
+
+inline numpy::functor::uint16 from_python<numpy::functor::uint16>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/uint32.hpp b/contrib/python/pythran/pythran/pythonic/numpy/uint32.hpp
index ae328a01a44..7012d6cdbcf 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/uint32.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/uint32.hpp
@@ -33,4 +33,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::uint32>::convert(numpy::functor::uint32 const &c)
+{
+ return (PyObject *)&PyUInt32ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::uint32>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUInt32ArrType_Type;
+}
+
+inline numpy::functor::uint32 from_python<numpy::functor::uint32>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/uint64.hpp b/contrib/python/pythran/pythran/pythonic/numpy/uint64.hpp
index 39973a556d3..fecc3ce870e 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/uint64.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/uint64.hpp
@@ -33,4 +33,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::uint64>::convert(numpy::functor::uint64 const &c)
+{
+ return (PyObject *)&PyUInt64ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::uint64>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUInt64ArrType_Type;
+}
+
+inline numpy::functor::uint64 from_python<numpy::functor::uint64>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/uint8.hpp b/contrib/python/pythran/pythran/pythonic/numpy/uint8.hpp
index ada239aa891..8cd95e8464a 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/uint8.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/uint8.hpp
@@ -33,5 +33,29 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::uint8>::convert(numpy::functor::uint8 const &c)
+{
+ return (PyObject *)&PyUInt8ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::uint8>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUInt8ArrType_Type;
+}
+
+inline numpy::functor::uint8 from_python<numpy::functor::uint8>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/uintc.hpp b/contrib/python/pythran/pythran/pythonic/numpy/uintc.hpp
index bcb68c5f63f..356a62c75c8 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/uintc.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/uintc.hpp
@@ -33,5 +33,35 @@ namespace numpy
#include "pythonic/types/numpy_nary_expr.hpp"
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::uintc>::convert(numpy::functor::uintc const &c)
+{
+ if (sizeof(unsigned) == 4)
+ return (PyObject *)&PyUInt32ArrType_Type;
+ else
+ return (PyObject *)&PyUInt64ArrType_Type;
+}
+
+inline bool from_python<numpy::functor::uintc>::is_convertible(PyObject *obj)
+{
+ if (sizeof(unsigned) == 4)
+ return obj == (PyObject *)&PyUInt32ArrType_Type;
+ else
+ return obj == (PyObject *)&PyUInt64ArrType_Type;
+}
+
+inline numpy::functor::uintc from_python<numpy::functor::uintc>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp b/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp
index e9e7ff67775..334d866493d 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/union1d.hpp
@@ -30,13 +30,11 @@ namespace numpy
} // namespace
template <class E, class F>
- types::ndarray<
- typename __combined<typename E::dtype, typename F::dtype>::type,
- types::pshape<long>>
+ types::ndarray<typename __combined<typename E::dtype, typename F::dtype>::type,
+ types::pshape<long>>
union1d(E const &e, F const &f)
{
- std::set<typename __combined<typename E::dtype, typename F::dtype>::type>
- res;
+ std::set<typename __combined<typename E::dtype, typename F::dtype>::type> res;
_union1d(e.begin(), e.end(), res, utils::int_<E::value>());
_union1d(f.begin(), f.end(), res, utils::int_<F::value>());
return {res};
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/unique.hpp b/contrib/python/pythran/pythran/pythonic/numpy/unique.hpp
index 822077f5fde..8e04ef18ed9 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/unique.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/unique.hpp
@@ -44,12 +44,10 @@ namespace numpy
void _unique2(I begin, I end, O0 &out0, O1 &out1, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _unique2((*begin).begin(), (*begin).end(), out0, out1, i,
- utils::int_<N - 1>());
+ _unique2((*begin).begin(), (*begin).end(), out0, out1, i, utils::int_<N - 1>());
}
template <class I, class O0, class O1, class O2>
- void _unique3(I begin, I end, O0 &out0, O1 &out1, O2 &out2, long &i,
- utils::int_<1>)
+ void _unique3(I begin, I end, O0 &out0, O1 &out1, O2 &out2, long &i, utils::int_<1>)
{
for (; begin != end; ++begin, ++i) {
auto pair = out0.insert(*begin);
@@ -59,17 +57,14 @@ namespace numpy
}
}
template <class I, class O0, class O1, class O2, size_t N>
- void _unique3(I begin, I end, O0 &out0, O1 &out1, O2 &out2, long &i,
- utils::int_<N>)
+ void _unique3(I begin, I end, O0 &out0, O1 &out1, O2 &out2, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _unique3((*begin).begin(), (*begin).end(), out0, out1, out2, i,
- utils::int_<N - 1>());
+ _unique3((*begin).begin(), (*begin).end(), out0, out1, out2, i, utils::int_<N - 1>());
}
template <class I, class O1, class O2, class O3>
- void _unique4(I begin, I end, O1 &out1, O2 &out2, O3 &out3, long &i,
- utils::int_<1>)
+ void _unique4(I begin, I end, O1 &out1, O2 &out2, O3 &out3, long &i, utils::int_<1>)
{
for (; begin != end; ++begin, ++i) {
auto res = out3.insert(std::make_pair(*begin, 0));
@@ -81,12 +76,10 @@ namespace numpy
}
}
template <class I, class O1, class O2, class O3, size_t N>
- void _unique4(I begin, I end, O1 &out1, O2 &out2, O3 &out3, long &i,
- utils::int_<N>)
+ void _unique4(I begin, I end, O1 &out1, O2 &out2, O3 &out3, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _unique4((*begin).begin(), (*begin).end(), out1, out2, out3, i,
- utils::int_<N - 1>());
+ _unique4((*begin).begin(), (*begin).end(), out1, out2, out3, i, utils::int_<N - 1>());
}
template <class I, class O0, class O2>
void _unique5(I begin, I end, O0 &out0, O2 &out2, long &i, utils::int_<1>)
@@ -100,8 +93,7 @@ namespace numpy
void _unique5(I begin, I end, O0 &out0, O2 &out2, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _unique5((*begin).begin(), (*begin).end(), out0, out2, i,
- utils::int_<N - 1>());
+ _unique5((*begin).begin(), (*begin).end(), out0, out2, i, utils::int_<N - 1>());
}
template <class I, class O1, class O3>
@@ -119,8 +111,7 @@ namespace numpy
void _unique6(I begin, I end, O1 &out1, O3 &out3, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _unique6((*begin).begin(), (*begin).end(), out1, out3, i,
- utils::int_<N - 1>());
+ _unique6((*begin).begin(), (*begin).end(), out1, out3, i, utils::int_<N - 1>());
}
template <class I, class O2, class O3>
@@ -136,8 +127,7 @@ namespace numpy
void _unique7(I begin, I end, O2 &out2, O3 &out3, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _unique7((*begin).begin(), (*begin).end(), out2, out3, i,
- utils::int_<N - 1>());
+ _unique7((*begin).begin(), (*begin).end(), out2, out3, i, utils::int_<N - 1>());
}
template <class I, class O3>
@@ -152,8 +142,7 @@ namespace numpy
void _unique8(I begin, I end, O3 &out3, long &i, utils::int_<N>)
{
for (; begin != end; ++begin)
- _unique8((*begin).begin(), (*begin).end(), out3, i,
- utils::int_<N - 1>());
+ _unique8((*begin).begin(), (*begin).end(), out3, i, utils::int_<N - 1>());
}
} // namespace
@@ -175,16 +164,14 @@ namespace numpy
std::set<dtype, std::less<dtype>, utils::allocator<dtype>> res;
std::vector<long, utils::allocator<long>> return_index_res;
long i = 0;
- _unique2(expr.begin(), expr.end(), res, return_index_res, i,
- utils::int_<E::value>());
- return std::make_tuple(
- types::ndarray<dtype, types::pshape<long>>(res),
- types::ndarray<long, types::pshape<long>>(return_index_res));
+ _unique2(expr.begin(), expr.end(), res, return_index_res, i, utils::int_<E::value>());
+ return std::make_tuple(types::ndarray<dtype, types::pshape<long>>(res),
+ types::ndarray<long, types::pshape<long>>(return_index_res));
}
template <class E>
- types::ndarray<typename E::dtype, types::pshape<long>>
- unique(E const &expr, types::false_immediate return_index)
+ types::ndarray<typename E::dtype, types::pshape<long>> unique(E const &expr,
+ types::false_immediate return_index)
{
using dtype = typename E::dtype;
std::set<dtype, std::less<dtype>, utils::allocator<dtype>> res;
@@ -195,24 +182,20 @@ namespace numpy
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::true_immediate return_inverse)
+ unique(E const &expr, types::false_immediate return_index, types::true_immediate return_inverse)
{
using dtype = typename E::dtype;
std::set<dtype, std::less<dtype>, utils::allocator<dtype>> res;
types::ndarray<long, types::pshape<long>> return_inverse_res(
types::pshape<long>{expr.flat_size()}, builtins::None);
long i = 0;
- _unique5(expr.begin(), expr.end(), res, return_inverse_res, i,
- utils::int_<E::value>());
- return std::make_tuple(types::ndarray<dtype, types::pshape<long>>(res),
- return_inverse_res);
+ _unique5(expr.begin(), expr.end(), res, return_inverse_res, i, utils::int_<E::value>());
+ return std::make_tuple(types::ndarray<dtype, types::pshape<long>>(res), return_inverse_res);
}
template <class E>
types::ndarray<typename E::dtype, types::pshape<long>>
- unique(E const &expr, types::false_immediate return_index,
- types::false_immediate return_inverse)
+ unique(E const &expr, types::false_immediate return_index, types::false_immediate return_inverse)
{
using dtype = typename E::dtype;
std::set<dtype, std::less<dtype>, utils::allocator<dtype>> res;
@@ -223,18 +206,15 @@ namespace numpy
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::false_immediate return_inverse)
+ unique(E const &expr, types::true_immediate return_index, types::false_immediate return_inverse)
{
return unique(expr, return_index);
}
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::true_immediate return_inverse)
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::true_immediate return_index, types::true_immediate return_inverse)
{
assert(return_inverse && "invalid signature otherwise");
@@ -244,21 +224,18 @@ namespace numpy
types::ndarray<long, types::pshape<long>> return_inverse_res(
types::pshape<long>{expr.flat_size()}, builtins::None);
long i = 0;
- _unique3(expr.begin(), expr.end(), res, return_index_res,
- return_inverse_res, i, utils::int_<E::value>());
- return std::make_tuple(
- types::ndarray<dtype, types::pshape<long>>(res),
- types::ndarray<long, types::pshape<long>>(return_index_res),
- return_inverse_res);
+ _unique3(expr.begin(), expr.end(), res, return_index_res, return_inverse_res, i,
+ utils::int_<E::value>());
+ return std::make_tuple(types::ndarray<dtype, types::pshape<long>>(res),
+ types::ndarray<long, types::pshape<long>>(return_index_res),
+ return_inverse_res);
}
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::true_immediate return_inverse,
+ unique(E const &expr, types::true_immediate return_index, types::true_immediate return_inverse,
types::true_immediate return_counts)
{
assert(return_counts && "invalid signature otherwise");
@@ -270,37 +247,32 @@ namespace numpy
std::map<typename E::dtype, long> return_counts_map;
{
long i = 0;
- _unique4(expr.begin(), expr.end(), return_index_res, return_inverse_res,
- return_counts_map, i, utils::int_<E::value>());
+ _unique4(expr.begin(), expr.end(), return_index_res, return_inverse_res, return_counts_map, i,
+ utils::int_<E::value>());
}
types::pshape<long> shp{(long)return_counts_map.size()};
types::ndarray<long, types::pshape<long>> unique_array(shp, builtins::None);
- types::ndarray<long, types::pshape<long>> return_counts_array(
- shp, builtins::None);
+ types::ndarray<long, types::pshape<long>> return_counts_array(shp, builtins::None);
{
long i = 0;
- for (auto it = return_counts_map.begin(); it != return_counts_map.end();
- ++i, ++it) {
+ for (auto it = return_counts_map.begin(); it != return_counts_map.end(); ++i, ++it) {
unique_array.fast(i) = it->first;
return_counts_array.fast(i) = it->second;
}
}
- return std::make_tuple(
- unique_array,
- types::ndarray<long, types::pshape<long>>(return_index_res),
- return_inverse_res, return_counts_array);
+ return std::make_tuple(unique_array,
+ types::ndarray<long, types::pshape<long>>(return_index_res),
+ return_inverse_res, return_counts_array);
}
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::true_immediate return_inverse,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::true_immediate return_index, types::true_immediate return_inverse,
types::false_immediate return_counts)
{
return unique(expr, return_index, return_inverse);
@@ -309,8 +281,7 @@ namespace numpy
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::false_immediate return_inverse,
+ unique(E const &expr, types::true_immediate return_index, types::false_immediate return_inverse,
types::false_immediate return_counts)
{
return unique(expr, return_index);
@@ -318,10 +289,8 @@ namespace numpy
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::true_immediate return_index,
- types::false_immediate return_inverse,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::true_immediate return_index, types::false_immediate return_inverse,
types::true_immediate return_counts)
{
std::vector<long, utils::allocator<long>> return_index_res;
@@ -336,29 +305,25 @@ namespace numpy
types::pshape<long> shp{(long)return_counts_map.size()};
types::ndarray<long, types::pshape<long>> unique_array(shp, builtins::None);
- types::ndarray<long, types::pshape<long>> return_counts_array(
- shp, builtins::None);
+ types::ndarray<long, types::pshape<long>> return_counts_array(shp, builtins::None);
{
long i = 0;
- for (auto it = return_counts_map.begin(); it != return_counts_map.end();
- ++i, ++it) {
+ for (auto it = return_counts_map.begin(); it != return_counts_map.end(); ++i, ++it) {
unique_array.fast(i) = it->first;
return_counts_array.fast(i) = it->second;
}
}
- return std::make_tuple(
- unique_array,
- types::ndarray<long, types::pshape<long>>(return_index_res),
- return_counts_array);
+ return std::make_tuple(unique_array,
+ types::ndarray<long, types::pshape<long>>(return_index_res),
+ return_counts_array);
}
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::true_immediate return_inverse,
+ unique(E const &expr, types::false_immediate return_index, types::true_immediate return_inverse,
types::false_immediate return_counts)
{
return unique(expr, return_index, return_inverse);
@@ -366,10 +331,8 @@ namespace numpy
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>,
- types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::true_immediate return_inverse,
+ types::ndarray<long, types::pshape<long>>, types::ndarray<long, types::pshape<long>>>
+ unique(E const &expr, types::false_immediate return_index, types::true_immediate return_inverse,
types::true_immediate return_counts)
{
types::ndarray<long, types::pshape<long>> return_inverse_res(
@@ -378,33 +341,29 @@ namespace numpy
std::map<typename E::dtype, long> return_counts_map;
{
long i = 0;
- _unique7(expr.begin(), expr.end(), return_inverse_res, return_counts_map,
- i, utils::int_<E::value>());
+ _unique7(expr.begin(), expr.end(), return_inverse_res, return_counts_map, i,
+ utils::int_<E::value>());
}
types::pshape<long> shp{(long)return_counts_map.size()};
types::ndarray<long, types::pshape<long>> unique_array(shp, builtins::None);
- types::ndarray<long, types::pshape<long>> return_counts_array(
- shp, builtins::None);
+ types::ndarray<long, types::pshape<long>> return_counts_array(shp, builtins::None);
{
long i = 0;
- for (auto it = return_counts_map.begin(); it != return_counts_map.end();
- ++i, ++it) {
+ for (auto it = return_counts_map.begin(); it != return_counts_map.end(); ++i, ++it) {
unique_array.fast(i) = it->first;
return_counts_array.fast(i) = it->second;
}
}
- return std::make_tuple(unique_array, return_inverse_res,
- return_counts_array);
+ return std::make_tuple(unique_array, return_inverse_res, return_counts_array);
}
template <class E>
types::ndarray<typename E::dtype, types::pshape<long>>
- unique(E const &expr, types::false_immediate return_index,
- types::false_immediate return_inverse,
+ unique(E const &expr, types::false_immediate return_index, types::false_immediate return_inverse,
types::false_immediate return_counts)
{
return unique(expr);
@@ -413,27 +372,23 @@ namespace numpy
template <class E>
std::tuple<types::ndarray<typename E::dtype, types::pshape<long>>,
types::ndarray<long, types::pshape<long>>>
- unique(E const &expr, types::false_immediate return_index,
- types::false_immediate return_inverse,
+ unique(E const &expr, types::false_immediate return_index, types::false_immediate return_inverse,
types::true_immediate return_counts)
{
std::map<typename E::dtype, long> return_counts_map;
{
long i = 0;
- _unique8(expr.begin(), expr.end(), return_counts_map, i,
- utils::int_<E::value>());
+ _unique8(expr.begin(), expr.end(), return_counts_map, i, utils::int_<E::value>());
}
types::pshape<long> shp{(long)return_counts_map.size()};
types::ndarray<long, types::pshape<long>> unique_array(shp, builtins::None);
- types::ndarray<long, types::pshape<long>> return_counts_array(
- shp, builtins::None);
+ types::ndarray<long, types::pshape<long>> return_counts_array(shp, builtins::None);
{
long i = 0;
- for (auto it = return_counts_map.begin(); it != return_counts_map.end();
- ++i, ++it) {
+ for (auto it = return_counts_map.begin(); it != return_counts_map.end(); ++i, ++it) {
unique_array.fast(i) = it->first;
return_counts_array.fast(i) = it->second;
}
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp b/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp
index 8c885aad4ea..1c2a0fce2f6 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/unravel_index.hpp
@@ -25,9 +25,7 @@ namespace numpy
} // namespace
template <class E, class S>
- typename std::enable_if<
- std::is_scalar<E>::value,
- types::array_tuple<long, std::tuple_size<S>::value>>::type
+ std::enable_if_t<std::is_scalar<E>::value, types::array_tuple<long, std::tuple_size<S>::value>>
unravel_index(E const &expr, S const &shape, types::str const &order)
{
types::array_tuple<long, std::tuple_size<S>::value> ret;
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp b/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp
index 23da0b6a7a4..eef7cf828fa 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/unwrap.hpp
@@ -25,9 +25,7 @@ namespace numpy
++ibegin;
for (; ibegin != iend; ++ibegin, ++obegin) {
if (functor::abs{}(*obegin - *ibegin) > discont)
- *(obegin + 1) =
- *ibegin +
- 2 * pi * functor::round{}((*obegin - *ibegin) / (2 * pi));
+ *(obegin + 1) = *ibegin + 2 * pi * functor::round{}((*obegin - *ibegin) / (2 * pi));
else
*(obegin + 1) = *ibegin;
}
@@ -43,14 +41,11 @@ namespace numpy
} // namespace
template <class E>
- types::ndarray<double, typename E::shape_t> unwrap(E const &expr,
- double discont)
+ types::ndarray<double, typename E::shape_t> unwrap(E const &expr, double discont)
{
discont = functor::maximum{}(discont, pi);
- types::ndarray<double, typename E::shape_t> out(sutils::getshape(expr),
- builtins::None);
- _unwrap(expr.begin(), expr.end(), out.begin(), discont,
- utils::int_<E::value>());
+ types::ndarray<double, typename E::shape_t> out(sutils::getshape(expr), builtins::None);
+ _unwrap(expr.begin(), expr.end(), out.begin(), discont, utils::int_<E::value>());
return out;
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/ushort.hpp b/contrib/python/pythran/pythran/pythonic/numpy/ushort.hpp
index d74c77907f8..b56e1591016 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/ushort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/ushort.hpp
@@ -34,4 +34,29 @@ namespace numpy
} // namespace numpy
PYTHONIC_NS_END
+#ifdef ENABLE_PYTHON_MODULE
+
+#include "numpy/arrayscalars.h"
+#include "pythonic/python/core.hpp"
+
+PYTHONIC_NS_BEGIN
+
+inline PyObject *to_python<numpy::functor::ushort>::convert(numpy::functor::ushort const &c)
+{
+ return (PyObject *)&PyUShortArrType_Type;
+}
+
+inline bool from_python<numpy::functor::ushort>::is_convertible(PyObject *obj)
+{
+ return obj == (PyObject *)&PyUShortArrType_Type;
+}
+
+inline numpy::functor::ushort from_python<numpy::functor::ushort>::convert(PyObject *obj)
+{
+ return {};
+}
+
+PYTHONIC_NS_END
+#endif
+
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/var.hpp b/contrib/python/pythran/pythran/pythonic/numpy/var.hpp
index 981b6678d9b..2adfc5a6d68 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/var.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/var.hpp
@@ -23,14 +23,12 @@ namespace numpy
{
template <class E>
- auto var(E const &expr, types::none_type axis, types::none_type dtype,
- types::none_type out,
+ auto var(E const &expr, types::none_type axis, types::none_type dtype, types::none_type out,
long ddof) -> decltype(var_type<E>(std::real(mean(expr))))
{
auto m = mean(expr);
auto t = pythonic::numpy::functor::subtract{}(expr, m);
- return sum(builtins::pythran::functor::abssqr{}(t)) /
- var_type<E>(expr.flat_size() - ddof);
+ return sum(builtins::pythran::functor::abssqr{}(t)) / var_type<E>(expr.flat_size() - ddof);
}
namespace
@@ -38,30 +36,24 @@ namespace numpy
// this is a workaround for the lack of efficient support for broadcasting
// in pythonic
template <class T, class E, class M>
- void _enlarge_copy_minus(T &&t, E const &e, M const &m, long axis,
- utils::int_<1>)
+ void _enlarge_copy_minus(T &&t, E const &e, M const &m, long axis, utils::int_<1>)
{
- for (long i = 0, n = e.template shape<0>(), p = m.template shape<0>();
- i < n;)
+ for (long i = 0, n = e.template shape<0>(), p = m.template shape<0>(); i < n;)
for (long j = 0; j < p; ++j, ++i)
t.fast(i) = e.fast(i) - m.fast(j);
}
template <class T, class E, class M, size_t N>
- void _enlarge_copy_minus(T &&t, E const &e, M const &m, long axis,
- utils::int_<N>)
+ void _enlarge_copy_minus(T &&t, E const &e, M const &m, long axis, utils::int_<N>)
{
- for (long i = 0, n = e.template shape<0>(), p = m.template shape<0>();
- i < n;)
+ for (long i = 0, n = e.template shape<0>(), p = m.template shape<0>(); i < n;)
for (long j = 0; j < p; ++j, ++i)
- _enlarge_copy_minus(t.fast(i), e.fast(i), m.fast(j), axis,
- utils::int_<N - 1>());
+ _enlarge_copy_minus(t.fast(i), e.fast(i), m.fast(j), axis, utils::int_<N - 1>());
}
} // namespace
template <class E>
- auto var(E const &expr, long axis, types::none_type dtype,
- types::none_type out, long ddof) ->
+ auto var(E const &expr, long axis, types::none_type dtype, types::none_type out, long ddof) ->
typename assignable<decltype(var_type<E>() * mean(expr, axis))>::type
{
auto m = mean(expr, axis);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/vdot.hpp b/contrib/python/pythran/pythran/pythonic/numpy/vdot.hpp
index 575d6df38ec..50804d04e44 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/vdot.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/vdot.hpp
@@ -16,16 +16,14 @@ namespace numpy
template <class U, class V>
auto vdot(U const &u, V const &v)
- -> decltype(functor::dot{}(functor::asarray{}(u).flat(),
- functor::asarray{}(v).flat()))
+ -> decltype(functor::dot{}(functor::asarray{}(u).flat(), functor::asarray{}(v).flat()))
{
if (types::is_complex<typename U::dtype>::value &&
types::is_complex<typename V::dtype>::value) {
return functor::dot{}(functor::asarray{}(functor::conjugate{}(u)).flat(),
functor::asarray{}(v).flat());
} else {
- return functor::dot{}(functor::asarray{}(u).flat(),
- functor::asarray{}(v).flat());
+ return functor::dot{}(functor::asarray{}(u).flat(), functor::asarray{}(v).flat());
}
}
} // namespace numpy
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp b/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp
index 4b0836a6b68..92500240ba6 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/vectorize.hpp
@@ -12,19 +12,17 @@ namespace numpy
{
template <typename F>
template <typename... T>
- auto vectorized<F>::operator()(T &&...args) const ->
- typename std::enable_if<!types::valid_numexpr_parameters<
- typename std::decay<T>::type...>::value,
- decltype(F{}(std::forward<T>(args)...))>::type
+ auto vectorized<F>::operator()(T &&...args) const
+ -> std::enable_if_t<!types::valid_numexpr_parameters<std::decay_t<T>...>::value,
+ decltype(F{}(std::forward<T>(args)...))>
{
return F{}(std::forward<T>(args)...);
}
template <class F>
template <class... E>
- typename std::enable_if<
- types::valid_numexpr_parameters<typename std::decay<E>::type...>::value,
- types::numpy_expr<F, typename types::adapt_type<E, E...>::type...>>::type
+ std::enable_if_t<types::valid_numexpr_parameters<std::decay_t<E>...>::value,
+ types::numpy_expr<F, typename types::adapt_type<E, E...>::type...>>
vectorized<F>::operator()(E &&...args) const
{
return {std::forward<E>(args)...};
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp b/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp
index 3b4de4a0dff..426b24e2e01 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/vstack.hpp
@@ -10,20 +10,19 @@ namespace numpy
{
template <class ArraySequence>
- auto vstack(ArraySequence &&seq) ->
- typename std::enable_if<(impl::vstack_helper<ArraySequence>::value > 1),
- impl::vstack_helper<ArraySequence>>::type
+ auto vstack(ArraySequence &&seq)
+ -> std::enable_if_t<(impl::vstack_helper<ArraySequence>::value > 1),
+ impl::vstack_helper<ArraySequence>>
{
return concatenate(std::forward<ArraySequence>(seq), 0);
}
template <class ArraySequence>
- auto vstack(ArraySequence &&seq) ->
- typename std::enable_if<
- (impl::vstack_helper<ArraySequence>::value == 1),
- decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape(
- std::declval<types::array_tuple<long, 2>>()))>::type
+ auto vstack(ArraySequence &&seq)
+ -> std::enable_if_t<(impl::vstack_helper<ArraySequence>::value == 1),
+ decltype(std::declval<impl::vstack_helper<ArraySequence>>().reshape(
+ std::declval<types::array_tuple<long, 2>>()))>
{
auto &&temp = concatenate(std::forward<ArraySequence>(seq), 0);
long const seq_size = seq.size(), temp_size = temp.size();
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/where.hpp b/contrib/python/pythran/pythran/pythonic/numpy/where.hpp
index 7d917562944..20b1f181641 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/where.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/where.hpp
@@ -14,8 +14,7 @@ namespace numpy
namespace impl
{
template <class E, class F, class G>
- typename __combined<F, G>::type where(E const &cond, F const &true_,
- G const &false_)
+ typename __combined<F, G>::type where(E const &cond, F const &true_, G const &false_)
{
if (cond)
return true_;
@@ -37,20 +36,14 @@ namespace types
struct Dereferencer<numpy::functor::where> {
template <class Ts>
- auto operator()(Ts const &iters, utils::index_sequence<0, 1, 2>) ->
- typename std::enable_if<
+ auto operator()(Ts const &iters, std::index_sequence<0, 1, 2>) -> std::enable_if_t<
+ types::is_dtype<
+ std::remove_cv_t<std::remove_reference_t<decltype(*std::get<0>(iters))>>>::value &&
types::is_dtype<
- typename std::remove_cv<typename std::remove_reference<
- decltype(*std::get<0>(iters))>::type>::type>::value &&
- types::is_dtype<
- typename std::remove_cv<typename std::remove_reference<
- decltype(*std::get<1>(iters))>::type>::type>::value &&
- types::is_dtype<
- typename std::remove_cv<typename std::remove_reference<
- decltype(*std::get<2>(iters))>::type>::type>::value,
- decltype(numpy::impl::where(*std::get<0>(iters),
- *std::get<1>(iters),
- *std::get<2>(iters)))>::type
+ std::remove_cv_t<std::remove_reference_t<decltype(*std::get<1>(iters))>>>::value &&
+ types::is_dtype<
+ std::remove_cv_t<std::remove_reference_t<decltype(*std::get<2>(iters))>>>::value,
+ decltype(numpy::impl::where(*std::get<0>(iters), *std::get<1>(iters), *std::get<2>(iters)))>
{
if (*std::get<0>(iters))
return *std::get<1>(iters);
@@ -59,7 +52,7 @@ namespace types
}
template <class Ts, size_t... I>
- auto operator()(Ts const &iters, utils::index_sequence<I...>, ...)
+ auto operator()(Ts const &iters, std::index_sequence<I...>, ...)
-> decltype(numpy::functor::where{}(*std::get<I>(iters)...))
{
return numpy::functor::where{}(*std::get<I>(iters)...);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/zeros.hpp b/contrib/python/pythran/pythran/pythonic/numpy/zeros.hpp
index 8879fdadd28..26931223975 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/zeros.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/zeros.hpp
@@ -19,8 +19,7 @@ namespace numpy
}
template <class pS, class dtype>
- types::ndarray<typename dtype::type, sutils::shape_t<pS>>
- zeros(pS const &shape, dtype d)
+ types::ndarray<typename dtype::type, sutils::shape_t<pS>> zeros(pS const &shape, dtype d)
{
using T = typename dtype::type;
// use calloc even if we have a non integer type. This looks ok on modern
@@ -30,15 +29,13 @@ namespace numpy
}
template <class dtype>
- types::ndarray<typename dtype::type, types::pshape<long>> zeros(long size,
- dtype d)
+ types::ndarray<typename dtype::type, types::pshape<long>> zeros(long size, dtype d)
{
return zeros(types::pshape<long>(size), d);
}
template <long N, class dtype>
- types::ndarray<typename dtype::type,
- types::pshape<std::integral_constant<long, N>>>
+ types::ndarray<typename dtype::type, types::pshape<std::integral_constant<long, N>>>
zeros(std::integral_constant<long, N>, dtype d)
{
return zeros(types::pshape<std::integral_constant<long, N>>({}), d);
diff --git a/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp b/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp
index 435089004cc..ef5e79cafaa 100644
--- a/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp
+++ b/contrib/python/pythran/pythran/pythonic/numpy/zeros_like.hpp
@@ -12,16 +12,14 @@ namespace numpy
{
template <class E, class dtype>
- auto zeros_like(E const &expr,
- dtype d) -> decltype(zeros(sutils::getshape(expr), d))
+ auto zeros_like(E const &expr, dtype d) -> decltype(zeros(sutils::getshape(expr), d))
{
return zeros(sutils::getshape(expr), d);
}
template <class E>
auto zeros_like(E const &expr, types::none_type)
- -> decltype(zeros(sutils::getshape(expr),
- types::dtype_t<typename E::dtype>()))
+ -> decltype(zeros(sutils::getshape(expr), types::dtype_t<typename E::dtype>()))
{
return zeros(sutils::getshape(expr), types::dtype_t<typename E::dtype>());
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/add.hpp b/contrib/python/pythran/pythran/pythonic/operator_/add.hpp
index 1e594a143a1..a993c041f8b 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/add.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/add.hpp
@@ -16,10 +16,10 @@ namespace operator_
return std::forward<A>(a) + std::forward<B>(b);
}
- DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(
- add, +,
- (((b >= 0) ? (a <= std::numeric_limits<decltype(b)>::max() - b)
- : (std::numeric_limits<decltype(b)>::min() - b <= a))))
+ DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(add, +,
+ (((b >= 0)
+ ? (a <= std::numeric_limits<decltype(b)>::max() - b)
+ : (std::numeric_limits<decltype(b)>::min() - b <= a))))
} // namespace operator_
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp b/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp
index d1f739c7dee..5c84ffe23a5 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/contains.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto contains(A &&a,
- B &&b) -> decltype(in(std::forward<A>(a), std::forward<B>(b)))
+ auto contains(A &&a, B &&b) -> decltype(in(std::forward<A>(a), std::forward<B>(b)))
{
return in(std::forward<A>(a), std::forward<B>(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/div.hpp b/contrib/python/pythran/pythran/pythonic/operator_/div.hpp
index 6158fdc23de..135632f6b19 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/div.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/div.hpp
@@ -13,10 +13,9 @@ namespace operator_
template <class A, class B>
auto div(A &&a, B &&b) // for ndarrays
- -> typename std::enable_if<
- !std::is_fundamental<typename std::decay<A>::type>::value ||
- !std::is_fundamental<typename std::decay<B>::type>::value,
- decltype(std::forward<A>(a) / std::forward<B>(b))>::type
+ -> std::enable_if_t<!std::is_fundamental<std::decay_t<A>>::value ||
+ !std::is_fundamental<std::decay_t<B>>::value,
+ decltype(std::forward<A>(a) / std::forward<B>(b))>
{
return std::forward<A>(a) / std::forward<B>(b);
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp b/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp
index bff2016246d..17a87c4a7a5 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/icommon.hpp
@@ -21,9 +21,8 @@ namespace operator_
{
template <class A, class B>
- auto OPERATOR_NAME(bool, A &&a, B &&b,
- ...) -> decltype(std::forward<A>(a)
- OPERATOR_SYMBOL std::forward<B>(b))
+ auto OPERATOR_NAME(bool, A &&a, B &&b, ...)
+ -> decltype(std::forward<A>(a) OPERATOR_SYMBOL std::forward<B>(b))
{
return std::forward<A>(a) OPERATOR_SYMBOL std::forward<B>(b);
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp b/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp
index 44127928727..182d56fffb4 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/imax.hpp
@@ -11,21 +11,19 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto imax(A &&a, B &&b) ->
- typename std::enable_if<
- std::is_const<A>::value || !std::is_assignable<A, B>::value,
- decltype(numpy::functor::maximum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type
+ auto imax(A &&a, B &&b)
+ -> std::enable_if_t<std::is_const<A>::value || !std::is_assignable<A, B>::value,
+ decltype(numpy::functor::maximum{}(std::forward<A>(a),
+ std::forward<B>(b)))>
{
return numpy::functor::maximum{}(std::forward<A>(a), std::forward<B>(b));
}
template <class A, class B>
- auto imax(A &&a, B &&b) ->
- typename std::enable_if<
- !std::is_const<A>::value && std::is_assignable<A, B>::value,
- decltype(a = numpy::functor::maximum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type
+ auto imax(A &&a, B &&b)
+ -> std::enable_if_t<!std::is_const<A>::value && std::is_assignable<A, B>::value,
+ decltype(a = numpy::functor::maximum{}(std::forward<A>(a),
+ std::forward<B>(b)))>
{
return a = numpy::functor::maximum{}(a, std::forward<B>(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp b/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp
index e1f32ea1521..4c73d7bd0dd 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/imin.hpp
@@ -12,21 +12,19 @@ namespace operator_
{
template <class A, class B>
- auto imin(A &&a, B &&b) ->
- typename std::enable_if<
- std::is_const<A>::value || !std::is_assignable<A, B>::value,
- decltype(numpy::functor::minimum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type
+ auto imin(A &&a, B &&b)
+ -> std::enable_if_t<std::is_const<A>::value || !std::is_assignable<A, B>::value,
+ decltype(numpy::functor::minimum{}(std::forward<A>(a),
+ std::forward<B>(b)))>
{
return numpy::functor::minimum{}(std::forward<A>(a), std::forward<B>(b));
}
template <class A, class B>
- auto imin(A &&a, B &&b) ->
- typename std::enable_if<
- !std::is_const<A>::value && std::is_assignable<A, B>::value,
- decltype(a = numpy::functor::minimum{}(std::forward<A>(a),
- std::forward<B>(b)))>::type
+ auto imin(A &&a, B &&b)
+ -> std::enable_if_t<!std::is_const<A>::value && std::is_assignable<A, B>::value,
+ decltype(a = numpy::functor::minimum{}(std::forward<A>(a),
+ std::forward<B>(b)))>
{
return a = numpy::functor::minimum{}(a, std::forward<B>(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp b/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp
index 28def8bff81..a83dd4103fb 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/indexOf.hpp
@@ -19,8 +19,7 @@ namespace operator_
{
auto where = std::find(a.begin(), a.end(), b);
if (where == a.end())
- throw types::ValueError(builtins::anonymous::str(b) +
- " is not in this sequence");
+ throw types::ValueError(builtins::anonymous::str(b) + " is not in this sequence");
return where - a.begin();
}
} // namespace operator_
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp b/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp
index b9eff92b606..c3eab48a812 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/is_.hpp
@@ -12,8 +12,8 @@ namespace operator_
{
template <class A, class B>
- auto is_(A &&a, B &&b) -> decltype(builtins::id(std::forward<A>(a)) ==
- builtins::id(std::forward<B>(b)))
+ auto is_(A &&a, B &&b)
+ -> decltype(builtins::id(std::forward<A>(a)) == builtins::id(std::forward<B>(b)))
{
return builtins::id(std::forward<A>(a)) == builtins::id(std::forward<B>(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp b/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp
index 63c4c9839d5..8842c059725 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/is_not.hpp
@@ -11,8 +11,8 @@ namespace operator_
{
template <class A, class B>
- auto is_not(A &&a, B &&b) -> decltype(builtins::id(std::forward<A>(a)) !=
- builtins::id(std::forward<B>(b)))
+ auto is_not(A &&a, B &&b)
+ -> decltype(builtins::id(std::forward<A>(a)) != builtins::id(std::forward<B>(b)))
{
return builtins::id(std::forward<A>(a)) != builtins::id(std::forward<B>(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/itemgetter.hpp b/contrib/python/pythran/pythran/pythonic/operator_/itemgetter.hpp
index 7d3bf6a0cbe..367f6d3a3f8 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/itemgetter.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/itemgetter.hpp
@@ -28,8 +28,7 @@ namespace operator_
}
template <typename... Types>
- itemgetter_tuple_return<Types...>::itemgetter_tuple_return(Types... items)
- : items(items...)
+ itemgetter_tuple_return<Types...>::itemgetter_tuple_return(Types... items) : items(items...)
{
}
@@ -40,8 +39,7 @@ namespace operator_
template <typename... Types>
template <class T, class A, size_t I>
- void itemgetter_tuple_return<Types...>::helper(T &t, A const &a,
- utils::int_<I>) const
+ void itemgetter_tuple_return<Types...>::helper(T &t, A const &a, utils::int_<I>) const
{
std::get<I>(t) = a[std::get<I>(items)];
helper(t, a, utils::int_<I - 1>());
@@ -49,28 +47,24 @@ namespace operator_
template <typename... Types>
template <class T, class A>
- void itemgetter_tuple_return<Types...>::helper(T &t, A const &a,
- utils::int_<0>) const
+ void itemgetter_tuple_return<Types...>::helper(T &t, A const &a, utils::int_<0>) const
{
std::get<0>(t) = a[std::get<0>(items)];
}
template <typename... Types>
template <class A>
- auto itemgetter_tuple_return<Types...>::operator()(A const &a) const
- -> std::tuple<typename std::remove_cv<typename std::remove_reference<
- decltype(a[std::declval<Types>()])>::type>::type...>
+ auto itemgetter_tuple_return<Types...>::operator()(A const &a) const -> std::tuple<
+ std::remove_cv_t<std::remove_reference_t<decltype(a[std::declval<Types>()])>>...>
{
- std::tuple<typename std::remove_cv<typename std::remove_reference<
- decltype(a[std::declval<Types>()])>::type>::type...>
- t;
+ std::tuple<std::remove_cv_t<std::remove_reference_t<decltype(a[std::declval<Types>()])>>...> t;
helper(t, a, utils::int_<sizeof...(Types) - 1>());
return t;
}
template <class... L>
- itemgetter_tuple_return<long, long, L...>
- itemgetter(long const &item1, long const &item2, L... items)
+ itemgetter_tuple_return<long, long, L...> itemgetter(long const &item1, long const &item2,
+ L... items)
{
return {item1, item2, items...};
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp b/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp
index ad6feb5b9ce..50df249316c 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/itruediv.hpp
@@ -16,18 +16,15 @@ namespace operator_
return truediv(a, std::forward<B>(b));
}
template <class A, class B>
- auto itruediv(A &a, B &&b) ->
- typename std::enable_if<
- std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value,
- A &>::type
+ auto itruediv(A &a, B &&b)
+ -> std::enable_if_t<std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value, A &>
{
return a = truediv(a, std::forward<B>(b));
}
template <class A, class B>
- auto itruediv(A &a, B &&b) ->
- typename std::enable_if<
- !std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value,
- decltype(truediv(a, std::forward<B>(b)))>::type
+ auto itruediv(A &a, B &&b)
+ -> std::enable_if_t<!std::is_same<A, decltype(truediv(a, std::forward<B>(b)))>::value,
+ decltype(truediv(a, std::forward<B>(b)))>
{
return truediv(a, std::forward<B>(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp b/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp
index a758fc9afde..e90a5cb3452 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/lshift.hpp
@@ -12,8 +12,7 @@ namespace operator_
{
template <class A, class B>
- auto lshift(A &&a, B &&b) -> decltype(std::forward<A>(a)
- << std::forward<B>(b))
+ auto lshift(A &&a, B &&b) -> decltype(std::forward<A>(a) << std::forward<B>(b))
{
return std::forward<A>(a) << std::forward<B>(b);
}
@@ -25,8 +24,8 @@ namespace operator_
return b ? false : a;
}
- DEFINE_ALL_OPERATOR_OVERLOADS_NO_BOOL_IMPL(
- lshift, <<, (a <= (std::numeric_limits<decltype(b)>::max() >> b)))
+ DEFINE_ALL_OPERATOR_OVERLOADS_NO_BOOL_IMPL(lshift, <<,
+ (a <= (std::numeric_limits<decltype(b)>::max() >> b)))
} // namespace operator_
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp b/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp
index 60f0047e8d7..a1502264fd4 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/mod.hpp
@@ -11,11 +11,9 @@ namespace operator_
{
template <class A, class B>
- auto mod(A &&a, B &&b) ->
- typename std::enable_if<
- std::is_fundamental<typename std::decay<A>::type>::value &&
- std::is_fundamental<typename std::decay<B>::type>::value,
- decltype(std::forward<A>(a) % std::forward<B>(b))>::type
+ auto mod(A &&a, B &&b) -> std::enable_if_t<std::is_fundamental<std::decay_t<A>>::value &&
+ std::is_fundamental<std::decay_t<B>>::value,
+ decltype(std::forward<A>(a) % std::forward<B>(b))>
{
auto t = std::forward<A>(a) % b;
return t < 0 ? (t + b) : t;
@@ -35,10 +33,9 @@ namespace operator_
template <class A, class B>
auto mod(A &&a, B &&b) // for ndarrays
- -> typename std::enable_if<
- !std::is_fundamental<typename std::decay<A>::type>::value ||
- !std::is_fundamental<typename std::decay<B>::type>::value,
- decltype(std::forward<A>(a) % std::forward<B>(b))>::type
+ -> std::enable_if_t<!std::is_fundamental<std::decay_t<A>>::value ||
+ !std::is_fundamental<std::decay_t<B>>::value,
+ decltype(std::forward<A>(a) % std::forward<B>(b))>
{
return std::forward<A>(a) % std::forward<B>(b);
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/mul.hpp b/contrib/python/pythran/pythran/pythonic/operator_/mul.hpp
index bc8ba2ed6ba..319f16fe41a 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/mul.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/mul.hpp
@@ -27,10 +27,8 @@ namespace operator_
DEFINE_ALL_OPERATOR_OVERLOADS_NO_BOOL_IMPL(
mul, *,
(b == 0 ||
- (a * b >= 0 &&
- std::abs(a) <= std::numeric_limits<decltype(b)>::max() / std::abs(b)) ||
- (a * b <= 0 &&
- std::abs(a) >= std::numeric_limits<decltype(b)>::min() / std::abs(b))))
+ (a * b >= 0 && std::abs(a) <= std::numeric_limits<decltype(b)>::max() / std::abs(b)) ||
+ (a * b <= 0 && std::abs(a) >= std::numeric_limits<decltype(b)>::min() / std::abs(b))))
} // namespace operator_
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/overloads.hpp b/contrib/python/pythran/pythran/pythonic/operator_/overloads.hpp
index 1126ba633b8..2818d8bc47e 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/overloads.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/overloads.hpp
@@ -4,30 +4,30 @@
#include "pythonic/include/operator_/overloads.hpp"
#include <limits>
-#define PYTHONIC_OPERATOR_OVERLOAD_IMPL(type, opname, op, overflow_check) \
- inline type opname(type a, type b) \
- { \
- assert((overflow_check) && "overflow check"); \
- return a op b; \
+#define PYTHONIC_OPERATOR_OVERLOAD_IMPL(type, opname, op, overflow_check) \
+ inline type opname(type a, type b) \
+ { \
+ assert((overflow_check) && "overflow check"); \
+ return a op b; \
}
// workaround the fact that char and short computations are done using int in C,
// while they are done at their respective type in numpy
-#define DEFINE_ALL_OPERATOR_OVERLOADS_NO_BOOL_IMPL(opname, op, overflow_check) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned char, opname, op, true) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(char, opname, op, true) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed char, opname, op, overflow_check) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned short, opname, op, true) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed short, opname, op, overflow_check) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned int, opname, op, true) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed int, opname, op, overflow_check) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned long, opname, op, true) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed long, opname, op, overflow_check) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned long long, opname, op, true) \
+#define DEFINE_ALL_OPERATOR_OVERLOADS_NO_BOOL_IMPL(opname, op, overflow_check) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned char, opname, op, true) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(char, opname, op, true) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed char, opname, op, overflow_check) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned short, opname, op, true) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed short, opname, op, overflow_check) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned int, opname, op, true) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed int, opname, op, overflow_check) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned long, opname, op, true) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed long, opname, op, overflow_check) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(unsigned long long, opname, op, true) \
PYTHONIC_OPERATOR_OVERLOAD_IMPL(signed long long, opname, op, overflow_check)
-#define DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(opname, op, overflow_check) \
- PYTHONIC_OPERATOR_OVERLOAD_IMPL(bool, opname, op, true) \
+#define DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(opname, op, overflow_check) \
+ PYTHONIC_OPERATOR_OVERLOAD_IMPL(bool, opname, op, true) \
DEFINE_ALL_OPERATOR_OVERLOADS_NO_BOOL_IMPL(opname, op, overflow_check)
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp b/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp
index b656ae28af8..b0834d0d276 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/rshift.hpp
@@ -11,8 +11,7 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto rshift(A &&a,
- B &&b) -> decltype(std::forward<A>(a) >> std::forward<B>(b))
+ auto rshift(A &&a, B &&b) -> decltype(std::forward<A>(a) >> std::forward<B>(b))
{
return std::forward<A>(a) >> std::forward<B>(b);
}
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp b/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp
index a91e3942000..6c97d845f9d 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/sub.hpp
@@ -17,10 +17,10 @@ namespace operator_
return std::forward<A>(a) - std::forward<B>(b);
}
- DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(
- sub, -,
- (((b < 0) ? (a <= std::numeric_limits<decltype(b)>::max() + b)
- : (std::numeric_limits<decltype(b)>::min() + b <= a))))
+ DEFINE_ALL_OPERATOR_OVERLOADS_IMPL(sub, -,
+ (((b < 0)
+ ? (a <= std::numeric_limits<decltype(b)>::max() + b)
+ : (std::numeric_limits<decltype(b)>::min() + b <= a))))
} // namespace operator_
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp b/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp
index 285da274894..ce11655cd96 100644
--- a/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/operator_/truediv.hpp
@@ -10,8 +10,7 @@ PYTHONIC_NS_BEGIN
namespace operator_
{
template <class A, class B>
- auto truediv(A &&a, B &&b) -> decltype(std::forward<A>(a) /
- (double)std::forward<B>(b))
+ auto truediv(A &&a, B &&b) -> decltype(std::forward<A>(a) / (double)std::forward<B>(b))
{
return std::forward<A>(a) / ((double)std::forward<B>(b));
}
diff --git a/contrib/python/pythran/pythran/pythonic/os/path/join.hpp b/contrib/python/pythran/pythran/pythonic/os/path/join.hpp
index 4f405268743..ba95c425e25 100644
--- a/contrib/python/pythran/pythran/pythonic/os/path/join.hpp
+++ b/contrib/python/pythran/pythran/pythonic/os/path/join.hpp
@@ -39,8 +39,7 @@ namespace os
{
if (((types::str)head)[0] == "/")
buffer = std::forward<T>(head);
- else if (!buffer || *buffer.chars().rbegin() == OS_SEP ||
- *buffer.rbegin() == "/")
+ else if (!buffer || *buffer.chars().rbegin() == OS_SEP || *buffer.rbegin() == "/")
buffer += std::forward<T>(head);
else {
buffer.chars() += OS_SEP;
diff --git a/contrib/python/pythran/pythran/pythonic/python/core.hpp b/contrib/python/pythran/pythran/pythonic/python/core.hpp
index 4cbe3e0ab1c..86d2f634f71 100644
--- a/contrib/python/pythran/pythran/pythonic/python/core.hpp
+++ b/contrib/python/pythran/pythran/pythonic/python/core.hpp
@@ -28,13 +28,11 @@ PYTHONIC_NS_END
template <class T>
auto to_python(T &&value)
- -> decltype(pythonic::to_python<typename std::remove_cv<
- typename std::remove_reference<T>::type>::type>::
- convert(std::forward<T>(value)))
+ -> decltype(pythonic::to_python<std::remove_cv_t<std::remove_reference_t<T>>>::convert(
+ std::forward<T>(value)))
{
- return pythonic::to_python<
- typename std::remove_cv<typename std::remove_reference<T>::type>::type>::
- convert(std::forward<T>(value));
+ return pythonic::to_python<std::remove_cv_t<std::remove_reference_t<T>>>::convert(
+ std::forward<T>(value));
}
template <class T>
T from_python(PyObject *obj)
@@ -52,16 +50,54 @@ PYTHONIC_NS_BEGIN
namespace python
{
+#ifdef Py_LIMITED_API
+
+ struct ByteHolder {
+ PyObject *holder;
+ friend std::ostream &operator<<(std::ostream &os, ByteHolder const &byte_holder)
+ {
+ return os << (char *)(byte_holder);
+ }
+ operator char *() const
+ {
+ return PyBytes_AsString(holder);
+ }
+ ~ByteHolder()
+ {
+ Py_DECREF(holder);
+ }
+ };
+
+#define PyString_AS_STRING(obj) \
+ [obj]() { \
+ auto *str_obj = PyUnicode_AsEncodedString(obj, "ascii", "strict"); \
+ return ::pythonic::python::ByteHolder{str_obj}; \
+ }()
+#else
#ifndef PyString_AS_STRING
#define PyString_AS_STRING (char *)_PyUnicode_COMPACT_DATA
#endif
+#endif
inline void PyObject_TypePrettyPrinter(std::ostream &oss, PyObject *obj)
{
if (PyTuple_Check(obj)) {
oss << '(';
- for (long n = PyTuple_GET_SIZE(obj), i = 0; i < n; ++i) {
- PyObject_TypePrettyPrinter(oss, PyTuple_GET_ITEM(obj, i));
+#ifdef Py_LIMITED_API
+ Py_ssize_t obj_size = PyTuple_Size(obj);
+ // FIXME: should we propagate the error or something?
+ assert(obj_size != -1);
+#else
+ Py_ssize_t obj_size = PyTuple_GET_SIZE(obj);
+#endif
+ for (long n = obj_size, i = 0; i < n; ++i) {
+#ifdef Py_LIMITED_API
+ PyObject *obj_item = PyTuple_GetItem(obj, i);
+ assert(obj_item);
+#else
+ PyObject *obj_item = PyTuple_GET_ITEM(obj, i);
+#endif
+ PyObject_TypePrettyPrinter(oss, obj_item);
if (i != n - 1)
oss << ", ";
}
@@ -82,8 +118,7 @@ namespace python
}
oss << ']';
if ((PyArray_FLAGS(arr) & NPY_ARRAY_F_CONTIGUOUS) &&
- ((PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS) == 0) &&
- (PyArray_NDIM(arr) > 1)) {
+ ((PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS) == 0) && (PyArray_NDIM(arr) > 1)) {
oss << " (with unsupported column-major layout)";
} else if (PyArray_BASE(arr)) {
oss << " (is a view)";
@@ -103,7 +138,15 @@ namespace python
if (PyObject_Not(obj)) {
oss << "empty list";
} else {
- PyObject_TypePrettyPrinter(oss, PySequence_Fast_GET_ITEM(obj, 0));
+#ifdef Py_LIMITED_API
+ PyObject *obj_item = PySequence_GetItem(obj, 0);
+#else
+ PyObject *obj_item = PySequence_Fast_GET_ITEM(obj, 0);
+#endif
+ PyObject_TypePrettyPrinter(oss, obj_item);
+#ifdef Py_LIMITED_API
+ Py_DECREF(obj_item);
+#endif
oss << " list";
}
} else if (PySet_Check(obj)) {
@@ -136,14 +179,26 @@ namespace python
}
}
- inline std::nullptr_t raise_invalid_argument(char const name[],
- char const alternatives[],
+ inline std::nullptr_t raise_invalid_argument(char const name[], char const alternatives[],
PyObject *args, PyObject *kwargs)
{
std::ostringstream oss;
oss << "Invalid call to pythranized function `" << name << '(';
- for (long n = PyTuple_GET_SIZE(args), i = 0; i < n; ++i) {
- PyObject_TypePrettyPrinter(oss, PyTuple_GET_ITEM(args, i));
+#ifdef Py_LIMITED_API
+ Py_ssize_t args_size = PyTuple_Size(args);
+ // FIXME: should we propagate the error or something?
+ assert(args_size != -1);
+#else
+ Py_ssize_t args_size = PyTuple_GET_SIZE(args);
+#endif
+ for (long n = args_size, i = 0; i < n; ++i) {
+#ifdef Py_LIMITED_API
+ PyObject *args_item = PyTuple_GetItem(args, i);
+ assert(args_item);
+#else
+ PyObject *args_item = PyTuple_GET_ITEM(args, i);
+#endif
+ PyObject_TypePrettyPrinter(oss, args_item);
if (i != n - 1 || (kwargs && PyDict_Size(kwargs)))
oss << ", ";
}
@@ -153,8 +208,7 @@ namespace python
Py_ssize_t pos = 0;
for (int next = PyDict_Next(kwargs, &pos, &key, &value); next;) {
- PyObject *vrepr =
- PyObject_GetAttrString((PyObject *)Py_TYPE(value), "__name__");
+ PyObject *vrepr = PyObject_GetAttrString((PyObject *)Py_TYPE(value), "__name__");
oss << PyString_AS_STRING(key) << '=' << PyString_AS_STRING(vrepr);
Py_DECREF(vrepr);
if ((next = PyDict_Next(kwargs, &pos, &key, &value)))
diff --git a/contrib/python/pythran/pythran/pythonic/python/exception_handler.hpp b/contrib/python/pythran/pythran/pythonic/python/exception_handler.hpp
index 5f17bbcea48..5ab31c51aed 100644
--- a/contrib/python/pythran/pythran/pythonic/python/exception_handler.hpp
+++ b/contrib/python/pythran/pythran/pythonic/python/exception_handler.hpp
@@ -18,50 +18,42 @@ PyObject *handle_python_exception(F &&f)
}
#ifdef PYTHONIC_BUILTIN_SYNTAXWARNING_HPP
catch (pythonic::types::SyntaxWarning &e) {
- PyErr_SetString(PyExc_SyntaxWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_SyntaxWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_RUNTIMEWARNING_HPP
catch (pythonic::types::RuntimeWarning &e) {
- PyErr_SetString(PyExc_RuntimeWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_RuntimeWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_DEPRECATIONWARNING_HPP
catch (pythonic::types::DeprecationWarning &e) {
- PyErr_SetString(PyExc_DeprecationWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_DeprecationWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_IMPORTWARNING_HPP
catch (pythonic::types::ImportWarning &e) {
- PyErr_SetString(PyExc_ImportWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_ImportWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_UNICODEWARNING_HPP
catch (pythonic::types::UnicodeWarning &e) {
- PyErr_SetString(PyExc_UnicodeWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_UnicodeWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_BYTESWARNING_HPP
catch (pythonic::types::BytesWarning &e) {
- PyErr_SetString(PyExc_BytesWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_BytesWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_USERWARNING_HPP
catch (pythonic::types::UserWarning &e) {
- PyErr_SetString(PyExc_UserWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_UserWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_FUTUREWARNING_HPP
catch (pythonic::types::FutureWarning &e) {
- PyErr_SetString(PyExc_FutureWarning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_FutureWarning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_PENDINGDEPRECATIONWARNING_HPP
@@ -72,229 +64,191 @@ PyObject *handle_python_exception(F &&f)
#endif
#ifdef PYTHONIC_BUILTIN_WARNING_HPP
catch (pythonic::types::Warning &e) {
- PyErr_SetString(PyExc_Warning,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_Warning, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_UNICODEERROR_HPP
catch (pythonic::types::UnicodeError &e) {
- PyErr_SetString(PyExc_UnicodeError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_UnicodeError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_VALUEERROR_HPP
catch (pythonic::types::ValueError &e) {
- PyErr_SetString(PyExc_ValueError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_ValueError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_TYPEERROR_HPP
catch (pythonic::types::TypeError &e) {
- PyErr_SetString(PyExc_TypeError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_TypeError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_SYSTEMERROR_HPP
catch (pythonic::types::SystemError &e) {
- PyErr_SetString(PyExc_SystemError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_SystemError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_TABERROR_HPP
catch (pythonic::types::TabError &e) {
- PyErr_SetString(PyExc_TabError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_TabError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_INDENTATIONERROR_HPP
catch (pythonic::types::IndentationError &e) {
- PyErr_SetString(PyExc_IndentationError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_IndentationError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_SYNTAXERROR_HPP
catch (pythonic::types::SyntaxError &e) {
- PyErr_SetString(PyExc_SyntaxError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_SyntaxError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_NOTIMPLEMENTEDERROR_HPP
catch (pythonic::types::NotImplementedError &e) {
- PyErr_SetString(PyExc_NotImplementedError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_NotImplementedError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_RUNTIMEERROR_HPP
catch (pythonic::types::RuntimeError &e) {
- PyErr_SetString(PyExc_RuntimeError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_RuntimeError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_REFERENCEERROR_HPP
catch (pythonic::types::ReferenceError &e) {
- PyErr_SetString(PyExc_ReferenceError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_ReferenceError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_UNBOUNDLOCALERROR_HPP
catch (pythonic::types::UnboundLocalError &e) {
- PyErr_SetString(PyExc_UnboundLocalError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_UnboundLocalError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_NAMEERROR_HPP
catch (pythonic::types::NameError &e) {
- PyErr_SetString(PyExc_NameError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_NameError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_MEMORYERROR_HPP
catch (pythonic::types::MemoryError &e) {
- PyErr_SetString(PyExc_MemoryError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_MemoryError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_KEYERROR_HPP
catch (pythonic::types::KeyError &e) {
- PyErr_SetString(PyExc_KeyError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_KeyError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_INDEXERROR_HPP
catch (pythonic::types::IndexError &e) {
- PyErr_SetString(PyExc_IndexError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_IndexError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_LOOKUPERROR_HPP
catch (pythonic::types::LookupError &e) {
- PyErr_SetString(PyExc_LookupError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_LookupError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_IMPORTERROR_HPP
catch (pythonic::types::ImportError &e) {
- PyErr_SetString(PyExc_ImportError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_ImportError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_EOFERROR_HPP
catch (pythonic::types::EOFError &e) {
- PyErr_SetString(PyExc_EOFError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_EOFError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_OSERROR_HPP
catch (pythonic::types::OSError &e) {
- PyErr_SetString(PyExc_OSError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_OSError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_IOERROR_HPP
catch (pythonic::types::IOError &e) {
- PyErr_SetString(PyExc_IOError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_IOError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_ENVIRONMENTERROR_HPP
catch (pythonic::types::EnvironmentError &e) {
- PyErr_SetString(PyExc_EnvironmentError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_EnvironmentError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_ATTRIBUTEERROR_HPP
catch (pythonic::types::AttributeError &e) {
- PyErr_SetString(PyExc_AttributeError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_AttributeError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_ASSERTIONERROR_HPP
catch (pythonic::types::AssertionError &e) {
- PyErr_SetString(PyExc_AssertionError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_AssertionError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_ZERODIVISIONERROR_HPP
catch (pythonic::types::ZeroDivisionError &e) {
- PyErr_SetString(PyExc_ZeroDivisionError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_ZeroDivisionError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_OVERFLOWERROR_HPP
catch (pythonic::types::OverflowError &e) {
- PyErr_SetString(PyExc_OverflowError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_OverflowError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_FLOATINGPOINTERROR_HPP
catch (pythonic::types::FloatingPointError &e) {
- PyErr_SetString(PyExc_FloatingPointError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_FloatingPointError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_ARITHMETICERROR_HPP
catch (pythonic::types::ArithmeticError &e) {
- PyErr_SetString(PyExc_ArithmeticError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_ArithmeticError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_FILENOTFOUNDERROR_HPP
catch (pythonic::types::FileNotFoundError &e) {
- PyErr_SetString(PyExc_FileNotFoundError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_FileNotFoundError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_BUFFERERROR_HPP
catch (pythonic::types::BufferError &e) {
- PyErr_SetString(PyExc_BufferError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_BufferError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_STANDARDERROR_HPP
catch (pythonic::types::StandardError &e) {
- PyErr_SetString(PyExc_StandardError,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_StandardError, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_STOPITERATION_HPP
catch (pythonic::types::StopIteration &e) {
- PyErr_SetString(PyExc_StopIteration,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_StopIteration, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_EXCEPTION_HPP
catch (pythonic::types::Exception &e) {
- PyErr_SetString(PyExc_Exception,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_Exception, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_GENERATOREXIT_HPP
catch (pythonic::types::GeneratorExit &e) {
- PyErr_SetString(PyExc_GeneratorExit,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_GeneratorExit, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_KEYBOARDINTERRUPT_HPP
catch (pythonic::types::KeyboardInterrupt &e) {
- PyErr_SetString(PyExc_KeyboardInterrupt,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_KeyboardInterrupt, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_SYSTEMEXIT_HPP
catch (pythonic::types::SystemExit &e) {
- PyErr_SetString(PyExc_SystemExit,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_SystemExit, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
#ifdef PYTHONIC_BUILTIN_BASEEXCEPTION_HPP
catch (pythonic::types::BaseException &e) {
- PyErr_SetString(PyExc_BaseException,
- pythonic::builtins::functor::str{}(e.args).c_str());
+ PyErr_SetString(PyExc_BaseException, pythonic::builtins::functor::str{}(e.args).c_str());
}
#endif
catch (...) {
- PyErr_SetString(PyExc_RuntimeError,
- "Something happened on the way to heaven");
+ PyErr_SetString(PyExc_RuntimeError, "Something happened on the way to heaven");
}
return nullptr;
}
diff --git a/contrib/python/pythran/pythran/pythonic/random/choice.hpp b/contrib/python/pythran/pythran/pythonic/random/choice.hpp
index ca0e3299ed5..65f1dfdf58a 100644
--- a/contrib/python/pythran/pythran/pythonic/random/choice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/random/choice.hpp
@@ -16,9 +16,7 @@ namespace random
{
template <class Seq>
- typename std::enable_if<types::has_size<Seq>::value,
- typename Seq::value_type>::type
- choice(Seq const &seq)
+ std::enable_if_t<types::has_size<Seq>::value, typename Seq::value_type> choice(Seq const &seq)
{
auto tmp = seq.begin();
// std::advance not usable because it requires operator--
@@ -28,11 +26,9 @@ namespace random
}
template <class Seq>
- typename std::enable_if<!types::has_size<Seq>::value,
- typename Seq::value_type>::type
- choice(Seq const &seq)
+ std::enable_if_t<!types::has_size<Seq>::value, typename Seq::value_type> choice(Seq const &seq)
{
- using dtype = typename std::decay<typename Seq::value_type>::type;
+ using dtype = std::decay_t<typename Seq::value_type>;
std::vector<dtype, utils::allocator<dtype>> tmp(seq.begin(), seq.end());
return tmp[long(random() * tmp.size())];
}
diff --git a/contrib/python/pythran/pythran/pythonic/random/sample.hpp b/contrib/python/pythran/pythran/pythonic/random/sample.hpp
index 59389af38c2..420cd0c2243 100644
--- a/contrib/python/pythran/pythran/pythonic/random/sample.hpp
+++ b/contrib/python/pythran/pythran/pythonic/random/sample.hpp
@@ -15,13 +15,11 @@ namespace random
{
template <class Iterable>
types::list<typename std::iterator_traits<
- typename std::remove_cv<typename std::remove_reference<Iterable>::type>::
- type::iterator>::value_type>
+ typename std::remove_cv_t<std::remove_reference_t<Iterable>>::iterator>::value_type>
sample(Iterable &&s, size_t k)
{
- using value_type = typename std::iterator_traits<typename std::remove_cv<
- typename std::remove_reference<Iterable>::type>::type::iterator>::
- value_type;
+ using value_type = typename std::iterator_traits<
+ typename std::remove_cv_t<std::remove_reference_t<Iterable>>::iterator>::value_type;
types::list<value_type> tmp(s.begin(), s.end());
std::vector<size_t, utils::allocator<size_t>> indices(tmp.size());
std::iota(indices.begin(), indices.end(), 0);
diff --git a/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp b/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp
index 43f0366a79b..5703a7c8438 100644
--- a/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp
+++ b/contrib/python/pythran/pythran/pythonic/random/shuffle.hpp
@@ -52,8 +52,7 @@ namespace random
template <class T, class function>
types::none_type shuffle(T &seq, function &&randf)
{
- std::shuffle(seq.begin(), seq.end(),
- details::URG<function>(std::forward<function>(randf)));
+ std::shuffle(seq.begin(), seq.end(), details::URG<function>(std::forward<function>(randf)));
return builtins::None;
}
} // namespace random
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp
index e9182c797a7..cf6d61d3431 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/binom.hpp
@@ -21,12 +21,10 @@ namespace scipy
template <class T0, class T1>
double binom(T0 n, T1 k)
{
- static_assert(std::is_integral<T0>::value &&
- std::is_integral<T1>::value,
+ static_assert(std::is_integral<T0>::value && std::is_integral<T1>::value,
"only support integer case of scipy.special.binom");
using namespace boost::math::policies;
- return boost::math::binomial_coefficient<double>(
- n, k, make_policy(promote_double<true>()));
+ return boost::math::binomial_coefficient<double>(n, k, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp
index f972ed8d9b6..1ead08883ff 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/gammaincinv.hpp
@@ -22,8 +22,7 @@ namespace scipy
double gammaincinv(T0 a, T1 p)
{
using namespace boost::math::policies;
- return boost::math::gamma_p_inv(a, p,
- make_policy(promote_double<true>()));
+ return boost::math::gamma_p_inv(a, p, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp
index 658a3f3010c..3a8d8d59054 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/iv.hpp
@@ -22,8 +22,7 @@ namespace scipy
double iv(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_bessel_i(x, y,
- make_policy(promote_double<true>()));
+ return boost::math::cyl_bessel_i(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp
index db689f15000..fceba8cf86e 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/ivp.hpp
@@ -22,8 +22,7 @@ namespace scipy
double ivp(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_bessel_i_prime(
- x, y, make_policy(promote_double<true>()));
+ return boost::math::cyl_bessel_i_prime(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp
index 8485907ac90..083a8669a8c 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/jv.hpp
@@ -22,8 +22,7 @@ namespace scipy
double jv(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_bessel_j(x, y,
- make_policy(promote_double<true>()));
+ return boost::math::cyl_bessel_j(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp
index c9a674c2a7f..50890521688 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/jvp.hpp
@@ -22,8 +22,7 @@ namespace scipy
double jvp(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_bessel_j_prime(
- x, y, make_policy(promote_double<true>()));
+ return boost::math::cyl_bessel_j_prime(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp
index 406bb1a96d8..acbc9bb5a3a 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/kv.hpp
@@ -22,8 +22,7 @@ namespace scipy
double kv(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_bessel_k(x, y,
- make_policy(promote_double<true>()));
+ return boost::math::cyl_bessel_k(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp
index 3f916ef3620..7c5197f02bd 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/kvp.hpp
@@ -22,8 +22,7 @@ namespace scipy
double kvp(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_bessel_k_prime(
- x, y, make_policy(promote_double<true>()));
+ return boost::math::cyl_bessel_k_prime(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp
index da92301c2cb..09c37ba4a0e 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_jn.hpp
@@ -22,15 +22,12 @@ namespace scipy
template <class T0, class T1>
double spherical_jn(T0 v, T1 x, bool derivative)
{
- assert(v == (long)v &&
- "only supported for integral value as first arg");
+ assert(v == (long)v && "only supported for integral value as first arg");
using namespace boost::math::policies;
if (derivative) {
- return boost::math::sph_bessel_prime(
- v, x, make_policy(promote_double<true>()));
+ return boost::math::sph_bessel_prime(v, x, make_policy(promote_double<true>()));
} else {
- return boost::math::sph_bessel(v, x,
- make_policy(promote_double<true>()));
+ return boost::math::sph_bessel(v, x, make_policy(promote_double<true>()));
}
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp
index 952587984a2..87f22d2fb70 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/spherical_yn.hpp
@@ -22,15 +22,12 @@ namespace scipy
template <class T0, class T1>
double spherical_yn(T0 v, T1 x, bool derivative)
{
- assert(v == (long)v &&
- "only supported for integral value as first arg");
+ assert(v == (long)v && "only supported for integral value as first arg");
using namespace boost::math::policies;
if (derivative) {
- return boost::math::sph_neumann_prime(
- v, x, make_policy(promote_double<true>()));
+ return boost::math::sph_neumann_prime(v, x, make_policy(promote_double<true>()));
} else {
- return boost::math::sph_neumann(v, x,
- make_policy(promote_double<true>()));
+ return boost::math::sph_neumann(v, x, make_policy(promote_double<true>()));
}
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp
index 42462a1edba..0629ea89ca4 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/yv.hpp
@@ -22,8 +22,7 @@ namespace scipy
double yv(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_neumann(x, y,
- make_policy(promote_double<true>()));
+ return boost::math::cyl_neumann(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp b/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp
index b8cb59ab67b..aed9bc349e4 100644
--- a/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp
+++ b/contrib/python/pythran/pythran/pythonic/scipy/special/yvp.hpp
@@ -22,8 +22,7 @@ namespace scipy
double yvp(T0 x, T1 y)
{
using namespace boost::math::policies;
- return boost::math::cyl_neumann_prime(
- x, y, make_policy(promote_double<true>()));
+ return boost::math::cyl_neumann_prime(x, y, make_policy(promote_double<true>()));
}
} // namespace details
diff --git a/contrib/python/pythran/pythran/pythonic/time/time.hpp b/contrib/python/pythran/pythran/pythonic/time/time.hpp
index 3dac449d7d2..86ba8b5ec97 100644
--- a/contrib/python/pythran/pythran/pythonic/time/time.hpp
+++ b/contrib/python/pythran/pythran/pythonic/time/time.hpp
@@ -13,11 +13,8 @@ namespace time
double time()
{
- std::chrono::time_point<std::chrono::steady_clock> tp =
- std::chrono::steady_clock::now();
- return std::chrono::duration_cast<std::chrono::milliseconds>(
- tp.time_since_epoch())
- .count() /
+ std::chrono::time_point<std::chrono::steady_clock> tp = std::chrono::steady_clock::now();
+ return std::chrono::duration_cast<std::chrono::milliseconds>(tp.time_since_epoch()).count() /
1000.;
}
} // namespace time
diff --git a/contrib/python/pythran/pythran/pythonic/types/NoneType.hpp b/contrib/python/pythran/pythran/pythonic/types/NoneType.hpp
index 3952b8092a9..ca47b5ac508 100644
--- a/contrib/python/pythran/pythran/pythonic/types/NoneType.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/NoneType.hpp
@@ -62,8 +62,7 @@ namespace types
template <class T>
none<T, false>::operator bool() const
{
- return !is_none &&
- builtins::functor::bool_{}(static_cast<const T &>(*this));
+ return !is_none && builtins::functor::bool_{}(static_cast<const T &>(*this));
}
template <class T>
@@ -136,15 +135,15 @@ namespace types
}
template <class T0, class T1>
- decltype(operator_::mod(std::declval<T0>(), std::declval<T1>()))
- operator%(none<T0> const &t0, T1 const &t1)
+ decltype(operator_::mod(std::declval<T0>(), std::declval<T1>())) operator%(none<T0> const &t0,
+ T1 const &t1)
{
return operator_::mod(t0.data, t1);
}
template <class T0, class T1>
- decltype(operator_::mod(std::declval<T0>(), std::declval<T1>()))
- operator%(T0 const &t0, none<T1> const &t1)
+ decltype(operator_::mod(std::declval<T0>(), std::declval<T1>())) operator%(T0 const &t0,
+ none<T1> const &t1)
{
return operator_::mod(t0, t1.data);
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/array.hpp b/contrib/python/pythran/pythran/pythonic/types/array.hpp
index b10d9405e01..b567f42180c 100644
--- a/contrib/python/pythran/pythran/pythonic/types/array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/array.hpp
@@ -30,8 +30,7 @@ namespace types
{
}
template <class T, class S>
- sliced_array<T, S>::sliced_array(sliced_array<T, S> const &s)
- : _data(s._data), slicing(s.slicing)
+ sliced_array<T, S>::sliced_array(sliced_array<T, S> const &s) : _data(s._data), slicing(s.slicing)
{
}
template <class T, class S>
@@ -41,8 +40,7 @@ namespace types
}
template <class T, class S>
template <class Sn>
- sliced_array<T, S>::sliced_array(
- utils::shared_ref<container_type> const &other, Sn const &s)
+ sliced_array<T, S>::sliced_array(utils::shared_ref<container_type> const &other, Sn const &s)
: _data(other), slicing(s)
{
}
@@ -83,8 +81,7 @@ namespace types
// accessor
template <class T, class S>
- typename sliced_array<T, S>::const_reference
- sliced_array<T, S>::fast(long i) const
+ typename sliced_array<T, S>::const_reference sliced_array<T, S>::fast(long i) const
{
assert(0 <= i && i < size());
auto const index = slicing.get(i);
@@ -100,8 +97,7 @@ namespace types
return (*_data)[index];
}
template <class T, class S>
- typename sliced_array<T, S>::const_reference
- sliced_array<T, S>::operator[](long i) const
+ typename sliced_array<T, S>::const_reference sliced_array<T, S>::operator[](long i) const
{
assert(i < size());
auto const index = slicing.get(i);
@@ -119,9 +115,8 @@ namespace types
template <class T, class S>
template <class Sp>
- typename std::enable_if<
- is_slice<Sp>::value,
- sliced_array<T, decltype(std::declval<S>() * std::declval<Sp>())>>::type
+ std::enable_if_t<is_slice<Sp>::value,
+ sliced_array<T, decltype(std::declval<S>() * std::declval<Sp>())>>
sliced_array<T, S>::operator[](Sp s) const
{
return {_data, slicing * s.normalize(this->size())};
@@ -153,8 +148,7 @@ namespace types
return std::equal(begin(), end(), other.begin());
}
template <class T, class S>
- inline sliced_array<T, S> &
- sliced_array<T, S>::operator=(sliced_array<T, S> const &s)
+ inline sliced_array<T, S> &sliced_array<T, S>::operator=(sliced_array<T, S> const &s)
{
if (slicing.step == 1) {
// inserting before erasing in case of self-copy
@@ -211,21 +205,18 @@ namespace types
#ifdef USE_XSIMD
template <class T, class S>
template <class vectorizer>
- typename sliced_array<T, S>::simd_iterator
- sliced_array<T, S>::vbegin(vectorizer) const
+ typename sliced_array<T, S>::simd_iterator sliced_array<T, S>::vbegin(vectorizer) const
{
return {_data->data() + slicing.lower};
}
template <class T, class S>
template <class vectorizer>
- typename sliced_array<T, S>::simd_iterator
- sliced_array<T, S>::vend(vectorizer) const
+ typename sliced_array<T, S>::simd_iterator sliced_array<T, S>::vend(vectorizer) const
{
using vector_type = typename xsimd::batch<dtype>;
static const std::size_t vector_size = vector_type::size;
- return {_data->data() + slicing.lower +
- long(size() / vector_size * vector_size)};
+ return {_data->data() + slicing.lower + long(size() / vector_size * vector_size)};
}
#endif
@@ -261,9 +252,8 @@ namespace types
template <class InputIterator>
array<T>::array(InputIterator start, InputIterator stop) : _data()
{
- if (std::is_same<
- typename std::iterator_traits<InputIterator>::iterator_category,
- std::random_access_iterator_tag>::value)
+ if (std::is_same<typename std::iterator_traits<InputIterator>::iterator_category,
+ std::random_access_iterator_tag>::value)
_data->reserve(std::distance(start, stop));
else
_data->reserve(DEFAULT_CAPACITY);
@@ -289,8 +279,7 @@ namespace types
}
template <class T>
template <class Tp, class S>
- array<T>::array(sliced_array<Tp, S> const &other)
- : _data(other.begin(), other.end())
+ array<T>::array(sliced_array<Tp, S> const &other) : _data(other.begin(), other.end())
{
}
@@ -419,14 +408,12 @@ namespace types
template <class T>
bool array<T>::operator<(array<T> const &other) const
{
- return std::lexicographical_compare(begin(), end(), other.begin(),
- other.end());
+ return std::lexicographical_compare(begin(), end(), other.begin(), other.end());
}
template <class T>
bool array<T>::operator>(array<T> const &other) const
{
- return std::lexicographical_compare(other.begin(), other.end(), begin(),
- end());
+ return std::lexicographical_compare(other.begin(), other.end(), begin(), end());
}
template <class T>
bool array<T>::operator<=(array<T> const &other) const
@@ -488,8 +475,7 @@ namespace types
template <class T>
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value, sliced_array<T, Sp>>::type
- array<T>::operator[](Sp const &s) const
+ std::enable_if_t<is_slice<Sp>::value, sliced_array<T, Sp>> array<T>::operator[](Sp const &s) const
{
return {*this, s};
}
@@ -568,8 +554,7 @@ namespace types
template <class T>
template <class F>
- array<typename __combined<T, F>::type>
- array<T>::operator+(array<F> const &s) const
+ array<typename __combined<T, F>::type> array<T>::operator+(array<F> const &s) const
{
array<typename __combined<T, F>::type> clone(size() + s.size());
std::copy(s.begin(), s.end(), std::copy(begin(), end(), clone.begin()));
@@ -578,12 +563,10 @@ namespace types
template <class T>
template <class F, class S>
- array<decltype(std::declval<T>() +
- std::declval<typename sliced_array<F, S>::value_type>())>
+ array<decltype(std::declval<T>() + std::declval<typename sliced_array<F, S>::value_type>())>
array<T>::operator+(sliced_array<F, S> const &s) const
{
- array<decltype(std::declval<T>() +
- std::declval<typename sliced_array<F, S>::value_type>())>
+ array<decltype(std::declval<T>() + std::declval<typename sliced_array<F, S>::value_type>())>
clone(size() + len(s));
std::copy(s.begin(), s.end(), std::copy(begin(), end(), clone.begin()));
return clone;
@@ -645,8 +628,7 @@ namespace types
template <class E, size_t L>
long array<T>::_flat_size(E const &e, utils::int_<L>) const
{
- return std::distance(e.begin(), e.end()) *
- _flat_size(e[0], utils::int_<L - 1>{});
+ return std::distance(e.begin(), e.end()) * _flat_size(e[0], utils::int_<L - 1>{});
}
template <class T>
long array<T>::flat_size() const
@@ -678,8 +660,7 @@ namespace utils
{
template <class T, class From>
- void reserve(types::array<T> &l, From const &f,
- typename From::const_iterator *)
+ void reserve(types::array<T> &l, From const &f, typename From::const_iterator *)
{
l.reserve(builtins::len(f));
}
@@ -690,22 +671,19 @@ PYTHONIC_NS_END
namespace std
{
template <size_t I, class T>
- typename pythonic::types::array<T>::reference
- get(pythonic::types::array<T> &t)
+ typename pythonic::types::array<T>::reference get(pythonic::types::array<T> &t)
{
return t[I];
}
template <size_t I, class T>
- typename pythonic::types::array<T>::const_reference
- get(pythonic::types::array<T> const &t)
+ typename pythonic::types::array<T>::const_reference get(pythonic::types::array<T> const &t)
{
return t[I];
}
template <size_t I, class T>
- typename pythonic::types::array<T>::value_type
- get(pythonic::types::array<T> &&t)
+ typename pythonic::types::array<T>::value_type get(pythonic::types::array<T> &&t)
{
return std::move(t)[I];
}
@@ -739,15 +717,12 @@ PYTHONIC_NS_BEGIN
template <class T>
PyObject *to_python<types::array<T>>::convert(types::array<T> const &v)
{
- throw types::NotImplementedError(
- "Pythran cannot efficiently convert array::array values");
+ throw types::NotImplementedError("Pythran cannot efficiently convert array::array values");
}
template <class T, class S>
-PyObject *to_python<types::sliced_array<T, S>>::convert(
- types::sliced_array<T, S> const &v)
+PyObject *to_python<types::sliced_array<T, S>>::convert(types::sliced_array<T, S> const &v)
{
- throw types::NotImplementedError(
- "Pythran cannot efficiently convert array::array values");
+ throw types::NotImplementedError("Pythran cannot efficiently convert array::array values");
}
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/types/bool.hpp b/contrib/python/pythran/pythran/pythonic/types/bool.hpp
index 35ac01d37d9..22764118708 100644
--- a/contrib/python/pythran/pythran/pythonic/types/bool.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/bool.hpp
@@ -18,8 +18,7 @@ inline PyObject *to_python<bool>::convert(bool b)
inline bool from_python<bool>::is_convertible(PyObject *obj)
{
- return obj == Py_True || obj == Py_False ||
- PyObject_TypeCheck(obj, &PyBoolArrType_Type);
+ return obj == Py_True || obj == Py_False || PyObject_TypeCheck(obj, &PyBoolArrType_Type);
}
inline bool from_python<bool>::convert(PyObject *obj)
{
@@ -28,7 +27,7 @@ inline bool from_python<bool>::convert(PyObject *obj)
else if (obj == Py_False)
return false;
else
- return PyInt_AsLong(obj);
+ return PyObject_IsTrue(obj);
}
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/types/cfun.hpp b/contrib/python/pythran/pythran/pythonic/types/cfun.hpp
index 058f7080ed7..14efd3dc042 100644
--- a/contrib/python/pythran/pythran/pythonic/types/cfun.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/cfun.hpp
@@ -25,8 +25,7 @@ PYTHONIC_NS_END
PYTHONIC_NS_BEGIN
template <class R, class... Args>
-PyObject *
-to_python<types::cfun<R(Args...)>>::convert(types::cfun<R(Args...)> const &v)
+PyObject *to_python<types::cfun<R(Args...)>>::convert(types::cfun<R(Args...)> const &v)
{
return PyCapsule_New(v.ptr, nullptr, nullptr);
}
@@ -38,11 +37,9 @@ bool from_python<types::cfun<R(Args...)>>::is_convertible(PyObject *obj)
}
template <class R, class... Args>
-types::cfun<R(Args...)>
-from_python<types::cfun<R(Args...)>>::convert(PyObject *obj)
+types::cfun<R(Args...)> from_python<types::cfun<R(Args...)>>::convert(PyObject *obj)
{
- void *ptr = PyCapsule_GetPointer(
- obj, PyCapsule_GetName(obj) /* avoid the string check*/);
+ void *ptr = PyCapsule_GetPointer(obj, PyCapsule_GetName(obj) /* avoid the string check*/);
return {reinterpret_cast<R (*)(Args...)>(ptr)};
}
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/types/complex.hpp b/contrib/python/pythran/pythran/pythonic/types/complex.hpp
index 929a3d20068..294f7e6dc40 100644
--- a/contrib/python/pythran/pythran/pythonic/types/complex.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/complex.hpp
@@ -13,57 +13,49 @@ namespace std
template <class T, class S>
complex_broadcast_t<T, S> operator+(std::complex<T> self, S other)
{
- return (complex_broadcast_t<T, S>)self +
- (typename std::common_type<T, S>::type)(other);
+ return (complex_broadcast_t<T, S>)self + (std::common_type_t<T, S>)(other);
}
template <class T, class S>
complex_broadcast_t<T, S> operator+(S self, std::complex<T> other)
{
- return (typename std::common_type<T, S>::type)(self) +
- (complex_broadcast_t<T, S>)other;
+ return (std::common_type_t<T, S>)(self) + (complex_broadcast_t<T, S>)other;
}
template <class T, class S>
complex_broadcast_t<T, S> operator-(std::complex<T> self, S other)
{
- return (complex_broadcast_t<T, S>)self -
- (typename std::common_type<T, S>::type)(other);
+ return (complex_broadcast_t<T, S>)self - (std::common_type_t<T, S>)(other);
}
template <class T, class S>
complex_broadcast_t<T, S> operator-(S self, std::complex<T> other)
{
- return (typename std::common_type<T, S>::type)(self) -
- (complex_broadcast_t<T, S>)other;
+ return (std::common_type_t<T, S>)(self) - (complex_broadcast_t<T, S>)other;
}
template <class T, class S>
complex_broadcast_t<T, S> operator*(std::complex<T> self, S other)
{
- return (complex_broadcast_t<T, S>)self *
- (typename std::common_type<T, S>::type)(other);
+ return (complex_broadcast_t<T, S>)self * (std::common_type_t<T, S>)(other);
}
template <class T, class S>
complex_broadcast_t<T, S> operator*(S self, std::complex<T> other)
{
- return (typename std::common_type<T, S>::type)(self) *
- (complex_broadcast_t<T, S>)other;
+ return (std::common_type_t<T, S>)(self) * (complex_broadcast_t<T, S>)other;
}
template <class T, class S>
complex_broadcast_t<T, S> operator/(std::complex<T> self, S other)
{
- return (complex_broadcast_t<T, S>)self /
- (typename std::common_type<T, S>::type)(other);
+ return (complex_broadcast_t<T, S>)self / (std::common_type_t<T, S>)(other);
}
template <class T, class S>
complex_broadcast_t<T, S> operator/(S self, std::complex<T> other)
{
- return (typename std::common_type<T, S>::type)(self) /
- (complex_broadcast_t<T, S>)other;
+ return (std::common_type_t<T, S>)(self) / (complex_broadcast_t<T, S>)other;
}
template <class T, class S>
@@ -93,29 +85,25 @@ namespace std
template <class T, class S>
bool operator<(std::complex<T> self, std::complex<S> other)
{
- return self.real() == other.real() ? self.imag() < other.imag()
- : self.real() < other.real();
+ return self.real() == other.real() ? self.imag() < other.imag() : self.real() < other.real();
}
template <class T, class S>
bool operator<=(std::complex<T> self, std::complex<S> other)
{
- return self.real() == other.real() ? self.imag() <= other.imag()
- : self.real() <= other.real();
+ return self.real() == other.real() ? self.imag() <= other.imag() : self.real() <= other.real();
}
template <class T, class S>
bool operator>(std::complex<T> self, std::complex<S> other)
{
- return self.real() == other.real() ? self.imag() > other.imag()
- : self.real() > other.real();
+ return self.real() == other.real() ? self.imag() > other.imag() : self.real() > other.real();
}
template <class T, class S>
bool operator>=(std::complex<T> self, std::complex<S> other)
{
- return self.real() == other.real() ? self.imag() >= other.imag()
- : self.real() >= other.real();
+ return self.real() == other.real() ? self.imag() >= other.imag() : self.real() >= other.real();
}
template <class T, class S>
@@ -156,18 +144,16 @@ namespace builtins
{
return std::imag(self);
}
- inline numpy::functor::complex64 getattr(types::attr::DTYPE,
- std::complex<float> const &self)
+ inline numpy::functor::complex64 getattr(types::attr::DTYPE, std::complex<float> const &self)
{
return {};
}
- inline numpy::functor::complex128 getattr(types::attr::DTYPE,
- std::complex<double> const &self)
+ inline numpy::functor::complex128 getattr(types::attr::DTYPE, std::complex<double> const &self)
{
return {};
}
- inline numpy::functor::complex256
- getattr(types::attr::DTYPE, std::complex<long double> const &self)
+ inline numpy::functor::complex256 getattr(types::attr::DTYPE,
+ std::complex<long double> const &self)
{
return {};
}
@@ -183,31 +169,27 @@ PYTHONIC_NS_END
PYTHONIC_NS_BEGIN
template <>
-inline PyObject *to_python<std::complex<long double>>::convert(
- std::complex<long double> const &c)
+inline PyObject *to_python<std::complex<long double>>::convert(std::complex<long double> const &c)
{
return PyArray_Scalar(const_cast<std::complex<long double> *>(&c),
PyArray_DescrFromType(NPY_CLONGDOUBLE), nullptr);
}
template <>
-inline PyObject *
-to_python<std::complex<double>>::convert(std::complex<double> const &c)
+inline PyObject *to_python<std::complex<double>>::convert(std::complex<double> const &c)
{
return PyComplex_FromDoubles(c.real(), c.imag());
}
template <>
-inline PyObject *
-to_python<std::complex<float>>::convert(std::complex<float> const &c)
+inline PyObject *to_python<std::complex<float>>::convert(std::complex<float> const &c)
{
- return PyArray_Scalar(const_cast<std::complex<float> *>(&c),
- PyArray_DescrFromType(NPY_CFLOAT), nullptr);
+ return PyArray_Scalar(const_cast<std::complex<float> *>(&c), PyArray_DescrFromType(NPY_CFLOAT),
+ nullptr);
}
template <>
-inline bool
-from_python<std::complex<long double>>::is_convertible(PyObject *obj)
+inline bool from_python<std::complex<long double>>::is_convertible(PyObject *obj)
{
return PyArray_IsScalar(obj, CLongDouble);
}
@@ -225,25 +207,32 @@ inline bool from_python<std::complex<float>>::is_convertible(PyObject *obj)
}
template <>
-inline std::complex<long double>
-from_python<std::complex<long double>>::convert(PyObject *obj)
+inline std::complex<long double> from_python<std::complex<long double>>::convert(PyObject *obj)
{
+#ifdef Py_LIMITED_API
+ npy_clongdouble val;
+ PyArray_ScalarAsCtype(obj, &val);
+#else
auto val = PyArrayScalar_VAL(obj, CLongDouble);
+#endif
return {npy_creall(val), npy_cimagl(val)};
}
template <>
-inline std::complex<double>
-from_python<std::complex<double>>::convert(PyObject *obj)
+inline std::complex<double> from_python<std::complex<double>>::convert(PyObject *obj)
{
return {PyComplex_RealAsDouble(obj), PyComplex_ImagAsDouble(obj)};
}
template <>
-inline std::complex<float>
-from_python<std::complex<float>>::convert(PyObject *obj)
+inline std::complex<float> from_python<std::complex<float>>::convert(PyObject *obj)
{
+#ifdef Py_LIMITED_API
+ npy_cfloat val;
+ PyArray_ScalarAsCtype(obj, &val);
+#else
auto val = PyArrayScalar_VAL(obj, CFloat);
+#endif
return {npy_crealf(val), npy_cimagf(val)};
}
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/types/dict.hpp b/contrib/python/pythran/pythran/pythonic/types/dict.hpp
index 5bc7cbc89fb..f5eee0a43f8 100644
--- a/contrib/python/pythran/pythran/pythonic/types/dict.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/dict.hpp
@@ -26,10 +26,10 @@ namespace types
{
}
template <class I>
- typename item_iterator_adaptator<I>::value_type
- item_iterator_adaptator<I>::operator*() const
+ typename item_iterator_adaptator<I>::value_type item_iterator_adaptator<I>::operator*() const
{
- auto &&tmp = *base;;
+ auto &&tmp = *base;
+ ;
return pythonic::types::make_tuple(tmp.first, tmp.second);
}
@@ -40,8 +40,7 @@ namespace types
}
template <class I>
- typename key_iterator_adaptator<I>::value_type
- key_iterator_adaptator<I>::operator*() const
+ typename key_iterator_adaptator<I>::value_type key_iterator_adaptator<I>::operator*() const
{
return base->first;
}
@@ -53,8 +52,7 @@ namespace types
}
template <class I>
- typename value_iterator_adaptator<I>::value_type
- value_iterator_adaptator<I>::operator*() const
+ typename value_iterator_adaptator<I>::value_type value_iterator_adaptator<I>::operator*() const
{
return base->second;
}
@@ -154,8 +152,7 @@ namespace types
}
template <class K, class V>
- dict<K, V>::dict(std::initializer_list<value_type> l)
- : data(l.begin(), l.end())
+ dict<K, V>::dict(std::initializer_list<value_type> l) : data(l.begin(), l.end())
{
}
@@ -166,8 +163,7 @@ namespace types
template <class K, class V>
template <class Kp, class Vp>
- dict<K, V>::dict(dict<Kp, Vp> const &other)
- : data(other.data->begin(), other.data->end())
+ dict<K, V>::dict(dict<Kp, Vp> const &other) : data(other.data->begin(), other.data->end())
{
}
@@ -187,8 +183,8 @@ namespace types
template <class K, class V>
typename dict<K, V>::const_iterator dict<K, V>::begin() const
{
- return key_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->begin());
+ return key_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(
+ data->begin());
}
template <class K, class V>
@@ -200,92 +196,84 @@ namespace types
template <class K, class V>
typename dict<K, V>::const_iterator dict<K, V>::end() const
{
- return key_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->end());
+ return key_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(data->end());
}
template <class K, class V>
typename dict<K, V>::item_iterator dict<K, V>::item_begin()
{
- return item_iterator_adaptator<
- typename dict<K, V>::container_type::iterator>(data->begin());
+ return item_iterator_adaptator<typename dict<K, V>::container_type::iterator>(data->begin());
}
template <class K, class V>
typename dict<K, V>::item_const_iterator dict<K, V>::item_begin() const
{
- return item_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->begin());
+ return item_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(
+ data->begin());
}
template <class K, class V>
typename dict<K, V>::item_iterator dict<K, V>::item_end()
{
- return item_iterator_adaptator<
- typename dict<K, V>::container_type::iterator>(data->end());
+ return item_iterator_adaptator<typename dict<K, V>::container_type::iterator>(data->end());
}
template <class K, class V>
typename dict<K, V>::item_const_iterator dict<K, V>::item_end() const
{
- return item_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->end());
+ return item_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(
+ data->end());
}
template <class K, class V>
typename dict<K, V>::key_iterator dict<K, V>::key_begin()
{
- return key_iterator_adaptator<
- typename dict<K, V>::container_type::iterator>(data->begin());
+ return key_iterator_adaptator<typename dict<K, V>::container_type::iterator>(data->begin());
}
template <class K, class V>
typename dict<K, V>::key_const_iterator dict<K, V>::key_begin() const
{
- return key_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->begin());
+ return key_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(
+ data->begin());
}
template <class K, class V>
typename dict<K, V>::key_iterator dict<K, V>::key_end()
{
- return key_iterator_adaptator<
- typename dict<K, V>::container_type::iterator>(data->end());
+ return key_iterator_adaptator<typename dict<K, V>::container_type::iterator>(data->end());
}
template <class K, class V>
typename dict<K, V>::key_const_iterator dict<K, V>::key_end() const
{
- return key_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->end());
+ return key_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(data->end());
}
template <class K, class V>
typename dict<K, V>::value_iterator dict<K, V>::value_begin()
{
- return value_iterator_adaptator<
- typename dict<K, V>::container_type::iterator>(data->begin());
+ return value_iterator_adaptator<typename dict<K, V>::container_type::iterator>(data->begin());
}
template <class K, class V>
typename dict<K, V>::value_const_iterator dict<K, V>::value_begin() const
{
- return value_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->begin());
+ return value_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(
+ data->begin());
}
template <class K, class V>
typename dict<K, V>::value_iterator dict<K, V>::value_end()
{
- return value_iterator_adaptator<
- typename dict<K, V>::container_type::iterator>(data->end());
+ return value_iterator_adaptator<typename dict<K, V>::container_type::iterator>(data->end());
}
template <class K, class V>
typename dict<K, V>::value_const_iterator dict<K, V>::value_end() const
{
- return value_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->end());
+ return value_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(
+ data->end());
}
// dict interface
@@ -325,8 +313,8 @@ namespace types
template <class K, class V>
typename dict<K, V>::item_const_iterator dict<K, V>::find(K const &key) const
{
- return item_iterator_adaptator<
- typename dict<K, V>::container_type::const_iterator>(data->find(key));
+ return item_iterator_adaptator<typename dict<K, V>::container_type::const_iterator>(
+ data->find(key));
}
template <class K, class V>
diff --git a/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp b/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp
index 9e516b43f07..2310669a763 100644
--- a/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/dynamic_tuple.hpp
@@ -56,8 +56,7 @@ namespace types
template <typename T>
bool dynamic_tuple<T>::operator<(dynamic_tuple<T> const &other) const
{
- return std::lexicographical_compare(begin(), end(), other.begin(),
- other.end(), std::less<T>());
+ return std::lexicographical_compare(begin(), end(), other.begin(), other.end(), std::less<T>());
}
template <typename T>
@@ -65,15 +64,14 @@ namespace types
{
if (size() == other.size() && std::equal(begin(), end(), other.begin()))
return true;
- return std::lexicographical_compare(begin(), end(), other.begin(),
- other.end(), std::less<T>());
+ return std::lexicographical_compare(begin(), end(), other.begin(), other.end(), std::less<T>());
}
template <typename T>
bool dynamic_tuple<T>::operator>(dynamic_tuple<T> const &other) const
{
- return std::lexicographical_compare(begin(), end(), other.begin(),
- other.end(), std::greater<T>());
+ return std::lexicographical_compare(begin(), end(), other.begin(), other.end(),
+ std::greater<T>());
}
template <typename T>
@@ -81,13 +79,12 @@ namespace types
{
if (size() == other.size() && std::equal(begin(), end(), other.begin()))
return true;
- return std::lexicographical_compare(begin(), end(), other.begin(),
- other.end(), std::greater<T>());
+ return std::lexicographical_compare(begin(), end(), other.begin(), other.end(),
+ std::greater<T>());
}
template <typename T>
- dynamic_tuple<T>
- dynamic_tuple<T>::operator+(dynamic_tuple<T> const &other) const
+ dynamic_tuple<T> dynamic_tuple<T>::operator+(dynamic_tuple<T> const &other) const
{
dynamic_tuple<T> result(begin(), end());
result.data->resize(size() + other.size());
@@ -119,9 +116,12 @@ namespace std
PYTHONIC_NS_BEGIN
+#ifdef Py_LIMITED_API
+#define PyTuple_SET_ITEM PyTuple_SetItem
+#endif
+
template <typename T>
-PyObject *
-to_python<types::dynamic_tuple<T>>::convert(types::dynamic_tuple<T> const &t)
+PyObject *to_python<types::dynamic_tuple<T>>::convert(types::dynamic_tuple<T> const &t)
{
size_t N = t.size();
PyObject *out = PyTuple_New(N);
@@ -130,6 +130,9 @@ to_python<types::dynamic_tuple<T>>::convert(types::dynamic_tuple<T> const &t)
return out;
}
+#ifdef Py_LIMITED_API
+#undef PyTuple_SET_ITEM
+#endif
PYTHONIC_NS_END
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/types/exceptions.hpp b/contrib/python/pythran/pythran/pythonic/types/exceptions.hpp
index 187498c2c3f..101c0094f6a 100644
--- a/contrib/python/pythran/pythran/pythonic/types/exceptions.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/exceptions.hpp
@@ -17,8 +17,7 @@ namespace types
{
template <typename... Types>
- BaseException::BaseException(Types const &...types)
- : args({builtins::functor::str{}(types)...})
+ BaseException::BaseException(Types const &...types) : args({builtins::functor::str{}(types)...})
{
}
@@ -76,64 +75,60 @@ namespace types
PYTHONIC_NS_END
#include "pythonic/utils/functor.hpp"
-#define PYTHONIC_EXCEPTION_IMPL(name) \
- template <typename... Types> \
- types::name name(Types const &...args) \
- { \
- return types::name(args...); \
+#define PYTHONIC_EXCEPTION_IMPL(name) \
+ template <typename... Types> \
+ types::name name(Types const &...args) \
+ { \
+ return types::name(args...); \
}
/* pythran attribute system { */
-#define IMPL_EXCEPTION_GETATTR(name) \
- PYTHONIC_NS_BEGIN \
- namespace builtins \
- { \
- inline types::none<types::dynamic_tuple<types::str>> \
- getattr(types::attr::ARGS, types::name const &f) \
- { \
- return f.args; \
- } \
- } \
+#define IMPL_EXCEPTION_GETATTR(name) \
+ PYTHONIC_NS_BEGIN \
+ namespace builtins \
+ { \
+ inline types::none<types::dynamic_tuple<types::str>> getattr(types::attr::ARGS, \
+ types::name const &f) \
+ { \
+ return f.args; \
+ } \
+ } \
PYTHONIC_NS_END
-#define IMPL_EXCEPTION_GETATTR_FULL(name) \
- PYTHONIC_NS_BEGIN \
- namespace builtins \
- { \
- inline types::none<types::dynamic_tuple<types::str>> \
- getattr(types::attr::ARGS, types::name const &e) \
- { \
- if (e.args.size() > 3 || e.args.size() < 2) \
- return e.args; \
- else \
- return types::dynamic_tuple<types::str>(e.args.begin(), \
- e.args.begin() + 2); \
- } \
- inline types::none<types::str> getattr(types::attr::ERRNO, \
- types::name const &e) \
- { \
- if (e.args.size() > 3 || e.args.size() < 2) \
- return builtins::None; \
- else \
- return e.args[0]; \
- } \
- inline types::none<types::str> getattr(types::attr::STRERROR, \
- types::name const &e) \
- { \
- if (e.args.size() > 3 || e.args.size() < 2) \
- return builtins::None; \
- else \
- return e.args[1]; \
- } \
- inline types::none<types::str> getattr(types::attr::FILENAME, \
- types::name const &e) \
- { \
- if (e.args.size() != 3) \
- return builtins::None; \
- else \
- return e.args[2]; \
- } \
- } \
+#define IMPL_EXCEPTION_GETATTR_FULL(name) \
+ PYTHONIC_NS_BEGIN \
+ namespace builtins \
+ { \
+ inline types::none<types::dynamic_tuple<types::str>> getattr(types::attr::ARGS, \
+ types::name const &e) \
+ { \
+ if (e.args.size() > 3 || e.args.size() < 2) \
+ return e.args; \
+ else \
+ return types::dynamic_tuple<types::str>(e.args.begin(), e.args.begin() + 2); \
+ } \
+ inline types::none<types::str> getattr(types::attr::ERRNO, types::name const &e) \
+ { \
+ if (e.args.size() > 3 || e.args.size() < 2) \
+ return builtins::None; \
+ else \
+ return e.args[0]; \
+ } \
+ inline types::none<types::str> getattr(types::attr::STRERROR, types::name const &e) \
+ { \
+ if (e.args.size() > 3 || e.args.size() < 2) \
+ return builtins::None; \
+ else \
+ return e.args[1]; \
+ } \
+ inline types::none<types::str> getattr(types::attr::FILENAME, types::name const &e) \
+ { \
+ if (e.args.size() != 3) \
+ return builtins::None; \
+ else \
+ return e.args[2]; \
+ } \
+ } \
PYTHONIC_NS_END
IMPL_EXCEPTION_GETATTR(BaseException);
@@ -211,8 +206,7 @@ namespace types
if (e.args.size() == 2)
return o << "[Errno " << e.args[0] << "] " << e.args[1];
else if (e.args.size() == 3)
- return o << "[Errno " << e.args[0] << "] " << e.args[1] << ": '"
- << e.args[2] << "'";
+ return o << "[Errno " << e.args[0] << "] " << e.args[1] << ": '" << e.args[2] << "'";
else {
// Generate "('a', 'b', 'c', 'd') if a,b,c, && d are in e.args
std::string listsep = "";
diff --git a/contrib/python/pythran/pythran/pythonic/types/file.hpp b/contrib/python/pythran/pythran/pythonic/types/file.hpp
index 70c9bf2954d..9a6282e0e86 100644
--- a/contrib/python/pythran/pythran/pythonic/types/file.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/file.hpp
@@ -63,8 +63,7 @@ namespace types
}
inline file::file(types::str const &filename, types::str const &strmode)
- : file_iterator(), data(utils::no_memory()), mode(strmode),
- name(filename), newlines('\n')
+ : file_iterator(), data(utils::no_memory()), mode(strmode), name(filename), newlines('\n')
{
open(filename, strmode);
if (mode.find_first_of("r+") != -1)
@@ -267,14 +266,12 @@ namespace types
// Like in :
// for line in open("myfile"):
// print line
- inline file_iterator::file_iterator(file &ref)
- : f(&ref), set(false), curr(), position(ref.tell())
+ inline file_iterator::file_iterator(file &ref) : f(&ref), set(false), curr(), position(ref.tell())
{
}
inline file_iterator::file_iterator()
- : f(nullptr), set(false), curr(),
- position(std::numeric_limits<long>::max()) {};
+ : f(nullptr), set(false), curr(), position(std::numeric_limits<long>::max()) {};
inline bool file_iterator::operator==(file_iterator const &f2) const
{
diff --git a/contrib/python/pythran/pythran/pythonic/types/finfo.hpp b/contrib/python/pythran/pythran/pythonic/types/finfo.hpp
index 348d3299bec..c07ea4dd481 100644
--- a/contrib/python/pythran/pythran/pythonic/types/finfo.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/finfo.hpp
@@ -30,8 +30,7 @@ PYTHONIC_NS_BEGIN
namespace builtins
{
template <class T>
- auto getattr(types::attr::EPS,
- pythonic::types::finfo<T> const &f) -> decltype(f.eps())
+ auto getattr(types::attr::EPS, pythonic::types::finfo<T> const &f) -> decltype(f.eps())
{
return f.eps();
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/float.hpp b/contrib/python/pythran/pythran/pythonic/types/float.hpp
index fcce9a7db25..762c7cc5585 100644
--- a/contrib/python/pythran/pythran/pythonic/types/float.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/float.hpp
@@ -35,7 +35,13 @@ inline bool from_python<long double>::is_convertible(PyObject *obj)
inline long double from_python<long double>::convert(PyObject *obj)
{
+#ifdef Py_LIMITED_API
+ npy_longdouble val;
+ PyArray_ScalarAsCtype(obj, &val);
+ return val;
+#else
return PyArrayScalar_VAL(obj, LongDouble);
+#endif
}
inline bool from_python<double>::is_convertible(PyObject *obj)
@@ -53,7 +59,13 @@ inline bool from_python<float>::is_convertible(PyObject *obj)
}
inline float from_python<float>::convert(PyObject *obj)
{
+#ifdef Py_LIMITED_API
+ npy_float val;
+ PyArray_ScalarAsCtype(obj, &val);
+ return val;
+#else
return PyArrayScalar_VAL(obj, Float);
+#endif
}
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/types/generator.hpp b/contrib/python/pythran/pythran/pythonic/types/generator.hpp
index 4a3ef67e749..ce9caa118ec 100644
--- a/contrib/python/pythran/pythran/pythonic/types/generator.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/generator.hpp
@@ -17,8 +17,7 @@ namespace types
} // this represents the end
template <class T>
- generator_iterator<T>::generator_iterator(T const &a_generator)
- : the_generator(a_generator)
+ generator_iterator<T>::generator_iterator(T const &a_generator) : the_generator(a_generator)
{
}
@@ -40,33 +39,24 @@ namespace types
}
template <class T>
- bool
- generator_iterator<T>::operator!=(generator_iterator<T> const &other) const
+ bool generator_iterator<T>::operator!=(generator_iterator<T> const &other) const
{
- assert(other.the_generator.__generator_state == -1 ||
- the_generator.__generator_state == -1);
- return the_generator.__generator_state !=
- other.the_generator.__generator_state;
+ assert(other.the_generator.__generator_state == -1 || the_generator.__generator_state == -1);
+ return the_generator.__generator_state != other.the_generator.__generator_state;
}
template <class T>
- bool
- generator_iterator<T>::operator==(generator_iterator<T> const &other) const
+ bool generator_iterator<T>::operator==(generator_iterator<T> const &other) const
{
- assert(other.the_generator.__generator_state == -1 ||
- the_generator.__generator_state == -1);
- return the_generator.__generator_state ==
- other.the_generator.__generator_state;
+ assert(other.the_generator.__generator_state == -1 || the_generator.__generator_state == -1);
+ return the_generator.__generator_state == other.the_generator.__generator_state;
}
template <class T>
- bool
- generator_iterator<T>::operator<(generator_iterator<T> const &other) const
+ bool generator_iterator<T>::operator<(generator_iterator<T> const &other) const
{
- assert(other.the_generator.__generator_state == -1 ||
- the_generator.__generator_state == -1);
- return the_generator.__generator_state !=
- other.the_generator.__generator_state;
+ assert(other.the_generator.__generator_state == -1 || the_generator.__generator_state == -1);
+ return the_generator.__generator_state != other.the_generator.__generator_state;
}
} // namespace types
PYTHONIC_NS_END
diff --git a/contrib/python/pythran/pythran/pythonic/types/int.hpp b/contrib/python/pythran/pythran/pythonic/types/int.hpp
index d7fdaa27eb9..44da0ada1c4 100644
--- a/contrib/python/pythran/pythran/pythonic/types/int.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/int.hpp
@@ -9,14 +9,12 @@ PYTHONIC_NS_BEGIN
namespace builtins
{
template <class T>
- typename std::enable_if<std::is_integral<T>::value, T>::type
- getattr(types::attr::REAL, T self)
+ std::enable_if_t<std::is_integral<T>::value, T> getattr(types::attr::REAL, T self)
{
return self;
}
template <class T>
- typename std::enable_if<std::is_integral<T>::value, T>::type
- getattr(types::attr::IMAG, T self)
+ std::enable_if_t<std::is_integral<T>::value, T> getattr(types::attr::IMAG, T self)
{
return T(0);
}
@@ -31,13 +29,11 @@ PYTHONIC_NS_END
PYTHONIC_NS_BEGIN
template <class T>
-struct c_type_to_numpy_type
- : c_type_to_numpy_type<decltype(std::declval<T>()())> {
+struct c_type_to_numpy_type : c_type_to_numpy_type<decltype(std::declval<T>()())> {
};
template <>
-struct c_type_to_numpy_type<long double>
- : std::integral_constant<int, NPY_LONGDOUBLE> {
+struct c_type_to_numpy_type<long double> : std::integral_constant<int, NPY_LONGDOUBLE> {
};
template <>
@@ -49,13 +45,11 @@ struct c_type_to_numpy_type<float> : std::integral_constant<int, NPY_FLOAT> {
};
template <>
-struct c_type_to_numpy_type<std::complex<float>>
- : std::integral_constant<int, NPY_CFLOAT> {
+struct c_type_to_numpy_type<std::complex<float>> : std::integral_constant<int, NPY_CFLOAT> {
};
template <>
-struct c_type_to_numpy_type<std::complex<double>>
- : std::integral_constant<int, NPY_CDOUBLE> {
+struct c_type_to_numpy_type<std::complex<double>> : std::integral_constant<int, NPY_CDOUBLE> {
};
template <>
@@ -64,23 +58,19 @@ struct c_type_to_numpy_type<std::complex<long double>>
};
template <>
-struct c_type_to_numpy_type<signed long long>
- : std::integral_constant<int, NPY_LONGLONG> {
+struct c_type_to_numpy_type<signed long long> : std::integral_constant<int, NPY_LONGLONG> {
};
template <>
-struct c_type_to_numpy_type<unsigned long long>
- : std::integral_constant<int, NPY_ULONGLONG> {
+struct c_type_to_numpy_type<unsigned long long> : std::integral_constant<int, NPY_ULONGLONG> {
};
template <>
-struct c_type_to_numpy_type<signed long>
- : std::integral_constant<int, NPY_LONG> {
+struct c_type_to_numpy_type<signed long> : std::integral_constant<int, NPY_LONG> {
};
template <>
-struct c_type_to_numpy_type<unsigned long>
- : std::integral_constant<int, NPY_ULONG> {
+struct c_type_to_numpy_type<unsigned long> : std::integral_constant<int, NPY_ULONG> {
};
template <>
@@ -88,18 +78,15 @@ struct c_type_to_numpy_type<signed int> : std::integral_constant<int, NPY_INT> {
};
template <>
-struct c_type_to_numpy_type<unsigned int>
- : std::integral_constant<int, NPY_UINT> {
+struct c_type_to_numpy_type<unsigned int> : std::integral_constant<int, NPY_UINT> {
};
template <>
-struct c_type_to_numpy_type<signed short>
- : std::integral_constant<int, NPY_SHORT> {
+struct c_type_to_numpy_type<signed short> : std::integral_constant<int, NPY_SHORT> {
};
template <>
-struct c_type_to_numpy_type<unsigned short>
- : std::integral_constant<int, NPY_USHORT> {
+struct c_type_to_numpy_type<unsigned short> : std::integral_constant<int, NPY_USHORT> {
};
template <>
@@ -107,13 +94,11 @@ struct c_type_to_numpy_type<char> : std::integral_constant<int, NPY_BYTE> {
};
template <>
-struct c_type_to_numpy_type<signed char>
- : std::integral_constant<int, NPY_BYTE> {
+struct c_type_to_numpy_type<signed char> : std::integral_constant<int, NPY_BYTE> {
};
template <>
-struct c_type_to_numpy_type<unsigned char>
- : std::integral_constant<int, NPY_UBYTE> {
+struct c_type_to_numpy_type<unsigned char> : std::integral_constant<int, NPY_UBYTE> {
};
template <>
@@ -131,12 +116,10 @@ struct c_type_to_numpy_type<bool> : std::integral_constant<int, NPY_BOOL> {
#endif
#endif
-#define PYTHONIC_INT_TO_PYTHON(TYPE) \
- inline PyObject *to_python<TYPE>::convert(TYPE l) \
- { \
- return PyArray_Scalar( \
- &l, PyArray_DescrFromType(c_type_to_numpy_type<TYPE>::value), \
- nullptr); \
+#define PYTHONIC_INT_TO_PYTHON(TYPE) \
+ inline PyObject *to_python<TYPE>::convert(TYPE l) \
+ { \
+ return PyArray_Scalar(&l, PyArray_DescrFromType(c_type_to_numpy_type<TYPE>::value), nullptr); \
}
PYTHONIC_INT_TO_PYTHON(char)
@@ -156,15 +139,14 @@ PYTHONIC_INT_TO_PYTHON(signed long long)
#undef PYTHONIC_INT_TO_PYTHON
-#define PYTHONIC_INT_FROM_PYTHON(TYPE, NTYPE) \
- inline bool from_python<TYPE>::is_convertible(PyObject *obj) \
- { \
- return PyInt_CheckExact(obj) || \
- PyObject_TypeCheck(obj, &Py##NTYPE##ArrType_Type); \
- } \
- inline TYPE from_python<TYPE>::convert(PyObject *obj) \
- { \
- return PyInt_AsLong(obj); \
+#define PYTHONIC_INT_FROM_PYTHON(TYPE, NTYPE) \
+ inline bool from_python<TYPE>::is_convertible(PyObject *obj) \
+ { \
+ return PyInt_CheckExact(obj) || PyObject_TypeCheck(obj, &Py##NTYPE##ArrType_Type); \
+ } \
+ inline TYPE from_python<TYPE>::convert(PyObject *obj) \
+ { \
+ return PyInt_AsLong(obj); \
}
PYTHONIC_INT_FROM_PYTHON(unsigned char, UByte)
diff --git a/contrib/python/pythran/pythran/pythonic/types/list.hpp b/contrib/python/pythran/pythran/pythonic/types/list.hpp
index 076b5e701de..9f4b3d4ea48 100644
--- a/contrib/python/pythran/pythran/pythonic/types/list.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/list.hpp
@@ -28,8 +28,7 @@ namespace types
{
}
template <class T, class S>
- sliced_list<T, S>::sliced_list(sliced_list<T, S> const &s)
- : _data(s._data), slicing(s.slicing)
+ sliced_list<T, S>::sliced_list(sliced_list<T, S> const &s) : _data(s._data), slicing(s.slicing)
{
}
template <class T, class S>
@@ -39,8 +38,7 @@ namespace types
}
template <class T, class S>
template <class Sn>
- sliced_list<T, S>::sliced_list(utils::shared_ref<container_type> const &other,
- Sn const &s)
+ sliced_list<T, S>::sliced_list(utils::shared_ref<container_type> const &other, Sn const &s)
: _data(other), slicing(s)
{
}
@@ -81,8 +79,7 @@ namespace types
// accessor
template <class T, class S>
- typename sliced_list<T, S>::const_reference
- sliced_list<T, S>::fast(long i) const
+ typename sliced_list<T, S>::const_reference sliced_list<T, S>::fast(long i) const
{
assert(0 <= i && i < size());
auto const index = slicing.get(i);
@@ -90,8 +87,7 @@ namespace types
return (*_data)[index];
}
template <class T, class S>
- typename sliced_list<T, S>::const_reference
- sliced_list<T, S>::operator[](long i) const
+ typename sliced_list<T, S>::const_reference sliced_list<T, S>::operator[](long i) const
{
assert(i < size());
auto const index = slicing.get(i);
@@ -109,9 +105,8 @@ namespace types
template <class T, class S>
template <class Sp>
- typename std::enable_if<
- is_slice<Sp>::value,
- sliced_list<T, decltype(std::declval<S>() * std::declval<Sp>())>>::type
+ std::enable_if_t<is_slice<Sp>::value,
+ sliced_list<T, decltype(std::declval<S>() * std::declval<Sp>())>>
sliced_list<T, S>::operator[](Sp s) const
{
return {_data, slicing * s.normalize(this->size())};
@@ -148,13 +143,20 @@ namespace types
return size() == 0;
}
template <class T, class S>
- inline sliced_list<T, S> &
- sliced_list<T, S>::operator=(sliced_list<T, S> const &s)
+ inline sliced_list<T, S> &sliced_list<T, S>::operator=(sliced_list<T, S> const &s)
{
if (slicing.step == 1) {
- // inserting before erasing in case of self-copy
- auto insert_pt = _data->begin() + slicing.lower;
- _data->insert(insert_pt, s.begin(), s.end());
+ // no sharing
+ if (_data->data() != s._data->data()) {
+ auto insert_pt = _data->begin() + slicing.lower;
+ _data->insert(insert_pt, s.begin(), s.end());
+ }
+ // sharing
+ else {
+ std::vector<T> tmp{s.begin(), s.end()};
+ auto insert_pt = _data->begin() + slicing.lower;
+ _data->insert(insert_pt, tmp.begin(), tmp.end());
+ }
auto erase_pt = _data->begin() + s.size();
_data->erase(erase_pt + slicing.lower, erase_pt + slicing.upper);
} else
@@ -165,9 +167,17 @@ namespace types
sliced_list<T, S> &sliced_list<T, S>::operator=(list<T> const &seq)
{
if (slicing.step == 1) {
- // inserting before erasing in case of self-copy
- auto insert_pt = _data->begin() + slicing.lower;
- _data->insert(insert_pt, seq.begin(), seq.end());
+ // no sharing
+ if (_data->data() != seq._data->data()) {
+ auto insert_pt = _data->begin() + slicing.lower;
+ _data->insert(insert_pt, seq.begin(), seq.end());
+ }
+ // sharing
+ else {
+ std::vector<T> tmp{seq.begin(), seq.end()};
+ auto insert_pt = _data->begin() + slicing.lower;
+ _data->insert(insert_pt, tmp.begin(), tmp.end());
+ }
auto erase_pt = _data->begin() + seq.size();
_data->erase(erase_pt + slicing.lower, erase_pt + slicing.upper);
} else
@@ -206,21 +216,18 @@ namespace types
#ifdef USE_XSIMD
template <class T, class S>
template <class vectorizer>
- typename sliced_list<T, S>::simd_iterator
- sliced_list<T, S>::vbegin(vectorizer) const
+ typename sliced_list<T, S>::simd_iterator sliced_list<T, S>::vbegin(vectorizer) const
{
return {_data->data() + slicing.lower};
}
template <class T, class S>
template <class vectorizer>
- typename sliced_list<T, S>::simd_iterator
- sliced_list<T, S>::vend(vectorizer) const
+ typename sliced_list<T, S>::simd_iterator sliced_list<T, S>::vend(vectorizer) const
{
using vector_type = typename xsimd::batch<dtype>;
static const std::size_t vector_size = vector_type::size;
- return {_data->data() + slicing.lower +
- long(size() / vector_size * vector_size)};
+ return {_data->data() + slicing.lower + long(size() / vector_size * vector_size)};
}
#endif
@@ -256,9 +263,8 @@ namespace types
template <class InputIterator>
list<T>::list(InputIterator start, InputIterator stop) : _data()
{
- if (std::is_same<
- typename std::iterator_traits<InputIterator>::iterator_category,
- std::random_access_iterator_tag>::value)
+ if (std::is_same<typename std::iterator_traits<InputIterator>::iterator_category,
+ std::random_access_iterator_tag>::value)
_data->reserve(std::distance(start, stop));
else
_data->reserve(DEFAULT_CAPACITY);
@@ -292,8 +298,7 @@ namespace types
}
template <class T>
template <class Tp, class S>
- list<T>::list(sliced_list<Tp, S> const &other)
- : _data(other.begin(), other.end())
+ list<T>::list(sliced_list<Tp, S> const &other) : _data(other.begin(), other.end())
{
}
@@ -458,14 +463,12 @@ namespace types
template <class T>
bool list<T>::operator<(list<T> const &other) const
{
- return std::lexicographical_compare(begin(), end(), other.begin(),
- other.end());
+ return std::lexicographical_compare(begin(), end(), other.begin(), other.end());
}
template <class T>
bool list<T>::operator>(list<T> const &other) const
{
- return std::lexicographical_compare(other.begin(), other.end(), begin(),
- end());
+ return std::lexicographical_compare(other.begin(), other.end(), begin(), end());
}
template <class T>
bool list<T>::operator<=(list<T> const &other) const
@@ -527,8 +530,7 @@ namespace types
template <class T>
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value, sliced_list<T, Sp>>::type
- list<T>::operator[](Sp const &s) const
+ std::enable_if_t<is_slice<Sp>::value, sliced_list<T, Sp>> list<T>::operator[](Sp const &s) const
{
return {*this, s};
}
@@ -607,8 +609,7 @@ namespace types
template <class T>
template <class F>
- list<typename __combined<T, F>::type>
- list<T>::operator+(list<F> const &s) const
+ list<typename __combined<T, F>::type> list<T>::operator+(list<F> const &s) const
{
list<typename __combined<T, F>::type> clone(size() + s.size());
std::copy(s.begin(), s.end(), std::copy(begin(), end(), clone.begin()));
@@ -617,12 +618,10 @@ namespace types
template <class T>
template <class F, class S>
- list<decltype(std::declval<T>() +
- std::declval<typename sliced_list<F, S>::value_type>())>
+ list<decltype(std::declval<T>() + std::declval<typename sliced_list<F, S>::value_type>())>
list<T>::operator+(sliced_list<F, S> const &s) const
{
- list<decltype(std::declval<T>() +
- std::declval<typename sliced_list<F, S>::value_type>())>
+ list<decltype(std::declval<T>() + std::declval<typename sliced_list<F, S>::value_type>())>
clone(size() + len(s));
std::copy(s.begin(), s.end(), std::copy(begin(), end(), clone.begin()));
return clone;
@@ -690,8 +689,7 @@ namespace types
template <class E, size_t L>
long list<T>::_flat_size(E const &e, utils::int_<L>) const
{
- return std::distance(e.begin(), e.end()) *
- _flat_size(e[0], utils::int_<L - 1>{});
+ return std::distance(e.begin(), e.end()) * _flat_size(e[0], utils::int_<L - 1>{});
}
template <class T>
long list<T>::flat_size() const
@@ -738,8 +736,7 @@ namespace types
return empty_list();
}
template <class F>
- typename std::enable_if<!is_numexpr_arg<F>::value,
- list<typename F::value_type>>::type
+ std::enable_if_t<!is_numexpr_arg<F>::value, list<typename F::value_type>>
empty_list::operator+(F s) const
{
return {s.begin(), s.end()};
@@ -770,8 +767,7 @@ namespace utils
{
template <class T, class From>
- void reserve(types::list<T> &l, From const &f,
- typename From::const_iterator *)
+ void reserve(types::list<T> &l, From const &f, typename From::const_iterator *)
{
l.reserve(builtins::len(f));
}
@@ -788,22 +784,19 @@ namespace std
}
template <size_t I, class T>
- typename pythonic::types::list<T>::const_reference
- get(pythonic::types::list<T> const &t)
+ typename pythonic::types::list<T>::const_reference get(pythonic::types::list<T> const &t)
{
return t[I];
}
template <size_t I, class T>
- typename pythonic::types::list<T>::value_type
- get(pythonic::types::list<T> &&t)
+ typename pythonic::types::list<T>::value_type get(pythonic::types::list<T> &&t)
{
return std::move(t)[I];
}
template <size_t I, class T, class S>
- typename pythonic::types::sliced_list<T, S>::reference
- get(pythonic::types::sliced_list<T, S> &t)
+ typename pythonic::types::sliced_list<T, S>::reference get(pythonic::types::sliced_list<T, S> &t)
{
return t[I];
}
@@ -827,15 +820,19 @@ namespace std
PYTHONIC_NS_BEGIN
+#ifdef Py_LIMITED_API
+#define PyList_SET_ITEM PyList_SetItem
+#endif
+
inline PyObject *to_python<typename std::vector<bool>::reference>::convert(
typename std::vector<bool>::reference const &v)
{
return ::to_python((bool)v);
}
-inline PyObject *to_python<typename std::conditional<
- std::is_same<bool, typename std::vector<bool>::const_reference>::value,
- phantom_type, typename std::vector<bool>::const_reference>::type>::
+inline PyObject *
+to_python<std::conditional_t<std::is_same<bool, typename std::vector<bool>::const_reference>::value,
+ phantom_type, typename std::vector<bool>::const_reference>>::
convert(typename std::vector<bool>::const_reference const &v)
{
return ::to_python((bool)v);
@@ -851,8 +848,7 @@ PyObject *to_python<types::list<T>>::convert(types::list<T> const &v)
return ret;
}
template <class T, class S>
-PyObject *
-to_python<types::sliced_list<T, S>>::convert(types::sliced_list<T, S> const &v)
+PyObject *to_python<types::sliced_list<T, S>>::convert(types::sliced_list<T, S> const &v)
{
Py_ssize_t n = v.size();
PyObject *ret = PyList_New(n);
@@ -861,8 +857,7 @@ to_python<types::sliced_list<T, S>>::convert(types::sliced_list<T, S> const &v)
return ret;
}
-inline PyObject *
-to_python<types::empty_list>::convert(types::empty_list const &)
+inline PyObject *to_python<types::empty_list>::convert(types::empty_list const &)
{
return PyList_New(0);
}
@@ -870,23 +865,48 @@ to_python<types::empty_list>::convert(types::empty_list const &)
template <class T>
bool from_python<types::list<T>>::is_convertible(PyObject *obj)
{
- return PyList_Check(obj) &&
- (PyObject_Not(obj) ||
- ::is_convertible<T>(PySequence_Fast_GET_ITEM(obj, 0)));
+ if (!PyList_Check(obj))
+ return false;
+ if (PyObject_Not(obj))
+ return true;
+#ifdef Py_LIMITED_API
+ PyObject *Item = PySequence_GetItem(obj, 0);
+ bool result = ::is_convertible<T>(Item);
+ Py_DECREF(Item);
+ return result;
+#else
+ return ::is_convertible<T>(PySequence_Fast_GET_ITEM(obj, 0));
+#endif
}
template <class T>
types::list<T> from_python<types::list<T>>::convert(PyObject *obj)
{
+#ifdef Py_LIMITED_API
+ Py_ssize_t l = PySequence_Size(obj);
+#else
Py_ssize_t l = PySequence_Fast_GET_SIZE(obj);
+#endif
types::list<T> v(l);
+#ifdef Py_LIMITED_API
+ for (Py_ssize_t i = 0; i < l; ++i) {
+ PyObject *item = PySequence_GetItem(obj, i);
+ v.fast(i) = ::from_python<T>(item);
+ Py_DECREF(item);
+ }
+#else
PyObject **core = PySequence_Fast_ITEMS(obj);
- std::transform(core, core + l, v.begin(),
- [](PyObject *o) { return ::from_python<T>(o); });
+ std::transform(core, core + l, v.begin(), [](PyObject *o) { return ::from_python<T>(o); });
+#endif
return v;
}
+
+#ifdef Py_LIMITED_API
+#undef PyList_SET_ITEM
+#endif
+
PYTHONIC_NS_END
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp b/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp
index d3fecbed70d..77e9287bb7d 100644
--- a/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/ndarray.hpp
@@ -73,8 +73,8 @@ PYTHONIC_NS_BEGIN
namespace types
{
template <class pS, size_t... Is>
- array_tuple<long, std::tuple_size<pS>::value>
- make_strides(pS const &shape, utils::index_sequence<Is...>)
+ array_tuple<long, std::tuple_size<pS>::value> make_strides(pS const &shape,
+ std::index_sequence<Is...>)
{
array_tuple<long, std::tuple_size<pS>::value> out;
out[std::tuple_size<pS>::value - 1] = 1;
@@ -88,8 +88,7 @@ namespace types
template <class pS>
array_tuple<long, std::tuple_size<pS>::value> make_strides(pS const &shape)
{
- return make_strides(
- shape, utils::make_index_sequence<std::tuple_size<pS>::value - 1>());
+ return make_strides(shape, std::make_index_sequence<std::tuple_size<pS>::value - 1>());
}
template <class T, class pS>
@@ -108,16 +107,14 @@ namespace types
template <class T, class pS>
template <class S, class Iter>
- T *type_helper<ndarray<T, pS>>::initialize_from_iterable(S &shape, T *from,
- Iter &&iter)
+ T *type_helper<ndarray<T, pS>>::initialize_from_iterable(S &shape, T *from, Iter &&iter)
{
- return type_helper<ndarray<T, pS> const &>::initialize_from_iterable(
- shape, from, std::forward<Iter>(iter));
+ return type_helper<ndarray<T, pS> const &>::initialize_from_iterable(shape, from,
+ std::forward<Iter>(iter));
}
template <class T, class pS>
- numpy_iexpr<ndarray<T, pS>>
- type_helper<ndarray<T, pS>>::get(ndarray<T, pS> &&self, long i)
+ numpy_iexpr<ndarray<T, pS>> type_helper<ndarray<T, pS>>::get(ndarray<T, pS> &&self, long i)
{
return {std::move(self), i};
}
@@ -131,24 +128,20 @@ namespace types
template <class T, class pS>
typename type_helper<ndarray<T, pS> const &>::const_iterator
- type_helper<ndarray<T, pS> const &>::make_iterator(ndarray<T, pS> const &n,
- long i)
+ type_helper<ndarray<T, pS> const &>::make_iterator(ndarray<T, pS> const &n, long i)
{
return {n, i};
}
template <class T, class pS>
template <class S, class Iter>
- T *type_helper<ndarray<T, pS> const &>::initialize_from_iterable(S &shape,
- T *from,
- Iter &&iter)
+ T *type_helper<ndarray<T, pS> const &>::initialize_from_iterable(S &shape, T *from, Iter &&iter)
{
- sutils::assign(
- std::get<std::tuple_size<S>::value - std::tuple_size<pS>::value>(shape),
- iter.size());
+ sutils::assign(std::get<std::tuple_size<S>::value - std::tuple_size<pS>::value>(shape),
+ iter.size());
for (auto content : iter)
- from = type_helper<ndarray<T, sutils::pop_tail_t<pS>> const
- &>::initialize_from_iterable(shape, from, content);
+ from = type_helper<ndarray<T, sutils::pop_tail_t<pS>> const &>::initialize_from_iterable(
+ shape, from, content);
return from;
}
@@ -161,25 +154,21 @@ namespace types
template <class T, class pS>
typename type_helper<ndarray<T, pshape<pS>>>::iterator
- type_helper<ndarray<T, pshape<pS>>>::make_iterator(ndarray<T, pshape<pS>> &n,
- long i)
+ type_helper<ndarray<T, pshape<pS>>>::make_iterator(ndarray<T, pshape<pS>> &n, long i)
{
return n.buffer + i;
}
template <class T, class pS>
typename type_helper<ndarray<T, pshape<pS>>>::const_iterator
- type_helper<ndarray<T, pshape<pS>>>::make_iterator(
- ndarray<T, pshape<pS>> const &n, long i)
+ type_helper<ndarray<T, pshape<pS>>>::make_iterator(ndarray<T, pshape<pS>> const &n, long i)
{
return n.buffer + i;
}
template <class T, class pS>
template <class S, class Iter>
- T *type_helper<ndarray<T, pshape<pS>>>::initialize_from_iterable(S &shape,
- T *from,
- Iter &&iter)
+ T *type_helper<ndarray<T, pshape<pS>>>::initialize_from_iterable(S &shape, T *from, Iter &&iter)
{
sutils::assign(std::get<std::tuple_size<S>::value - 1>(shape), iter.size());
return std::copy(iter.begin(), iter.end(), from);
@@ -187,16 +176,14 @@ namespace types
template <class T, class pS>
typename type_helper<ndarray<T, pshape<pS>>>::type
- type_helper<ndarray<T, pshape<pS>>>::get(ndarray<T, pshape<pS>> &&self,
- long i)
+ type_helper<ndarray<T, pshape<pS>>>::get(ndarray<T, pshape<pS>> &&self, long i)
{
return self.buffer[i];
}
template <class T, class pS>
typename type_helper<ndarray<T, pshape<pS>> const &>::iterator
- type_helper<ndarray<T, pshape<pS>> const &>::make_iterator(
- ndarray<T, pshape<pS>> &n, long i)
+ type_helper<ndarray<T, pshape<pS>> const &>::make_iterator(ndarray<T, pshape<pS>> &n, long i)
{
return n.buffer + i;
}
@@ -210,8 +197,8 @@ namespace types
template <class T, class pS>
template <class S, class Iter>
- T *type_helper<ndarray<T, pshape<pS>> const &>::initialize_from_iterable(
- S &shape, T *from, Iter &&iter)
+ T *type_helper<ndarray<T, pshape<pS>> const &>::initialize_from_iterable(S &shape, T *from,
+ Iter &&iter)
{
sutils::assign(std::get<std::tuple_size<S>::value - 1>(shape), iter.size());
return std::copy(iter.begin(), iter.end(), from);
@@ -219,16 +206,15 @@ namespace types
template <class T, class pS>
typename type_helper<ndarray<T, pshape<pS>> const &>::type &
- type_helper<ndarray<T, pshape<pS>> const &>::get(
- ndarray<T, pshape<pS>> const &self, long i)
+ type_helper<ndarray<T, pshape<pS>> const &>::get(ndarray<T, pshape<pS>> const &self, long i)
{
return self.buffer[i];
}
template <class T, class pS>
typename type_helper<ndarray<T, array_tuple<pS, 1>>>::iterator
- type_helper<ndarray<T, array_tuple<pS, 1>>>::make_iterator(
- ndarray<T, array_tuple<pS, 1>> &n, long i)
+ type_helper<ndarray<T, array_tuple<pS, 1>>>::make_iterator(ndarray<T, array_tuple<pS, 1>> &n,
+ long i)
{
return n.buffer + i;
}
@@ -243,8 +229,8 @@ namespace types
template <class T, class pS>
template <class S, class Iter>
- T *type_helper<ndarray<T, array_tuple<pS, 1>>>::initialize_from_iterable(
- S &shape, T *from, Iter &&iter)
+ T *type_helper<ndarray<T, array_tuple<pS, 1>>>::initialize_from_iterable(S &shape, T *from,
+ Iter &&iter)
{
sutils::assign(std::get<std::tuple_size<S>::value - 1>(shape), iter.size());
return std::copy(iter.begin(), iter.end(), from);
@@ -252,8 +238,7 @@ namespace types
template <class T, class pS>
typename type_helper<ndarray<T, array_tuple<pS, 1>>>::type
- type_helper<ndarray<T, array_tuple<pS, 1>>>::get(
- ndarray<T, array_tuple<pS, 1>> &&self, long i)
+ type_helper<ndarray<T, array_tuple<pS, 1>>>::get(ndarray<T, array_tuple<pS, 1>> &&self, long i)
{
return self.buffer[i];
}
@@ -275,8 +260,9 @@ namespace types
template <class T, class pS>
template <class S, class Iter>
- T *type_helper<ndarray<T, array_tuple<pS, 1>> const &>::
- initialize_from_iterable(S &shape, T *from, Iter &&iter)
+ T *type_helper<ndarray<T, array_tuple<pS, 1>> const &>::initialize_from_iterable(S &shape,
+ T *from,
+ Iter &&iter)
{
sutils::assign(std::get<std::tuple_size<S>::value - 1>(shape), iter.size());
return std::copy(iter.begin(), iter.end(), from);
@@ -302,12 +288,9 @@ namespace types
template <size_t L>
template <class S, class Ty, size_t M>
- long noffset<L>::operator()(S const &strides,
- array_tuple<Ty, M> const &indices) const
+ long noffset<L>::operator()(S const &strides, array_tuple<Ty, M> const &indices) const
{
- auto index = patch_index(
- indices[M - L],
- typename std::tuple_element<M - L, typename S::shape_t>::type());
+ auto index = patch_index(indices[M - L], std::tuple_element_t<M - L, typename S::shape_t>());
auto offset = noffset<L - 1>{}(strides, indices);
auto stride = strides.template strides<M - L>();
return offset + stride * index;
@@ -315,13 +298,10 @@ namespace types
template <size_t L>
template <class S, class Ty, size_t M, class pS>
- long noffset<L>::operator()(S const &strides,
- array_tuple<Ty, M> const &indices,
+ long noffset<L>::operator()(S const &strides, array_tuple<Ty, M> const &indices,
pS const &shape) const
{
- auto index = patch_index(
- indices[M - L],
- typename std::tuple_element<M - L, typename S::shape_t>::type());
+ auto index = patch_index(indices[M - L], std::tuple_element_t<M - L, typename S::shape_t>());
if (index < 0)
index += std::get<M - L>(shape);
assert(0 <= index and index < std::get<M - L>(shape));
@@ -332,24 +312,18 @@ namespace types
template <>
template <class S, class Ty, size_t M>
- long noffset<1>::operator()(S const &strides,
- array_tuple<Ty, M> const &indices) const
+ long noffset<1>::operator()(S const &strides, array_tuple<Ty, M> const &indices) const
{
- auto index = patch_index(
- indices[M - 1],
- typename std::tuple_element<M - 1, typename S::shape_t>::type());
+ auto index = patch_index(indices[M - 1], std::tuple_element_t<M - 1, typename S::shape_t>());
return strides.template strides<M - 1>() * index;
}
template <>
template <class S, class Ty, size_t M, class pS>
- long noffset<1>::operator()(S const &strides,
- array_tuple<Ty, M> const &indices,
+ long noffset<1>::operator()(S const &strides, array_tuple<Ty, M> const &indices,
pS const &shape) const
{
- auto index = patch_index(
- indices[M - 1],
- typename std::tuple_element<M - 1, typename S::shape_t>::type());
+ auto index = patch_index(indices[M - 1], std::tuple_element_t<M - 1, typename S::shape_t>());
if (index < 0)
index += std::get<M - 1>(shape);
assert(0 <= index && index < std::get<M - 1>(shape));
@@ -359,24 +333,19 @@ namespace types
/* constructors */
template <class T, class pS>
- ndarray<T, pS>::ndarray()
- : mem(utils::no_memory()), buffer(nullptr), _shape(), _strides()
+ ndarray<T, pS>::ndarray() : mem(utils::no_memory()), buffer(nullptr), _shape(), _strides()
{
}
/* from other memory */
template <class T, class pS>
- ndarray<T, pS>::ndarray(utils::shared_ref<raw_array<T>> const &mem,
- pS const &shape)
- : mem(mem), buffer(mem->data), _shape(shape),
- _strides(make_strides(shape))
+ ndarray<T, pS>::ndarray(utils::shared_ref<raw_array<T>> const &mem, pS const &shape)
+ : mem(mem), buffer(mem->data), _shape(shape), _strides(make_strides(shape))
{
}
template <class T, class pS>
- ndarray<T, pS>::ndarray(utils::shared_ref<raw_array<T>> &&mem,
- pS const &shape)
- : mem(std::move(mem)), buffer(this->mem->data), _shape(shape),
- _strides(make_strides(shape))
+ ndarray<T, pS>::ndarray(utils::shared_ref<raw_array<T>> &&mem, pS const &shape)
+ : mem(std::move(mem)), buffer(this->mem->data), _shape(shape), _strides(make_strides(shape))
{
}
@@ -384,29 +353,24 @@ namespace types
template <class T, class pS>
template <class Tp, class pSp>
ndarray<T, pS>::ndarray(ndarray<Tp, pSp> const &other)
- : mem(other.flat_size()), buffer(mem->data), _shape(other._shape),
- _strides(other._strides)
+ : mem(other.flat_size()), buffer(mem->data), _shape(other._shape), _strides(other._strides)
{
- static_assert(std::tuple_size<pS>::value == std::tuple_size<pSp>::value,
- "compatible shapes");
+ static_assert(std::tuple_size<pS>::value == std::tuple_size<pSp>::value, "compatible shapes");
std::copy(other.fbegin(), other.fend(), fbegin());
}
template <class T, class pS>
template <class pSp>
ndarray<T, pS>::ndarray(ndarray<T, pSp> const &other)
- : mem(other.mem), buffer(mem->data), _shape(other._shape),
- _strides(other._strides)
+ : mem(other.mem), buffer(mem->data), _shape(other._shape), _strides(other._strides)
{
- static_assert(std::tuple_size<pS>::value == std::tuple_size<pSp>::value,
- "compatible shapes");
+ static_assert(std::tuple_size<pS>::value == std::tuple_size<pSp>::value, "compatible shapes");
}
/* from a seed */
template <class T, class pS>
ndarray<T, pS>::ndarray(pS const &shape, none_type init)
- : mem(sutils::sprod(shape)), buffer(mem->data), _shape(shape),
- _strides(make_strides(shape))
+ : mem(sutils::sprod(shape)), buffer(mem->data), _shape(shape), _strides(make_strides(shape))
{
}
@@ -453,12 +417,11 @@ namespace types
template <class T, class pS>
template <class Iterable, class>
ndarray<T, pS>::ndarray(Iterable &&iterable)
- : mem(utils::nested_container_size<Iterable>::flat_size(
- std::forward<Iterable>(iterable))),
+ : mem(utils::nested_container_size<Iterable>::flat_size(std::forward<Iterable>(iterable))),
buffer(mem->data), _shape()
{
- type_helper<ndarray>::initialize_from_iterable(
- _shape, mem->data, std::forward<Iterable>(iterable));
+ type_helper<ndarray>::initialize_from_iterable(_shape, mem->data,
+ std::forward<Iterable>(iterable));
_strides = make_strides(_shape);
}
@@ -470,15 +433,14 @@ namespace types
assert(buffer);
utils::broadcast_copy<ndarray &, E, value, 0,
is_vectorizable && E::is_vectorizable &&
- std::is_same<dtype, typename E::dtype>::value>(
- *this, expr);
+ std::is_same<dtype, typename E::dtype>::value>(*this, expr);
}
template <class T, class pS>
template <class Op, class... Args>
ndarray<T, pS>::ndarray(numpy_expr<Op, Args...> const &expr)
- : mem(expr.flat_size()), buffer(mem->data),
- _shape(sutils::getshape(expr)), _strides(make_strides(_shape))
+ : mem(expr.flat_size()), buffer(mem->data), _shape(sutils::getshape(expr)),
+ _strides(make_strides(_shape))
{
initialize_from_expr(expr);
}
@@ -486,8 +448,8 @@ namespace types
template <class T, class pS>
template <class Arg>
ndarray<T, pS>::ndarray(numpy_texpr<Arg> const &expr)
- : mem(expr.flat_size()), buffer(mem->data),
- _shape(sutils::getshape(expr)), _strides(make_strides(_shape))
+ : mem(expr.flat_size()), buffer(mem->data), _shape(sutils::getshape(expr)),
+ _strides(make_strides(_shape))
{
initialize_from_expr(expr);
}
@@ -495,8 +457,8 @@ namespace types
template <class T, class pS>
template <class Arg>
ndarray<T, pS>::ndarray(numpy_texpr_2<Arg> const &expr)
- : mem(expr.flat_size()), buffer(mem->data),
- _shape(sutils::getshape(expr)), _strides(make_strides(_shape))
+ : mem(expr.flat_size()), buffer(mem->data), _shape(sutils::getshape(expr)),
+ _strides(make_strides(_shape))
{
initialize_from_expr(expr);
}
@@ -504,8 +466,8 @@ namespace types
template <class T, class pS>
template <class Arg, class... S>
ndarray<T, pS>::ndarray(numpy_gexpr<Arg, S...> const &expr)
- : mem(expr.flat_size()), buffer(mem->data),
- _shape(sutils::getshape(expr)), _strides(make_strides(_shape))
+ : mem(expr.flat_size()), buffer(mem->data), _shape(sutils::getshape(expr)),
+ _strides(make_strides(_shape))
{
initialize_from_expr(expr);
}
@@ -513,8 +475,8 @@ namespace types
template <class T, class pS>
template <class Arg>
ndarray<T, pS>::ndarray(numpy_iexpr<Arg> const &expr)
- : mem(expr.flat_size()), buffer(mem->data),
- _shape(sutils::getshape(expr)), _strides(make_strides(_shape))
+ : mem(expr.flat_size()), buffer(mem->data), _shape(sutils::getshape(expr)),
+ _strides(make_strides(_shape))
{
initialize_from_expr(expr);
}
@@ -522,8 +484,8 @@ namespace types
template <class T, class pS>
template <class Arg, class F>
ndarray<T, pS>::ndarray(numpy_vexpr<Arg, F> const &expr)
- : mem(expr.flat_size()), buffer(mem->data),
- _shape(sutils::getshape(expr)), _strides(make_strides(_shape))
+ : mem(expr.flat_size()), buffer(mem->data), _shape(sutils::getshape(expr)),
+ _strides(make_strides(_shape))
{
initialize_from_expr(expr);
}
@@ -534,18 +496,14 @@ namespace types
template <class Op, class Expr>
ndarray<T, pS> &ndarray<T, pS>::update_(Expr const &expr)
{
- using BExpr =
- typename std::conditional<std::is_scalar<Expr>::value,
- broadcast<Expr, T>, Expr const &>::type;
+ using BExpr = std::conditional_t<std::is_scalar<Expr>::value, broadcast<Expr, T>, Expr const &>;
BExpr bexpr = expr;
utils::broadcast_update<
Op, ndarray &, BExpr, value,
value - (std::is_scalar<Expr>::value + utils::dim_of<Expr>::value),
is_vectorizable &&
- types::is_vectorizable<typename std::remove_cv<
- typename std::remove_reference<BExpr>::type>::type>::value &&
- std::is_same<dtype, typename dtype_of<typename std::decay<
- BExpr>::type>::type>::value>(*this, bexpr);
+ types::is_vectorizable<std::remove_cv_t<std::remove_reference_t<BExpr>>>::value &&
+ std::is_same<dtype, typename dtype_of<std::decay_t<BExpr>>::type>::value>(*this, bexpr);
return *this;
}
@@ -604,7 +562,7 @@ namespace types
template <class T, class pS>
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T &>::type
+ std::enable_if_t<std::is_integral<Ty>::value, T &>
ndarray<T, pS>::fast(array_tuple<Ty, value> const &indices)
{
assert(inbound_indices(indices));
@@ -613,7 +571,7 @@ namespace types
template <class T, class pS>
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T>::type
+ std::enable_if_t<std::is_integral<Ty>::value, T>
ndarray<T, pS>::fast(array_tuple<Ty, value> const &indices) const
{
assert(inbound_indices(indices));
@@ -622,57 +580,48 @@ namespace types
template <class T, class pS>
template <class Ty, size_t M>
- auto ndarray<T, pS>::fast(array_tuple<Ty, M> const &indices) const & ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>().fast(*this,
- indices))>::type
+ auto ndarray<T, pS>::fast(array_tuple<Ty, M> const &indices) const & -> std::enable_if_t<
+ std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(*this, indices))>
{
return nget<M - 1>().fast(*this, indices);
}
template <class T, class pS>
template <class Ty, size_t M>
- auto ndarray<T, pS>::fast(array_tuple<Ty, M> const &indices) && ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>().fast(std::move(*this),
- indices))>::type
+ auto ndarray<T, pS>::fast(array_tuple<Ty, M> const &indices) && -> std::enable_if_t<
+ std::is_integral<Ty>::value, decltype(nget<M - 1>().fast(std::move(*this), indices))>
{
return nget<M - 1>().fast(std::move(*this), indices);
}
template <class T, class pS>
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T const &>::type
+ std::enable_if_t<std::is_integral<Ty>::value, T const &>
ndarray<T, pS>::operator[](array_tuple<Ty, value> const &indices) const
{
- return *(buffer +
- noffset<std::tuple_size<pS>::value>{}(*this, indices, _shape));
+ return *(buffer + noffset<std::tuple_size<pS>::value>{}(*this, indices, _shape));
}
template <class T, class pS>
template <class Ty>
- typename std::enable_if<std::is_integral<Ty>::value, T &>::type
+ std::enable_if_t<std::is_integral<Ty>::value, T &>
ndarray<T, pS>::operator[](array_tuple<Ty, value> const &indices)
{
- return *(buffer +
- noffset<std::tuple_size<pS>::value>{}(*this, indices, _shape));
+ return *(buffer + noffset<std::tuple_size<pS>::value>{}(*this, indices, _shape));
}
template <class T, class pS>
template <class Ty, size_t M>
- auto ndarray<T, pS>::operator[](array_tuple<Ty, M> const &indices) const & ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>()(*this, indices))>::type
+ auto ndarray<T, pS>::operator[](array_tuple<Ty, M> const &indices) const
+ & -> std::enable_if_t<std::is_integral<Ty>::value, decltype(nget<M - 1>()(*this, indices))>
{
return nget<M - 1>()(*this, indices);
}
template <class T, class pS>
template <class Ty, size_t M>
- auto ndarray<T, pS>::operator[](array_tuple<Ty, M> const &indices) && ->
- typename std::enable_if<std::is_integral<Ty>::value,
- decltype(nget<M - 1>()(std::move(*this),
- indices))>::type
+ auto ndarray<T, pS>::operator[](array_tuple<Ty, M> const &indices) && -> std::enable_if_t<
+ std::is_integral<Ty>::value, decltype(nget<M - 1>()(std::move(*this), indices))>
{
return nget<M - 1>()(std::move(*this), indices);
}
@@ -680,8 +629,7 @@ namespace types
#ifdef USE_XSIMD
template <class T, class pS>
template <class vectorizer>
- typename ndarray<T, pS>::simd_iterator
- ndarray<T, pS>::vbegin(vectorizer) const
+ typename ndarray<T, pS>::simd_iterator ndarray<T, pS>::vbegin(vectorizer) const
{
return {buffer};
}
@@ -703,17 +651,14 @@ namespace types
ndarray<T, pS>::operator[](none_type) const
{
sutils::push_front_t<pS, std::integral_constant<long, 1>> new_shape;
- sutils::copy_shape<1, -1>(
- new_shape, *this,
- utils::make_index_sequence<std::tuple_size<pS>::value>());
+ sutils::copy_shape<1, -1>(new_shape, *this,
+ std::make_index_sequence<std::tuple_size<pS>::value>());
return reshape(new_shape);
}
template <class T, class pS>
template <class S>
- typename std::enable_if<
- is_slice<S>::value,
- numpy_gexpr<ndarray<T, pS> const &, normalize_t<S>>>::type
+ std::enable_if_t<is_slice<S>::value, numpy_gexpr<ndarray<T, pS> const &, normalize_t<S>>>
ndarray<T, pS>::operator[](S const &s) const &
{
return make_gexpr(*this, s);
@@ -721,8 +666,7 @@ namespace types
template <class T, class pS>
template <class S>
- typename std::enable_if<is_slice<S>::value,
- numpy_gexpr<ndarray<T, pS>, normalize_t<S>>>::type
+ std::enable_if_t<is_slice<S>::value, numpy_gexpr<ndarray<T, pS>, normalize_t<S>>>
ndarray<T, pS>::operator[](S const &s) &&
{
return make_gexpr(std::move(*this), s);
@@ -737,9 +681,8 @@ namespace types
/* extended slice indexing */
template <class T, class pS>
template <class S0, class... S>
- auto ndarray<T, pS>::operator()(S0 const &s0, S const &...s) const
- & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this),
- s0, s...))
+ auto ndarray<T, pS>::operator()(S0 const &s0, S const &...s)
+ const & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...))
{
return extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...);
}
@@ -747,8 +690,7 @@ namespace types
template <class T, class pS>
template <class S0, class... S>
auto ndarray<T, pS>::operator()(S0 const &s0, S const &...s)
- & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this),
- s0, s...))
+ & -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...))
{
return extended_slice<count_new_axis<S0, S...>::value>{}((*this), s0, s...);
}
@@ -756,21 +698,17 @@ namespace types
template <class T, class pS>
template <class S0, class... S>
auto ndarray<T, pS>::operator()(S0 const &s0, S const &...s)
- && -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}(
- std::move(*this), s0, s...))
+ && -> decltype(extended_slice<count_new_axis<S0, S...>::value>{}(std::move(*this), s0, s...))
{
- return extended_slice<count_new_axis<S0, S...>::value>{}(std::move(*this),
- s0, s...);
+ return extended_slice<count_new_axis<S0, S...>::value>{}(std::move(*this), s0, s...);
}
/* element filtering */
template <class T, class pS>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pS>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pS>, ndarray<long, pshape<long>>>>
ndarray<T, pS>::fast(F const &filter) const
{
long sz = filter.template shape<0>();
@@ -780,41 +718,33 @@ namespace types
if (filter.fast(i))
raw[n++] = i;
// reallocate(raw, n);
- return this->fast(ndarray<long, pshape<long>>(raw, pshape<long>(n),
- types::ownership::owned));
+ return this->fast(ndarray<long, pshape<long>>(raw, pshape<long>(n), types::ownership::owned));
}
template <class T, class pS>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pS>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pS>, ndarray<long, pshape<long>>>>
ndarray<T, pS>::operator[](F const &filter) const
{
return fast(filter);
}
template <class T, class pS>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value != 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pshape<long>>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pshape<long>>, ndarray<long, pshape<long>>>>
ndarray<T, pS>::fast(F const &filter) const
{
- return flat()[ndarray<typename F::dtype, typename F::shape_t>(filter)
- .flat()];
+ return flat()[ndarray<typename F::dtype, typename F::shape_t>(filter).flat()];
}
template <class T, class pS>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value != 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pshape<long>>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pshape<long>>, ndarray<long, pshape<long>>>>
ndarray<T, pS>::operator[](F const &filter) const
{
return fast(filter);
@@ -822,11 +752,9 @@ namespace types
template <class T, class pS>
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pS>, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pS>, F>>
ndarray<T, pS>::operator[](F const &filter) const
{
return {*this, filter};
@@ -834,11 +762,9 @@ namespace types
template <class T, class pS>
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<T, pS>, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<T, pS>, F>>
ndarray<T, pS>::fast(F const &filter) const
{
return {*this, filter};
@@ -846,14 +772,12 @@ namespace types
template <class T, class pS>
template <class Ty0, class Ty1, class... Tys, class _>
- auto ndarray<T, pS>::operator[](
- std::tuple<Ty0, Ty1, Tys...> const &indices) const ->
- typename std::enable_if<
- is_numexpr_arg<Ty0>::value,
- decltype(this->_fwdindex(
- indices, utils::make_index_sequence<2 + sizeof...(Tys)>()))>::type
+ auto ndarray<T, pS>::operator[](std::tuple<Ty0, Ty1, Tys...> const &indices) const
+ -> std::enable_if_t<is_numexpr_arg<Ty0>::value,
+ decltype(this->_fwdindex(indices,
+ std::make_index_sequence<2 + sizeof...(Tys)>()))>
{
- return _fwdindex(indices, utils::make_index_sequence<2 + sizeof...(Tys)>());
+ return _fwdindex(indices, std::make_index_sequence<2 + sizeof...(Tys)>());
}
/* through iterators */
@@ -997,12 +921,11 @@ namespace types
{
std::array<long, std::tuple_size<pS>::value> strides;
auto shape = sutils::getshape(e);
- strides[std::tuple_size<pS>::value - 1] =
- std::get<std::tuple_size<pS>::value - 1>(shape);
+ strides[std::tuple_size<pS>::value - 1] = std::get<std::tuple_size<pS>::value - 1>(shape);
if (strides[std::tuple_size<pS>::value - 1] == 0)
return os << "[]";
- std::transform(strides.rbegin(), strides.rend() - 1, shape.rbegin() + 1,
- strides.rbegin() + 1, std::multiplies<long>());
+ std::transform(strides.rbegin(), strides.rend() - 1, shape.rbegin() + 1, strides.rbegin() + 1,
+ std::multiplies<long>());
size_t depth = std::tuple_size<pS>::value;
int step = -1;
size_t size = impl::get_spacing(e);
@@ -1015,16 +938,14 @@ namespace types
if (depth == 1) {
os.width(size);
os << *iter++;
- for (int i = 1; i < std::get<std::tuple_size<pS>::value - 1>(shape);
- i++) {
+ for (int i = 1; i < std::get<std::tuple_size<pS>::value - 1>(shape); i++) {
os.width(size + 1);
os << *iter++;
}
step = 1;
depth++;
- max_modulo = std::lower_bound(
- strides.begin(), strides.end(), iter - e.buffer,
- [](int comp, int val) { return val % comp != 0; }) -
+ max_modulo = std::lower_bound(strides.begin(), strides.end(), iter - e.buffer,
+ [](int comp, int val) { return val % comp != 0; }) -
strides.begin();
} else if (max_modulo + depth == std::tuple_size<pS>::value + 1) {
depth--;
@@ -1048,8 +969,7 @@ namespace types
}
template <class E>
- typename std::enable_if<is_array<E>::value, std::ostream &>::type
- operator<<(std::ostream &os, E const &e)
+ std::enable_if_t<is_array<E>::value, std::ostream &> operator<<(std::ostream &os, E const &e)
{
return os << ndarray<typename E::dtype, typename E::shape_t>{e};
}
@@ -1070,11 +990,9 @@ namespace std
{
template <size_t I, class E>
- auto get(E &&a) ->
- typename std::enable_if<
- pythonic::types::is_array<typename std::remove_cv<
- typename std::remove_reference<E>::type>::type>::value,
- decltype(std::forward<E>(a)[I])>::type
+ auto get(E &&a) -> std::enable_if_t<
+ pythonic::types::is_array<std::remove_cv_t<std::remove_reference_t<E>>>::value,
+ decltype(std::forward<E>(a)[I])>
{
return std::forward<E>(a)[I];
}
@@ -1090,16 +1008,13 @@ namespace builtins
template <size_t N>
template <class E, class... S>
auto _build_gexpr<N>::operator()(E const &a, S const &...slices)
- -> decltype(_build_gexpr<N - 1>{}(a, types::cstride_slice<1>(),
- slices...))
+ -> decltype(_build_gexpr<N - 1>{}(a, types::cstride_slice<1>(), slices...))
{
- return _build_gexpr<N - 1>{}(a, types::cstride_slice<1>(0, a.size()),
- slices...);
+ return _build_gexpr<N - 1>{}(a, types::cstride_slice<1>(0, a.size()), slices...);
}
template <class E, class... S>
- auto _build_gexpr<1>::operator()(E const &a, S const &...slices)
- -> decltype(E(a)(slices...))
+ auto _build_gexpr<1>::operator()(E const &a, S const &...slices) -> decltype(E(a)(slices...))
{
return E(a)(slices...);
}
@@ -1111,128 +1026,113 @@ namespace builtins
}
template <class E>
- auto _make_real(E const &a, utils::int_<1>)
- -> decltype(_build_gexpr<E::value>{}(
- types::ndarray<typename types::is_complex<typename E::dtype>::type,
- types::array_tuple<long, E::value>>{},
- types::slice()))
+ auto _make_real(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}(
+ types::ndarray<typename types::is_complex<typename E::dtype>::type,
+ types::array_tuple<long, E::value>>{},
+ types::slice()))
{
using stype = typename types::is_complex<typename E::dtype>::type;
auto new_shape = sutils::getshape(a);
std::get<E::value - 1>(new_shape) *= 2;
// this is tricky and dangerous!
auto translated_mem =
- reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(
- a.mem);
- types::ndarray<stype, types::array_tuple<long, E::value>> translated{
- translated_mem, new_shape};
- return _build_gexpr<E::value>{}(
- translated, types::slice{0, std::get<E::value - 1>(new_shape), 2});
+ reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(a.mem);
+ types::ndarray<stype, types::array_tuple<long, E::value>> translated{translated_mem,
+ new_shape};
+ return _build_gexpr<E::value>{}(translated,
+ types::slice{0, std::get<E::value - 1>(new_shape), 2});
}
template <class Op, class... Args>
auto _make_real(types::numpy_expr<Op, Args...> const &a, utils::int_<1>)
- -> decltype(_make_real(
- types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
- typename types::numpy_expr<Op, Args...>::shape_t>(a),
- utils::int_<1>{}))
+ -> decltype(_make_real(types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
+ typename types::numpy_expr<Op, Args...>::shape_t>(a),
+ utils::int_<1>{}))
{
- return _make_real(
- types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
- typename types::numpy_expr<Op, Args...>::shape_t>(a),
- utils::int_<1>{});
+ return _make_real(types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
+ typename types::numpy_expr<Op, Args...>::shape_t>(a),
+ utils::int_<1>{});
}
template <class E>
auto _make_real(types::numpy_iexpr<E> const &a, utils::int_<1>)
-> decltype(_build_gexpr<types::numpy_iexpr<E>::value>{}(
std::declval<types::ndarray<
- typename types::is_complex<
- typename types::numpy_iexpr<E>::dtype>::type,
+ typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type,
types::array_tuple<long, types::numpy_iexpr<E>::value + 1>>>(),
long(), types::slice()))
{
constexpr size_t value = types::numpy_iexpr<E>::value;
- using stype = typename types::is_complex<
- typename types::numpy_iexpr<E>::dtype>::type;
+ using stype = typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type;
auto new_shape = sutils::getshape(a.arg);
std::get<value>(new_shape) *= 2;
// this is tricky and dangerous!
auto translated_mem =
- reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(
- a.arg.mem);
- types::ndarray<stype, types::array_tuple<long, value + 1>> translated{
- translated_mem, new_shape};
+ reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(a.arg.mem);
+ types::ndarray<stype, types::array_tuple<long, value + 1>> translated{translated_mem,
+ new_shape};
long offset = (a.buffer - a.arg.buffer) / a.arg.template strides<0>();
- return _build_gexpr<value>{}(
- translated, offset, types::slice{0, std::get<value>(new_shape), 2});
+ return _build_gexpr<value>{}(translated, offset,
+ types::slice{0, std::get<value>(new_shape), 2});
}
template <class E>
- types::ndarray<typename E::dtype, typename E::shape_t>
- _make_imag(E const &a, utils::int_<0>)
+ types::ndarray<typename E::dtype, typename E::shape_t> _make_imag(E const &a, utils::int_<0>)
{
// cannot use numpy.zero: forward declaration issue
- return {utils::callocate<typename E::dtype>(a.flat_size()),
- sutils::getshape(a), types::ownership::owned};
+ return {utils::callocate<typename E::dtype>(a.flat_size()), sutils::getshape(a),
+ types::ownership::owned};
}
template <class Op, class... Args>
auto _make_imag(types::numpy_expr<Op, Args...> const &a, utils::int_<1>)
- -> decltype(_make_imag(
- types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
- typename types::numpy_expr<Op, Args...>::shape_t>(a),
- utils::int_<1>{}))
+ -> decltype(_make_imag(types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
+ typename types::numpy_expr<Op, Args...>::shape_t>(a),
+ utils::int_<1>{}))
{
- return _make_imag(
- types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
- typename types::numpy_expr<Op, Args...>::shape_t>(a),
- utils::int_<1>{});
+ return _make_imag(types::ndarray<typename types::numpy_expr<Op, Args...>::dtype,
+ typename types::numpy_expr<Op, Args...>::shape_t>(a),
+ utils::int_<1>{});
}
template <class E>
auto _make_imag(types::numpy_iexpr<E> const &a, utils::int_<1>)
-> decltype(_build_gexpr<types::numpy_iexpr<E>::value>{}(
std::declval<types::ndarray<
- typename types::is_complex<
- typename types::numpy_iexpr<E>::dtype>::type,
+ typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type,
types::array_tuple<long, types::numpy_iexpr<E>::value + 1>>>(),
long(), types::slice()))
{
constexpr size_t value = types::numpy_iexpr<E>::value;
- using stype = typename types::is_complex<
- typename types::numpy_iexpr<E>::dtype>::type;
+ using stype = typename types::is_complex<typename types::numpy_iexpr<E>::dtype>::type;
auto new_shape = sutils::getshape(a.arg);
std::get<types::numpy_iexpr<E>::value>(new_shape) *= 2;
// this is tricky and dangerous!
auto translated_mem =
- reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(
- a.arg.mem);
- types::ndarray<stype, types::array_tuple<long, value + 1>> translated{
- translated_mem, new_shape};
+ reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(a.arg.mem);
+ types::ndarray<stype, types::array_tuple<long, value + 1>> translated{translated_mem,
+ new_shape};
long offset = (a.buffer - a.arg.buffer) / a.arg.template strides<0>();
- return _build_gexpr<value>{}(
- translated, offset, types::slice{1, std::get<value>(new_shape), 2});
+ return _build_gexpr<value>{}(translated, offset,
+ types::slice{1, std::get<value>(new_shape), 2});
}
template <class E>
- auto _make_imag(E const &a, utils::int_<1>)
- -> decltype(_build_gexpr<E::value>{}(
- types::ndarray<typename types::is_complex<typename E::dtype>::type,
- types::array_tuple<long, E::value>>{},
- types::slice()))
+ auto _make_imag(E const &a, utils::int_<1>) -> decltype(_build_gexpr<E::value>{}(
+ types::ndarray<typename types::is_complex<typename E::dtype>::type,
+ types::array_tuple<long, E::value>>{},
+ types::slice()))
{
using stype = typename types::is_complex<typename E::dtype>::type;
auto new_shape = sutils::getshape(a);
std::get<E::value - 1>(new_shape) *= 2;
// this is tricky and dangerous!
auto translated_mem =
- reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(
- a.mem);
- types::ndarray<stype, types::array_tuple<long, E::value>> translated{
- translated_mem, new_shape};
- return _build_gexpr<E::value>{}(
- translated, types::slice{1, std::get<E::value - 1>(new_shape), 2});
+ reinterpret_cast<utils::shared_ref<types::raw_array<stype>> const &>(a.mem);
+ types::ndarray<stype, types::array_tuple<long, E::value>> translated{translated_mem,
+ new_shape};
+ return _build_gexpr<E::value>{}(translated,
+ types::slice{1, std::get<E::value - 1>(new_shape), 2});
}
} // namespace details
@@ -1260,8 +1160,8 @@ namespace builtins
types::array_tuple<long, E::value> strides;
strides[E::value - 1] = sizeof(typename E::dtype);
auto shape = sutils::getshape(a);
- std::transform(strides.rbegin(), strides.rend() - 1, shape.rbegin(),
- strides.rbegin() + 1, std::multiplies<long>());
+ std::transform(strides.rbegin(), strides.rend() - 1, shape.rbegin(), strides.rbegin() + 1,
+ std::multiplies<long>());
return strides;
}
@@ -1278,8 +1178,8 @@ namespace builtins
}
template <class E>
- std::integral_constant<long, sizeof(typename E::dtype)>
- getattr(types::attr::ITEMSIZE, E *const &a)
+ std::integral_constant<long, sizeof(typename E::dtype)> getattr(types::attr::ITEMSIZE,
+ E *const &a)
{
return {};
}
@@ -1298,39 +1198,32 @@ namespace builtins
template <class T, class pS>
auto getattr(types::attr::REAL, types::ndarray<T, pS> const &a)
- -> decltype(details::_make_real(
- a, utils::int_<types::is_complex<T>::value>{}))
+ -> decltype(details::_make_real(a, utils::int_<types::is_complex<T>::value>{}))
{
return details::_make_real(a, utils::int_<types::is_complex<T>::value>{});
}
template <class E>
- auto getattr(types::attr::REAL, types::numpy_iexpr<E> const &e)
- -> decltype(details::_make_real(
- e, utils::int_<types::is_complex<
- typename types::numpy_iexpr<E>::dtype>::value>{}))
+ auto getattr(types::attr::REAL, types::numpy_iexpr<E> const &e) -> decltype(details::_make_real(
+ e, utils::int_<types::is_complex<typename types::numpy_iexpr<E>::dtype>::value>{}))
{
return details::_make_real(
- e,
- utils::int_<
- types::is_complex<typename types::numpy_iexpr<E>::dtype>::value>{});
+ e, utils::int_<types::is_complex<typename types::numpy_iexpr<E>::dtype>::value>{});
}
template <class Op, class... Args>
auto getattr(types::attr::REAL, types::numpy_expr<Op, Args...> const &a)
-> decltype(details::_make_real(
- a, utils::int_<types::is_complex<
- typename types::numpy_expr<Op, Args...>::dtype>::value>{}))
+ a,
+ utils::int_<types::is_complex<typename types::numpy_expr<Op, Args...>::dtype>::value>{}))
{
return details::_make_real(
- a, utils::int_<types::is_complex<
- typename types::numpy_expr<Op, Args...>::dtype>::value>{});
+ a, utils::int_<types::is_complex<typename types::numpy_expr<Op, Args...>::dtype>::value>{});
}
template <class E>
auto getattr(types::attr::REAL, types::numpy_texpr<E> const &a)
- -> decltype(types::numpy_texpr<decltype(getattr(types::attr::REAL{},
- a.arg))>{
+ -> decltype(types::numpy_texpr<decltype(getattr(types::attr::REAL{}, a.arg))>{
getattr(types::attr::REAL{}, a.arg)})
{
auto ta = getattr(types::attr::REAL{}, a.arg);
@@ -1339,8 +1232,7 @@ namespace builtins
template <class T, class pS>
auto getattr(types::attr::IMAG, types::ndarray<T, pS> const &a)
- -> decltype(details::_make_imag(
- a, utils::int_<types::is_complex<T>::value>{}))
+ -> decltype(details::_make_imag(a, utils::int_<types::is_complex<T>::value>{}))
{
return details::_make_imag(a, utils::int_<types::is_complex<T>::value>{});
}
@@ -1348,18 +1240,16 @@ namespace builtins
template <class Op, class... Args>
auto getattr(types::attr::IMAG, types::numpy_expr<Op, Args...> const &a)
-> decltype(details::_make_imag(
- a, utils::int_<types::is_complex<
- typename types::numpy_expr<Op, Args...>::dtype>::value>{}))
+ a,
+ utils::int_<types::is_complex<typename types::numpy_expr<Op, Args...>::dtype>::value>{}))
{
return details::_make_imag(
- a, utils::int_<types::is_complex<
- typename types::numpy_expr<Op, Args...>::dtype>::value>{});
+ a, utils::int_<types::is_complex<typename types::numpy_expr<Op, Args...>::dtype>::value>{});
}
template <class E>
auto getattr(types::attr::IMAG, types::numpy_texpr<E> const &a)
- -> decltype(types::numpy_texpr<decltype(getattr(types::attr::IMAG{},
- a.arg))>{
+ -> decltype(types::numpy_texpr<decltype(getattr(types::attr::IMAG{}, a.arg))>{
getattr(types::attr::IMAG{}, a.arg)})
{
auto ta = getattr(types::attr::IMAG{}, a.arg);
@@ -1367,8 +1257,7 @@ namespace builtins
}
template <class E>
- types::dtype_t<typename types::dtype_of<E>::type> getattr(types::attr::DTYPE,
- E const &a)
+ types::dtype_t<typename types::dtype_of<E>::type> getattr(types::attr::DTYPE, E const &a)
{
return {};
}
@@ -1396,13 +1285,12 @@ struct pyarray_new {
static_assert(!std::is_same<T, npy_intp>::value, "correctly specialized");
- PyObject *from_descr(PyTypeObject *subtype, PyArray_Descr *descr, T *dims,
- void *data, int flags, PyObject *obj)
+ PyObject *from_descr(PyTypeObject *subtype, PyArray_Descr *descr, T *dims, void *data, int flags,
+ PyObject *obj)
{
npy_intp shape[N];
std::copy(dims, dims + N, shape);
- return pyarray_new<npy_intp, N>{}.from_descr(subtype, descr, shape, data,
- flags, obj);
+ return pyarray_new<npy_intp, N>{}.from_descr(subtype, descr, shape, data, flags, obj);
}
PyObject *from_data(T *dims, int typenum, void *data)
{
@@ -1415,11 +1303,10 @@ struct pyarray_new {
template <size_t N>
struct pyarray_new<npy_intp, N> {
- PyObject *from_descr(PyTypeObject *subtype, PyArray_Descr *descr,
- npy_intp *dims, void *data, int flags, PyObject *obj)
+ PyObject *from_descr(PyTypeObject *subtype, PyArray_Descr *descr, npy_intp *dims, void *data,
+ int flags, PyObject *obj)
{
- return PyArray_NewFromDescr(subtype, descr, N, dims, nullptr, data, flags,
- obj);
+ return PyArray_NewFromDescr(subtype, descr, N, dims, nullptr, data, flags, obj);
}
PyObject *from_data(npy_intp *dims, int typenum, void *data)
@@ -1436,9 +1323,7 @@ inline void wrapfree(PyObject *capsule)
};
template <class T, class pS>
-PyObject *
-to_python<types::ndarray<T, pS>>::convert(types::ndarray<T, pS> const &cn,
- bool transpose)
+PyObject *to_python<types::ndarray<T, pS>>::convert(types::ndarray<T, pS> const &cn, bool transpose)
{
types::ndarray<T, pS> &n = const_cast<types::ndarray<T, pS> &>(cn);
if (PyObject *p = n.mem.get_foreign()) {
@@ -1449,8 +1334,7 @@ to_python<types::ndarray<T, pS>>::convert(types::ndarray<T, pS> const &cn,
// handle complex trick :-/
if ((long)sizeof(T) != PyArray_ITEMSIZE((PyArrayObject *)(arr))) {
arr = (PyArrayObject *)PyArray_View(
- (PyArrayObject *)(arr),
- PyArray_DescrFromType(c_type_to_numpy_type<T>::value), nullptr);
+ (PyArrayObject *)(arr), PyArray_DescrFromType(c_type_to_numpy_type<T>::value), nullptr);
}
if (sutils::equals(n, pshape)) {
@@ -1469,14 +1353,13 @@ to_python<types::ndarray<T, pS>>::convert(types::ndarray<T, pS> const &cn,
return Transposed;
}
} else {
- Py_INCREF(PyArray_DESCR(arr));
+ Py_INCREF((PyObject *)PyArray_DESCR(arr));
auto array = sutils::array(n._shape);
auto *res = pyarray_new<long, std::tuple_size<pS>::value>{}.from_descr(
- Py_TYPE(arr), PyArray_DESCR(arr), array.data(), PyArray_DATA(arr),
+ Py_TYPE((PyObject *)arr), PyArray_DESCR(arr), array.data(), PyArray_DATA(arr),
PyArray_FLAGS(arr) & ~NPY_ARRAY_OWNDATA, p);
if (transpose && (PyArray_FLAGS(arr) & NPY_ARRAY_F_CONTIGUOUS)) {
- PyObject *Transposed =
- PyArray_Transpose(reinterpret_cast<PyArrayObject *>(arr), nullptr);
+ PyObject *Transposed = PyArray_Transpose(reinterpret_cast<PyArrayObject *>(arr), nullptr);
Py_DECREF(arr);
return Transposed;
} else
@@ -1484,30 +1367,26 @@ to_python<types::ndarray<T, pS>>::convert(types::ndarray<T, pS> const &cn,
}
} else {
auto array = sutils::array(n._shape);
- PyObject *result =
- pyarray_new<long, std::tuple_size<pS>::value>{}.from_data(
- array.data(), c_type_to_numpy_type<T>::value, n.buffer);
+ PyObject *result = pyarray_new<long, std::tuple_size<pS>::value>{}.from_data(
+ array.data(), c_type_to_numpy_type<T>::value, n.buffer);
if (!result)
return nullptr;
// Take responsibility for n.buffer by wrapping it in a capsule and
// setting result.base to the capsule
- PyObject *capsule = PyCapsule_New(n.buffer, "wrapped_data",
- (PyCapsule_Destructor)&wrapfree);
+ PyObject *capsule = PyCapsule_New(n.buffer, "wrapped_data", (PyCapsule_Destructor)&wrapfree);
if (!capsule) {
Py_DECREF(result);
return nullptr;
}
n.mark_memory_external(result);
Py_INCREF(result); // because it's going to be decrefed when n is destroyed
- if (PyArray_SetBaseObject(reinterpret_cast<PyArrayObject *>(result),
- capsule) == -1) {
+ if (PyArray_SetBaseObject(reinterpret_cast<PyArrayObject *>(result), capsule) == -1) {
Py_DECREF(result);
Py_DECREF(capsule); // will free n.buffer
return nullptr;
}
if (transpose) {
- PyObject *Transposed =
- PyArray_Transpose(reinterpret_cast<PyArrayObject *>(result), nullptr);
+ PyObject *Transposed = PyArray_Transpose(reinterpret_cast<PyArrayObject *>(result), nullptr);
Py_DECREF(result);
return Transposed;
} else
@@ -1516,16 +1395,13 @@ to_python<types::ndarray<T, pS>>::convert(types::ndarray<T, pS> const &cn,
}
template <class Arg>
-PyObject *
-to_python<types::numpy_iexpr<Arg>>::convert(types::numpy_iexpr<Arg> const &v,
- bool transpose)
+PyObject *to_python<types::numpy_iexpr<Arg>>::convert(types::numpy_iexpr<Arg> const &v,
+ bool transpose)
{
- PyObject *res =
- ::to_python(types::ndarray<typename types::numpy_iexpr<Arg>::dtype,
- typename types::numpy_iexpr<Arg>::shape_t>(v));
+ PyObject *res = ::to_python(types::ndarray<typename types::numpy_iexpr<Arg>::dtype,
+ typename types::numpy_iexpr<Arg>::shape_t>(v));
if (transpose) {
- PyObject *Transposed =
- PyArray_Transpose(reinterpret_cast<PyArrayObject *>(res), nullptr);
+ PyObject *Transposed = PyArray_Transpose(reinterpret_cast<PyArrayObject *>(res), nullptr);
Py_DECREF(res);
return Transposed;
} else
@@ -1533,18 +1409,17 @@ to_python<types::numpy_iexpr<Arg>>::convert(types::numpy_iexpr<Arg> const &v,
}
template <class Arg, class... S>
-PyObject *to_python<types::numpy_gexpr<Arg, S...>>::convert(
- types::numpy_gexpr<Arg, S...> const &v, bool transpose)
+PyObject *to_python<types::numpy_gexpr<Arg, S...>>::convert(types::numpy_gexpr<Arg, S...> const &v,
+ bool transpose)
{
- PyObject *slices = (sizeof...(S) == 1) ? ::to_python(std::get<0>(v.slices))
- : ::to_python(v.slices);
+ PyObject *slices =
+ (sizeof...(S) == 1) ? ::to_python(std::get<0>(v.slices)) : ::to_python(v.slices);
PyObject *base = ::to_python(v.arg);
PyObject *res = PyObject_GetItem(base, slices);
Py_DECREF(slices);
Py_DECREF(base);
if (transpose) {
- PyObject *Transposed =
- PyArray_Transpose(reinterpret_cast<PyArrayObject *>(res), nullptr);
+ PyObject *Transposed = PyArray_Transpose(reinterpret_cast<PyArrayObject *>(res), nullptr);
Py_DECREF(res);
return Transposed;
} else
@@ -1561,19 +1436,16 @@ namespace impl
};
template <class pS, class T, size_t... Is>
- bool check_shape(T const *dims, utils::index_sequence<Is...>)
+ bool check_shape(T const *dims, std::index_sequence<Is...>)
{
types::array_tuple<bool, sizeof...(Is)> dims_match = {
- (is_integral_constant<typename std::tuple_element<Is, pS>::type>::value
+ (is_integral_constant<std::tuple_element_t<Is, pS>>::value
? (dims[Is] ==
- std::conditional<
- is_integral_constant<
- typename std::tuple_element<Is, pS>::type>::value,
- typename std::tuple_element<Is, pS>::type,
- std::integral_constant<long, 0>>::type::value)
+ std::conditional_t<is_integral_constant<std::tuple_element_t<Is, pS>>::value,
+ std::tuple_element_t<Is, pS>,
+ std::integral_constant<long, 0>>::value)
: true)...};
- return std::find(dims_match.begin(), dims_match.end(), false) ==
- dims_match.end();
+ return std::find(dims_match.begin(), dims_match.end(), false) == dims_match.end();
}
template <typename T, class pS>
@@ -1591,21 +1463,20 @@ namespace impl
}
template <class T, class Slice, class S>
- void fill_slice(Slice &slice, long const *strides, long const *offsets,
- S const *dims, utils::int_<0>)
+ void fill_slice(Slice &slice, long const *strides, long const *offsets, S const *dims,
+ utils::int_<0>)
{
}
template <long stride>
- inline void set_slice(types::cstride_normalized_slice<stride> &cs, long lower,
- long upper, long step)
+ inline void set_slice(types::cstride_normalized_slice<stride> &cs, long lower, long upper,
+ long step)
{
cs.lower = lower;
cs.upper = upper;
assert(cs.step == step && "consistent steps");
}
- inline void set_slice(types::normalized_slice &s, long lower, long upper,
- long step)
+ inline void set_slice(types::normalized_slice &s, long lower, long upper, long step)
{
s.lower = lower;
s.upper = upper;
@@ -1613,13 +1484,12 @@ namespace impl
}
template <class T, class Slice, class S, size_t N>
- void fill_slice(Slice &slice, long const *strides, long const *offsets,
- S const *dims, utils::int_<N>)
+ void fill_slice(Slice &slice, long const *strides, long const *offsets, S const *dims,
+ utils::int_<N>)
{
set_slice(std::get<std::tuple_size<Slice>::value - N>(slice), *offsets,
*offsets + *dims * *strides, *strides);
- fill_slice<T>(slice, strides + 1, offsets + 1, dims + 1,
- utils::int_<N - 1>());
+ fill_slice<T>(slice, strides + 1, offsets + 1, dims + 1, utils::int_<N - 1>());
}
} // namespace impl
@@ -1643,15 +1513,13 @@ bool from_python<types::ndarray<T, pS>>::is_convertible(PyObject *obj)
}
// this is supposed to be a texpr
if ((PyArray_FLAGS(arr) & NPY_ARRAY_F_CONTIGUOUS) &&
- ((PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS) == 0) &&
- (std::tuple_size<pS>::value > 1)) {
+ ((PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS) == 0) && (std::tuple_size<pS>::value > 1)) {
return false;
}
}
// check if dimension size match
- return impl::check_shape<pS>(
- dims, utils::make_index_sequence<std::tuple_size<pS>::value>());
+ return impl::check_shape<pS>(dims, std::make_index_sequence<std::tuple_size<pS>::value>());
}
template <typename T, class pS>
types::ndarray<T, pS> from_python<types::ndarray<T, pS>>::convert(PyObject *obj)
@@ -1663,16 +1531,14 @@ types::ndarray<T, pS> from_python<types::ndarray<T, pS>>::convert(PyObject *obj)
}
template <typename T, class pS, class... S>
-bool from_python<types::numpy_gexpr<types::ndarray<T, pS>,
- S...>>::is_convertible(PyObject *obj)
+bool from_python<types::numpy_gexpr<types::ndarray<T, pS>, S...>>::is_convertible(PyObject *obj)
{
PyArrayObject *arr = impl::check_array_type_and_dims<T, pS>(obj);
if (!arr)
return false;
if ((PyArray_FLAGS(arr) & NPY_ARRAY_F_CONTIGUOUS) &&
- ((PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS) == 0) &&
- (std::tuple_size<pS>::value > 1)) {
+ ((PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS) == 0) && (std::tuple_size<pS>::value > 1)) {
return false;
}
@@ -1713,12 +1579,10 @@ bool from_python<types::numpy_gexpr<types::ndarray<T, pS>,
template <typename T, class pS, class... S>
types::numpy_gexpr<types::ndarray<T, pS>, S...>
-from_python<types::numpy_gexpr<types::ndarray<T, pS>, S...>>::convert(
- PyObject *obj)
+from_python<types::numpy_gexpr<types::ndarray<T, pS>, S...>>::convert(PyObject *obj)
{
PyArrayObject *arr = reinterpret_cast<PyArrayObject *>(obj);
- PyArrayObject *base_arr =
- reinterpret_cast<PyArrayObject *>(PyArray_BASE(arr));
+ PyArrayObject *base_arr = reinterpret_cast<PyArrayObject *>(PyArray_BASE(arr));
/* from the base array pointer && this array pointer, we can recover the
* full slice informations
@@ -1736,24 +1600,20 @@ from_python<types::numpy_gexpr<types::ndarray<T, pS>, S...>>::convert(
auto full_offset = (PyArray_BYTES(arr) - PyArray_BYTES(base_arr)) / sizeof(T);
auto const *arr_strides = PyArray_STRIDES(arr);
long accumulated_dim = 1;
- offsets[std::tuple_size<pS>::value - 1] =
- full_offset % base_dims[std::tuple_size<pS>::value - 1];
- strides[std::tuple_size<pS>::value - 1] =
- arr_strides[std::tuple_size<pS>::value - 1] / sizeof(T);
+ offsets[std::tuple_size<pS>::value - 1] = full_offset % base_dims[std::tuple_size<pS>::value - 1];
+ strides[std::tuple_size<pS>::value - 1] = arr_strides[std::tuple_size<pS>::value - 1] / sizeof(T);
for (ssize_t i = std::tuple_size<pS>::value - 2; i >= 0; --i) {
accumulated_dim *= base_dims[i + 1];
offsets[i] = full_offset / accumulated_dim;
strides[i] = arr_strides[i] / sizeof(T) / accumulated_dim;
}
- types::ndarray<T, pS> base_array((T *)PyArray_BYTES(base_arr),
- PyArray_DIMS(base_arr),
+ types::ndarray<T, pS> base_array((T *)PyArray_BYTES(base_arr), PyArray_DIMS(base_arr),
(PyObject *)base_arr);
std::tuple<S...> slices;
- impl::fill_slice<T>(slices, strides, offsets, PyArray_DIMS(arr),
- utils::int_<sizeof...(S)>());
+ impl::fill_slice<T>(slices, strides, offsets, PyArray_DIMS(arr), utils::int_<sizeof...(S)>());
types::numpy_gexpr<types::ndarray<T, pS>, S...> r(base_array, slices);
- Py_INCREF(base_arr);
+ Py_INCREF((PyObject *)base_arr);
return r;
}
@@ -1763,9 +1623,7 @@ bool from_python<types::numpy_texpr<E>>::
is_convertible(PyObject *obj)
{
constexpr auto N = E::value;
- PyArrayObject *arr =
- impl::check_array_type_and_dims<typename E::dtype, typename E::shape_t>(
- obj);
+ PyArrayObject *arr = impl::check_array_type_and_dims<typename E::dtype, typename E::shape_t>(obj);
if (!arr)
return false;
// check strides. Note that because it's a texpr, the check is done in the
@@ -1795,8 +1653,7 @@ types::numpy_texpr<E> from_python<types::numpy_texpr<E>>::convert(PyObject *obj)
sutils::assign(std::get<1>(shape), std::get<0>(dims));
PyObject *tobj = PyArray_Transpose(arr, nullptr);
- types::ndarray<T, typename E::shape_t> base_array((T *)PyArray_BYTES(arr),
- shape, tobj);
+ types::ndarray<T, typename E::shape_t> base_array((T *)PyArray_BYTES(arr), shape, tobj);
types::numpy_texpr<types::ndarray<T, typename E::shape_t>> r(base_array);
return r;
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp b/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp
index 2cb2b904798..8388e3e17cd 100644
--- a/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/nditerator.hpp
@@ -98,6 +98,24 @@ namespace types
}
template <class E>
+ bool nditerator<E>::operator>(nditerator<E> const &other) const
+ {
+ return index > other.index;
+ }
+
+ template <class E>
+ bool nditerator<E>::operator<=(nditerator<E> const &other) const
+ {
+ return !(index > other.index);
+ }
+
+ template <class E>
+ bool nditerator<E>::operator>=(nditerator<E> const &other) const
+ {
+ return !(index < other.index);
+ }
+
+ template <class E>
nditerator<E> &nditerator<E>::operator=(nditerator<E> const &other)
{
assert(&data == &other.data);
@@ -109,8 +127,7 @@ namespace types
* element
*/
template <class E>
- const_nditerator<E>::const_nditerator(E const &data, long index)
- : data(data), index(index)
+ const_nditerator<E>::const_nditerator(E const &data, long index) : data(data), index(index)
{
}
@@ -189,29 +206,43 @@ namespace types
}
template <class E>
- const_nditerator<E> &
- const_nditerator<E>::operator=(const_nditerator const &other)
+ bool const_nditerator<E>::operator>(const_nditerator<E> const &other) const
+ {
+ return index > other.index;
+ }
+
+ template <class E>
+ bool const_nditerator<E>::operator<=(const_nditerator<E> const &other) const
+ {
+ return !(index > other.index);
+ }
+
+ template <class E>
+ bool const_nditerator<E>::operator>=(const_nditerator<E> const &other) const
+ {
+ return !(index < other.index);
+ }
+
+ template <class E>
+ const_nditerator<E> &const_nditerator<E>::operator=(const_nditerator const &other)
{
index = other.index;
return *this;
}
#ifdef USE_XSIMD
template <class E>
- const_simd_nditerator<E>::const_simd_nditerator(typename E::dtype const *data)
- : data(data)
+ const_simd_nditerator<E>::const_simd_nditerator(typename E::dtype const *data) : data(data)
{
}
template <class E>
- auto const_simd_nditerator<E>::operator*() const
- -> decltype(xsimd::load_unaligned(data))
+ auto const_simd_nditerator<E>::operator*() const -> decltype(xsimd::load_unaligned(data))
{
return xsimd::load_unaligned(data);
}
template <class E>
- void
- const_simd_nditerator<E>::store(xsimd::batch<typename E::dtype> const &val)
+ void const_simd_nditerator<E>::store(xsimd::batch<typename E::dtype> const &val)
{
val.store_unaligned(const_cast<typename E::dtype *>(data));
}
@@ -244,36 +275,49 @@ namespace types
}
template <class E>
- long const_simd_nditerator<E>::operator-(
- const_simd_nditerator<E> const &other) const
+ long const_simd_nditerator<E>::operator-(const_simd_nditerator<E> const &other) const
{
return (data - other.data) / vector_size;
}
template <class E>
- bool const_simd_nditerator<E>::operator!=(
- const_simd_nditerator<E> const &other) const
+ bool const_simd_nditerator<E>::operator!=(const_simd_nditerator<E> const &other) const
{
return data != other.data;
}
template <class E>
- bool const_simd_nditerator<E>::operator==(
- const_simd_nditerator<E> const &other) const
+ bool const_simd_nditerator<E>::operator==(const_simd_nditerator<E> const &other) const
{
return data == other.data;
}
template <class E>
- bool const_simd_nditerator<E>::operator<(
- const_simd_nditerator<E> const &other) const
+ bool const_simd_nditerator<E>::operator<(const_simd_nditerator<E> const &other) const
{
return data < other.data;
}
template <class E>
- const_simd_nditerator<E> &
- const_simd_nditerator<E>::operator=(const_simd_nditerator const &other)
+ bool const_simd_nditerator<E>::operator>(const_simd_nditerator<E> const &other) const
+ {
+ return data > other.data;
+ }
+
+ template <class E>
+ bool const_simd_nditerator<E>::operator<=(const_simd_nditerator<E> const &other) const
+ {
+ return !(data > other.data);
+ }
+
+ template <class E>
+ bool const_simd_nditerator<E>::operator>=(const_simd_nditerator<E> const &other) const
+ {
+ return !(data < other.data);
+ }
+
+ template <class E>
+ const_simd_nditerator<E> &const_simd_nditerator<E>::operator=(const_simd_nditerator const &other)
{
data = other.data;
return *this;
@@ -304,8 +348,7 @@ namespace types
}
template <class T>
- typename T::dtype const *
- make_const_nditerator<false>::operator()(T const &self, long i) const
+ typename T::dtype const *make_const_nditerator<false>::operator()(T const &self, long i) const
{
return self.buffer + i;
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_binary_op.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_binary_op.hpp
index e8891b9ca37..1c24429f4b1 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_binary_op.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_binary_op.hpp
@@ -6,12 +6,9 @@
#endif
template <class E0, class E1>
-typename std::enable_if<
- types::valid_numop_parameters<typename std::decay<E0>::type,
- typename std::decay<E1>::type>::value,
- types::numpy_expr<NUMPY_BINARY_FUNC_SYM,
- typename types::adapt_type<E0, E1>::type,
- typename types::adapt_type<E1, E0>::type>>::type
+std::enable_if_t<types::valid_numop_parameters<std::decay_t<E0>, std::decay_t<E1>>::value,
+ types::numpy_expr<NUMPY_BINARY_FUNC_SYM, typename types::adapt_type<E0, E1>::type,
+ typename types::adapt_type<E1, E0>::type>>
NUMPY_BINARY_FUNC_NAME(E0 &&self, E1 &&other)
{
return {std::forward<E0>(self), std::forward<E1>(other)};
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp
index 6f63445a095..4d8b2e02544 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_broadcast.hpp
@@ -28,8 +28,7 @@ namespace types
#ifdef USE_XSIMD
template <class T>
template <class vectorizer>
- typename broadcasted<T>::simd_iterator
- broadcasted<T>::vbegin(vectorizer) const
+ typename broadcasted<T>::simd_iterator broadcasted<T>::vbegin(vectorizer) const
{
return {*this};
}
@@ -54,8 +53,8 @@ namespace types
template <class T>
template <class S, class Arg1, class... Args>
auto broadcasted<T>::operator()(S arg0, Arg1 &&arg1, Args &&...args) const
- -> broadcast_or_broadcasted_t<typename std::decay<decltype(ref(
- std::forward<Arg1>(arg1), std::forward<Args>(args)...))>::type>
+ -> broadcast_or_broadcasted_t<
+ std::decay_t<decltype(ref(std::forward<Arg1>(arg1), std::forward<Args>(args)...))>>
{
return {ref(std::forward<Arg1>(arg1), std::forward<Args>(args)...)};
}
@@ -96,8 +95,7 @@ namespace types
template <class T, class B>
template <size_t N>
- typename broadcast<T, B>::dtype
- broadcast<T, B>::operator[](array_tuple<long, N>) const
+ typename broadcast<T, B>::dtype broadcast<T, B>::operator[](array_tuple<long, N>) const
{
return _base._value;
}
@@ -110,8 +108,7 @@ namespace types
template <class T, class B>
template <class... Args>
- typename broadcast<T, B>::dtype
- broadcast<T, B>::operator()(Args &&...args) const
+ typename broadcast<T, B>::dtype broadcast<T, B>::operator()(Args &&...args) const
{
return _base._value;
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp
index 20331cd9a9c..2ecfdd2ea8e 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_expr.hpp
@@ -29,7 +29,7 @@ namespace types
}
template <size_t I, class Args, size_t... Is>
- long init_shape_element(Args const &args, utils::index_sequence<Is...>)
+ long init_shape_element(Args const &args, std::index_sequence<Is...>)
{
return best_of(std::get<Is>(args).template shape<I>()...);
}
@@ -43,37 +43,31 @@ namespace types
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::const_iterator
- numpy_expr<Op, Args...>::_begin(utils::index_sequence<I...>) const
+ numpy_expr<Op, Args...>::_begin(std::index_sequence<I...>) const
{
- return {
- {make_step(size(), std::get<I>(args).template shape<0>())...},
- const_cast<typename std::decay<Args>::type const &>(std::get<I>(args))
- .begin()...};
+ return {{make_step(size(), std::get<I>(args).template shape<0>())...},
+ const_cast<std::decay_t<Args> const &>(std::get<I>(args)).begin()...};
}
template <class Op, class... Args>
- typename numpy_expr<Op, Args...>::const_iterator
- numpy_expr<Op, Args...>::begin() const
+ typename numpy_expr<Op, Args...>::const_iterator numpy_expr<Op, Args...>::begin() const
{
- return _begin(utils::make_index_sequence<sizeof...(Args)>{});
+ return _begin(std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::const_iterator
- numpy_expr<Op, Args...>::_end(utils::index_sequence<I...>) const
+ numpy_expr<Op, Args...>::_end(std::index_sequence<I...>) const
{
- return {
- {make_step(size(), std::get<I>(args).template shape<0>())...},
- const_cast<typename std::decay<Args>::type const &>(std::get<I>(args))
- .end()...};
+ return {{make_step(size(), std::get<I>(args).template shape<0>())...},
+ const_cast<std::decay_t<Args> const &>(std::get<I>(args)).end()...};
}
template <class Op, class... Args>
- typename numpy_expr<Op, Args...>::const_iterator
- numpy_expr<Op, Args...>::end() const
+ typename numpy_expr<Op, Args...>::const_iterator numpy_expr<Op, Args...>::end() const
{
- return _end(utils::make_index_sequence<sizeof...(Args)>{});
+ return _end(std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
@@ -92,7 +86,7 @@ namespace types
template <class Op, class... Args>
template <size_t... I>
- bool numpy_expr<Op, Args...>::_no_broadcast(utils::index_sequence<I...>) const
+ bool numpy_expr<Op, Args...>::_no_broadcast(std::index_sequence<I...>) const
{
bool child_broadcast = false;
(void)std::initializer_list<bool>{
@@ -109,8 +103,7 @@ namespace types
template <class Op, class... Args>
template <size_t... I>
- bool
- numpy_expr<Op, Args...>::_no_broadcast_ex(utils::index_sequence<I...>) const
+ bool numpy_expr<Op, Args...>::_no_broadcast_ex(std::index_sequence<I...>) const
{
bool child_broadcast = false;
(void)std::initializer_list<bool>{
@@ -128,94 +121,86 @@ namespace types
template <class Op, class... Args>
template <size_t... I>
- bool numpy_expr<Op, Args...>::_no_broadcast_vectorize(
- utils::index_sequence<I...>) const
+ bool numpy_expr<Op, Args...>::_no_broadcast_vectorize(std::index_sequence<I...>) const
{
bool child_broadcast = false;
(void)std::initializer_list<bool>{
- (child_broadcast |=
- !utils::no_broadcast_vectorize(std::get<I>(args)))...};
+ (child_broadcast |= !utils::no_broadcast_vectorize(std::get<I>(args)))...};
if (child_broadcast)
return false;
bool same_shape = true;
(void)std::initializer_list<bool>{
- (same_shape &=
- ((long)std::get<I>(args).template shape<0>() == size()))...};
+ (same_shape &= ((long)std::get<I>(args).template shape<0>() == size()))...};
return same_shape;
}
template <class Op, class... Args>
bool numpy_expr<Op, Args...>::no_broadcast() const
{
- return _no_broadcast(utils::make_index_sequence<sizeof...(Args)>{});
+ return _no_broadcast(std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
bool numpy_expr<Op, Args...>::no_broadcast_ex() const
{
- return _no_broadcast_ex(utils::make_index_sequence<sizeof...(Args)>{});
+ return _no_broadcast_ex(std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
bool numpy_expr<Op, Args...>::no_broadcast_vectorize() const
{
- return _no_broadcast_vectorize(
- utils::make_index_sequence<sizeof...(Args)>{});
+ return _no_broadcast_vectorize(std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::iterator
- numpy_expr<Op, Args...>::_begin(utils::index_sequence<I...>)
+ numpy_expr<Op, Args...>::_begin(std::index_sequence<I...>)
{
return {{make_step(size(), std::get<I>(args).template shape<0>())...},
- const_cast<typename std::decay<Args>::type &>(std::get<I>(args))
- .begin()...};
+ const_cast<std::decay_t<Args> &>(std::get<I>(args)).begin()...};
}
template <class Op, class... Args>
typename numpy_expr<Op, Args...>::iterator numpy_expr<Op, Args...>::begin()
{
- return _begin(utils::make_index_sequence<sizeof...(Args)>{});
+ return _begin(std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::iterator
- numpy_expr<Op, Args...>::_end(utils::index_sequence<I...>)
+ numpy_expr<Op, Args...>::_end(std::index_sequence<I...>)
{
return {{make_step(size(), std::get<I>(args).template shape<0>())...},
- const_cast<typename std::decay<Args>::type &>(std::get<I>(args))
- .end()...};
+ const_cast<std::decay_t<Args> &>(std::get<I>(args)).end()...};
}
template <class Op, class... Args>
typename numpy_expr<Op, Args...>::iterator numpy_expr<Op, Args...>::end()
{
- return _end(utils::make_index_sequence<sizeof...(Args)>{});
+ return _end(std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
auto numpy_expr<Op, Args...>::fast(long i) const
- -> decltype(this->_fast(i, utils::make_index_sequence<sizeof...(Args)>{}))
+ -> decltype(this->_fast(i, std::make_index_sequence<sizeof...(Args)>{}))
{
- return _fast(i, utils::make_index_sequence<sizeof...(Args)>{});
+ return _fast(i, std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
template <class... Indices>
auto numpy_expr<Op, Args...>::map_fast(Indices... indices) const
- -> decltype(this->_map_fast(
- array_tuple<long, sizeof...(Indices)>{{indices...}},
- utils::make_index_sequence<sizeof...(Args)>{}))
+ -> decltype(this->_map_fast(array_tuple<long, sizeof...(Indices)>{{indices...}},
+ std::make_index_sequence<sizeof...(Args)>{}))
{
static_assert(sizeof...(Indices) == sizeof...(Args), "compatible call");
return _map_fast(array_tuple<long, sizeof...(Indices)>{{indices...}},
- utils::make_index_sequence<sizeof...(Args)>{});
+ std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
- auto
- numpy_expr<Op, Args...>::operator[](long i) const -> decltype(this->fast(i))
+ auto numpy_expr<Op, Args...>::operator[](long i) const -> decltype(this->fast(i))
{
if (i < 0)
i += size();
@@ -226,27 +211,24 @@ namespace types
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::simd_iterator
- numpy_expr<Op, Args...>::_vbegin(vectorize, utils::index_sequence<I...>) const
+ numpy_expr<Op, Args...>::_vbegin(vectorize, std::index_sequence<I...>) const
{
- return {
- {make_step(size(), std::get<I>(args).template shape<0>())...},
- std::make_tuple(xsimd::batch<
- typename std::remove_reference<Args>::type::value_type>(
- *std::get<I>(args).begin())...),
- std::get<I>(args).vbegin(vectorize{})...};
+ return {{make_step(size(), std::get<I>(args).template shape<0>())...},
+ std::make_tuple(xsimd::batch<typename std::remove_reference_t<Args>::value_type>(
+ *std::get<I>(args).begin())...),
+ std::get<I>(args).vbegin(vectorize{})...};
}
template <class Op, class... Args>
- typename numpy_expr<Op, Args...>::simd_iterator
- numpy_expr<Op, Args...>::vbegin(vectorize) const
+ typename numpy_expr<Op, Args...>::simd_iterator numpy_expr<Op, Args...>::vbegin(vectorize) const
{
- return _vbegin(vectorize{}, utils::make_index_sequence<sizeof...(Args)>{});
+ return _vbegin(vectorize{}, std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::simd_iterator
- numpy_expr<Op, Args...>::_vend(vectorize, utils::index_sequence<I...>) const
+ numpy_expr<Op, Args...>::_vend(vectorize, std::index_sequence<I...>) const
{
return {{make_step(size(), std::get<I>(args).template shape<0>())...},
{},
@@ -254,17 +236,15 @@ namespace types
}
template <class Op, class... Args>
- typename numpy_expr<Op, Args...>::simd_iterator
- numpy_expr<Op, Args...>::vend(vectorize) const
+ typename numpy_expr<Op, Args...>::simd_iterator numpy_expr<Op, Args...>::vend(vectorize) const
{
- return _vend(vectorize{}, utils::make_index_sequence<sizeof...(Args)>{});
+ return _vend(vectorize{}, std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::simd_iterator_nobroadcast
- numpy_expr<Op, Args...>::_vbegin(vectorize_nobroadcast,
- utils::index_sequence<I...>) const
+ numpy_expr<Op, Args...>::_vbegin(vectorize_nobroadcast, std::index_sequence<I...>) const
{
return {std::get<I>(args).vbegin(vectorize_nobroadcast{})...};
}
@@ -273,15 +253,13 @@ namespace types
typename numpy_expr<Op, Args...>::simd_iterator_nobroadcast
numpy_expr<Op, Args...>::vbegin(vectorize_nobroadcast) const
{
- return _vbegin(vectorize_nobroadcast{},
- utils::make_index_sequence<sizeof...(Args)>{});
+ return _vbegin(vectorize_nobroadcast{}, std::make_index_sequence<sizeof...(Args)>{});
}
template <class Op, class... Args>
template <size_t... I>
typename numpy_expr<Op, Args...>::simd_iterator_nobroadcast
- numpy_expr<Op, Args...>::_vend(vectorize_nobroadcast,
- utils::index_sequence<I...>) const
+ numpy_expr<Op, Args...>::_vend(vectorize_nobroadcast, std::index_sequence<I...>) const
{
return {std::get<I>(args).vend(vectorize_nobroadcast{})...};
}
@@ -290,8 +268,7 @@ namespace types
typename numpy_expr<Op, Args...>::simd_iterator_nobroadcast
numpy_expr<Op, Args...>::vend(vectorize_nobroadcast) const
{
- return _vend(vectorize_nobroadcast{},
- utils::make_index_sequence<sizeof...(Args)>{});
+ return _vend(vectorize_nobroadcast{}, std::make_index_sequence<sizeof...(Args)>{});
}
#endif
@@ -299,19 +276,16 @@ namespace types
template <class Op, class... Args>
template <class... S>
auto numpy_expr<Op, Args...>::operator()(S const &...s) const
- -> decltype(this->_get(utils::make_index_sequence<sizeof...(Args)>{},
- s...))
+ -> decltype(this->_get(std::make_index_sequence<sizeof...(Args)>{}, s...))
{
- return _get(utils::make_index_sequence<sizeof...(Args)>{}, s...);
+ return _get(std::make_index_sequence<sizeof...(Args)>{}, s...);
}
template <class Op, class... Args>
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr<Op, Args...>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr<Op, Args...>, ndarray<long, pshape<long>>>>
numpy_expr<Op, Args...>::fast(F const &filter) const
{
long sz = filter.template shape<0>();
@@ -322,28 +296,23 @@ namespace types
raw[n++] = i;
// reallocate(raw, n);
long shp[1] = {n};
- return this->fast(
- ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
+ return this->fast(ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
}
template <class Op, class... Args>
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr<Op, Args...>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr<Op, Args...>, ndarray<long, pshape<long>>>>
numpy_expr<Op, Args...>::operator[](F const &filter) const
{
return fast(filter);
}
template <class Op, class... Args>
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr<Op, Args...>, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr<Op, Args...>, F>>
numpy_expr<Op, Args...>::operator[](F const &filter) const
{
return {*this, filter};
@@ -351,11 +320,9 @@ namespace types
template <class Op, class... Args>
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<F>::value &&
- !is_array_index<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_expr<Op, Args...>, F>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !is_array_index<F>::value &&
+ !std::is_same<bool, typename F::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_expr<Op, Args...>, F>>
numpy_expr<Op, Args...>::fast(F const &filter) const
{
return {*this, filter};
@@ -374,7 +341,7 @@ namespace types
template <class Op, class... Args>
long numpy_expr<Op, Args...>::flat_size() const
{
- return prod_helper(*this, utils::make_index_sequence<value>());
+ return prod_helper(*this, std::make_index_sequence<value>());
}
template <class Op, class... Args>
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp
index f5b61fdf4af..72695f3f3b9 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_gexpr.hpp
@@ -62,8 +62,7 @@ namespace types
template <class T>
intptr_t baseid(T const &e)
{
- return baseid_helper(
- e, std::integral_constant<bool, types::is_dtype<T>::value>{});
+ return baseid_helper(e, std::integral_constant<bool, types::is_dtype<T>::value>{});
}
template <class E0, class E1>
@@ -98,22 +97,20 @@ namespace types
template <class E0, class Op, class... Args, size_t... Is>
bool may_overlap(E0 const &e0, types::numpy_expr<Op, Args...> const &e1,
- utils::index_sequence<Is...>)
+ std::index_sequence<Is...>)
{
bool overlaps[] = {may_overlap(e0, std::get<Is>(e1.args))...};
- return std::any_of(std::begin(overlaps), std::end(overlaps),
- [](bool b) { return b; });
+ return std::any_of(std::begin(overlaps), std::end(overlaps), [](bool b) { return b; });
}
template <class E0, class Op, class... Args>
bool may_overlap(E0 const &e0, types::numpy_expr<Op, Args...> const &e1)
{
- return may_overlap(e0, e1, utils::make_index_sequence<sizeof...(Args)>());
+ return may_overlap(e0, e1, std::make_index_sequence<sizeof...(Args)>());
}
template <class E0, class T1>
- bool may_overlap(E0 const &e0,
- pythonic::numpy::details::arange_index<T1> const &e1)
+ bool may_overlap(E0 const &e0, pythonic::numpy::details::arange_index<T1> const &e1)
{
return false;
}
@@ -124,8 +121,8 @@ namespace types
return false;
}
template <class Arg, class E1, class... S>
- typename std::enable_if<std::is_scalar<E1>::value, bool>::type
- may_overlap(numpy_gexpr<Arg, S...> const &gexpr, E1 const &)
+ std::enable_if_t<std::is_scalar<E1>::value, bool> may_overlap(numpy_gexpr<Arg, S...> const &gexpr,
+ E1 const &)
{
return false;
}
@@ -142,8 +139,7 @@ namespace types
if (gexpr.arg.id() != expr.arg.id()) {
return false;
}
- if (!slices_may_overlap(std::get<0>(gexpr.slices),
- std::get<0>(expr.slices)))
+ if (!slices_may_overlap(std::get<0>(gexpr.slices), std::get<0>(expr.slices)))
return false;
return true;
}
@@ -188,8 +184,7 @@ namespace types
return value;
}
- inline cstride_normalized_slice<1>
- to_normalized_slice<none_type>::operator()(none_type)
+ inline cstride_normalized_slice<1> to_normalized_slice<none_type>::operator()(none_type)
{
return {0, 1};
}
@@ -210,108 +205,95 @@ namespace types
{
template <size_t I, class S>
- std::tuple<> merge_gexpr<std::tuple<>, std::tuple<>>::run(
- S const &, std::tuple<> const &t0, std::tuple<> const &)
+ std::tuple<> merge_gexpr<std::tuple<>, std::tuple<>>::run(S const &, std::tuple<> const &t0,
+ std::tuple<> const &)
{
return t0;
}
template <class... T0>
template <size_t I, class S>
- std::tuple<T0...> merge_gexpr<std::tuple<T0...>, std::tuple<>>::run(
- S const &, std::tuple<T0...> const &t0, std::tuple<>)
+ std::tuple<T0...> merge_gexpr<std::tuple<T0...>, std::tuple<>>::run(S const &,
+ std::tuple<T0...> const &t0,
+ std::tuple<>)
{
return t0;
}
template <class T, size_t... Is>
- constexpr long count_new_axis_helper(utils::index_sequence<Is...>)
+ constexpr long count_new_axis_helper(std::index_sequence<Is...>)
{
- return count_new_axis<typename std::tuple_element<Is, T>::type...>::value;
+ return count_new_axis<std::tuple_element_t<Is, T>...>::value;
}
template <size_t I, class S, class T, size_t... Is>
- auto normalize_all(S const &s, T const &t, utils::index_sequence<Is...>)
+ auto normalize_all(S const &s, T const &t, std::index_sequence<Is...>)
-> decltype(std::make_tuple(normalize(
std::get<Is>(t),
s.template shape<I + Is -
- count_new_axis_helper<T>(
- utils::make_index_sequence<1 + Is>())>())...))
+ count_new_axis_helper<T>(std::make_index_sequence<1 + Is>())>())...))
{
return std::make_tuple(normalize(
std::get<Is>(t),
s.template shape<I + Is -
- count_new_axis_helper<T>(
- utils::make_index_sequence<1 + Is>())>())...);
+ count_new_axis_helper<T>(std::make_index_sequence<1 + Is>())>())...);
}
template <class... T1>
template <size_t I, class S>
std::tuple<normalize_t<T1>...>
- merge_gexpr<std::tuple<>, std::tuple<T1...>>::run(
- S const &s, std::tuple<>, std::tuple<T1...> const &t1)
+ merge_gexpr<std::tuple<>, std::tuple<T1...>>::run(S const &s, std::tuple<>,
+ std::tuple<T1...> const &t1)
{
- return normalize_all<I>(s, t1,
- utils::make_index_sequence<sizeof...(T1)>());
+ return normalize_all<I>(s, t1, std::make_index_sequence<sizeof...(T1)>());
}
template <class Arg, class... Sp>
- typename std::enable_if<count_new_axis<Sp...>::value == 0,
- numpy_gexpr<Arg, Sp...>>::type
+ std::enable_if_t<count_new_axis<Sp...>::value == 0, numpy_gexpr<Arg, Sp...>>
_make_gexpr(Arg arg, std::tuple<Sp...> const &t)
{
return {arg, t};
}
template <class Arg, class S, size_t... Is>
- numpy_gexpr<Arg, typename to_normalized_slice<
- typename std::tuple_element<Is, S>::type>::type...>
- _make_gexpr_helper(Arg arg, S const &s, utils::index_sequence<Is...>)
+ numpy_gexpr<Arg, typename to_normalized_slice<std::tuple_element_t<Is, S>>::type...>
+ _make_gexpr_helper(Arg arg, S const &s, std::index_sequence<Is...>)
{
- return {arg,
- to_normalized_slice<typename std::tuple_element<Is, S>::type>{}(
- std::get<Is>(s))...};
+ return {arg, to_normalized_slice<std::tuple_element_t<Is, S>>{}(std::get<Is>(s))...};
}
template <class Arg, class... Sp>
- auto _make_gexpr(Arg arg, std::tuple<Sp...> const &s) ->
- typename std::enable_if<
- count_new_axis<Sp...>::value != 0,
- decltype(_make_gexpr_helper(
- arg.reshape(make_reshape<count_new_axis<Sp...>::value>(
- arg, std::tuple<std::integral_constant<
- bool, to_slice<Sp>::is_new_axis>...>())),
- s, utils::make_index_sequence<sizeof...(Sp)>()))>::type
+ auto _make_gexpr(Arg arg, std::tuple<Sp...> const &s) -> std::enable_if_t<
+ count_new_axis<Sp...>::value != 0,
+ decltype(_make_gexpr_helper(
+ arg.reshape(make_reshape<count_new_axis<Sp...>::value>(
+ arg, std::tuple<std::integral_constant<bool, to_slice<Sp>::is_new_axis>...>())),
+ s, std::make_index_sequence<sizeof...(Sp)>()))>
{
return _make_gexpr_helper(
arg.reshape(make_reshape<count_new_axis<Sp...>::value>(
- arg, std::tuple<std::integral_constant<
- bool, to_slice<Sp>::is_new_axis>...>())),
- s, utils::make_index_sequence<sizeof...(Sp)>());
+ arg, std::tuple<std::integral_constant<bool, to_slice<Sp>::is_new_axis>...>())),
+ s, std::make_index_sequence<sizeof...(Sp)>());
}
template <class Arg, class... S>
template <size_t... Is>
numpy_gexpr<Arg, normalize_t<S>...>
- make_gexpr<Arg, S...>::operator()(Arg arg, std::tuple<S...> s,
- utils::index_sequence<Is...>)
+ make_gexpr<Arg, S...>::operator()(Arg arg, std::tuple<S...> s, std::index_sequence<Is...>)
{
return {arg, normalize(std::get<Is>(s), arg.template shape<Is>())...};
}
template <class Arg, class... S>
- numpy_gexpr<Arg, normalize_t<S>...>
- make_gexpr<Arg, S...>::operator()(Arg arg, S const &...s)
+ numpy_gexpr<Arg, normalize_t<S>...> make_gexpr<Arg, S...>::operator()(Arg arg, S const &...s)
{
- return operator()(arg, std::tuple<S...>(s...),
- utils::make_index_sequence<sizeof...(S)>());
+ return operator()(arg, std::tuple<S...>(s...), std::make_index_sequence<sizeof...(S)>());
}
} // namespace details
template <class Arg, class... S>
auto make_gexpr(Arg &&arg, S const &...s)
- -> decltype(details::make_gexpr<Arg, S...>{}(std::forward<Arg>(arg),
- s...))
+ -> decltype(details::make_gexpr<Arg, S...>{}(std::forward<Arg>(arg), s...))
{
return details::make_gexpr<Arg, S...>{}(std::forward<Arg>(arg), s...);
}
@@ -325,48 +307,40 @@ namespace types
template <class Argp> // not using the default one, to make it possible to
// accept reference && non reference version of Argp
numpy_gexpr<Arg, S...>::numpy_gexpr(numpy_gexpr<Argp, S...> const &other)
- : arg(other.arg), slices(other.slices), _shape(other._shape),
- buffer(other.buffer), _strides(other._strides)
+ : arg(other.arg), slices(other.slices), _shape(other._shape), buffer(other.buffer),
+ _strides(other._strides)
{
- static_assert(std::is_same<typename returnable<Arg>::type,
- typename returnable<Argp>::type>::value,
- "this constructor is only here to adapt reference / non "
- "reference type, nothing else");
+ static_assert(
+ std::is_same<typename returnable<Arg>::type, typename returnable<Argp>::type>::value,
+ "this constructor is only here to adapt reference / non "
+ "reference type, nothing else");
assert(buffer);
}
template <class Arg, class... S>
template <size_t J, class Slice>
- typename std::enable_if<is_normalized_slice<Slice>::value, void>::type
- numpy_gexpr<Arg, S...>::init_shape(Slice const &s, utils::int_<1>,
- utils::int_<J>)
+ std::enable_if_t<is_normalized_slice<Slice>::value, void>
+ numpy_gexpr<Arg, S...>::init_shape(Slice const &s, utils::int_<1>, utils::int_<J>)
{
buffer += s.lower * arg.template strides<sizeof...(S) - 1>();
- sutils::assign(std::get<J>(_strides),
- s.step * arg.template strides<sizeof...(S) - 1>());
- sutils::assign(std::get<J>(_shape),
- std::get<sizeof...(S) - 1>(slices).size());
+ sutils::assign(std::get<J>(_strides), s.step * arg.template strides<sizeof...(S) - 1>());
+ sutils::assign(std::get<J>(_shape), std::get<sizeof...(S) - 1>(slices).size());
}
template <class Arg, class... S>
template <size_t I, size_t J, class Slice>
- typename std::enable_if<is_normalized_slice<Slice>::value, void>::type
- numpy_gexpr<Arg, S...>::init_shape(Slice const &s, utils::int_<I>,
- utils::int_<J>)
+ std::enable_if_t<is_normalized_slice<Slice>::value, void>
+ numpy_gexpr<Arg, S...>::init_shape(Slice const &s, utils::int_<I>, utils::int_<J>)
{
- sutils::assign(std::get<J>(_shape),
- std::get<sizeof...(S) - I>(slices).size());
+ sutils::assign(std::get<J>(_shape), std::get<sizeof...(S) - I>(slices).size());
buffer += s.lower * arg.template strides<sizeof...(S) - I>();
- sutils::assign(std::get<J>(_strides),
- s.step * arg.template strides<sizeof...(S) - I>());
- init_shape(std::get<sizeof...(S) - I + 1>(slices), utils::int_<I - 1>(),
- utils::int_<J + 1>());
+ sutils::assign(std::get<J>(_strides), s.step * arg.template strides<sizeof...(S) - I>());
+ init_shape(std::get<sizeof...(S) - I + 1>(slices), utils::int_<I - 1>(), utils::int_<J + 1>());
}
template <class Arg, class... S>
template <size_t J>
- void numpy_gexpr<Arg, S...>::init_shape(long cs, utils::int_<1>,
- utils::int_<J>)
+ void numpy_gexpr<Arg, S...>::init_shape(long cs, utils::int_<1>, utils::int_<J>)
{
assert(cs >= 0 && "normalized");
buffer += cs * arg.template strides<sizeof...(S) - 1>();
@@ -374,35 +348,26 @@ namespace types
template <class Arg, class... S>
template <size_t I, size_t J>
- void numpy_gexpr<Arg, S...>::init_shape(long cs, utils::int_<I>,
- utils::int_<J>)
+ void numpy_gexpr<Arg, S...>::init_shape(long cs, utils::int_<I>, utils::int_<J>)
{
assert(cs >= 0 && "normalized");
buffer += cs * arg.template strides<sizeof...(S) - I>();
- init_shape(std::get<sizeof...(S) - I + 1>(slices), utils::int_<I - 1>(),
- utils::int_<J>());
+ init_shape(std::get<sizeof...(S) - I + 1>(slices), utils::int_<I - 1>(), utils::int_<J>());
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...>::numpy_gexpr(Arg const &arg,
- std::tuple<S const &...> const &values)
+ numpy_gexpr<Arg, S...>::numpy_gexpr(Arg const &arg, std::tuple<S const &...> const &values)
: arg(arg), slices(values), buffer(const_cast<dtype *>(this->arg.buffer))
{
assert(buffer);
- init_shape(std::get<0>(slices), utils::int_<sizeof...(S)>(),
- utils::int_<0>());
+ init_shape(std::get<0>(slices), utils::int_<sizeof...(S)>(), utils::int_<0>());
- sutils::copy_shape<sizeof...(S) - count_long<S...>::value,
- count_long<S...>::value>(
- _shape, arg,
- utils::make_index_sequence<value -
- (sizeof...(S) - count_long<S...>::value)>());
+ sutils::copy_shape<sizeof...(S) - count_long<S...>::value, count_long<S...>::value>(
+ _shape, arg, std::make_index_sequence<value - (sizeof...(S) - count_long<S...>::value)>());
- sutils::copy_strides<sizeof...(S) - count_long<S...>::value,
- count_long<S...>::value>(
+ sutils::copy_strides<sizeof...(S) - count_long<S...>::value, count_long<S...>::value>(
_strides, arg,
- utils::make_index_sequence<value -
- (sizeof...(S) - count_long<S...>::value)>());
+ std::make_index_sequence<value - (sizeof...(S) - count_long<S...>::value)>());
}
template <class Arg, class... S>
@@ -412,34 +377,29 @@ namespace types
}
template <class Arg, class... S>
template <class Argp, class... Sp>
- numpy_gexpr<Arg, S...>::numpy_gexpr(numpy_gexpr<Argp, Sp...> const &expr,
- Arg arg)
+ numpy_gexpr<Arg, S...>::numpy_gexpr(numpy_gexpr<Argp, Sp...> const &expr, Arg arg)
: arg(arg), slices(tuple_pop(expr.slices)), buffer(expr.buffer)
{
assert(buffer);
- sutils::copy_shape<0, 1>(_shape, expr, utils::make_index_sequence<value>());
+ sutils::copy_shape<0, 1>(_shape, expr, std::make_index_sequence<value>());
buffer += arg.buffer - expr.arg.buffer;
- sutils::copy_strides<0, 1>(_strides, expr,
- utils::make_index_sequence<value>());
+ sutils::copy_strides<0, 1>(_strides, expr, std::make_index_sequence<value>());
}
template <class Arg, class... S>
template <class G>
numpy_gexpr<Arg, S...>::numpy_gexpr(G const &expr, Arg &&arg)
- : arg(std::forward<Arg>(arg)), slices(tuple_pop(expr.slices)),
- buffer(expr.buffer)
+ : arg(std::forward<Arg>(arg)), slices(tuple_pop(expr.slices)), buffer(expr.buffer)
{
assert(buffer);
- sutils::copy_shape<0, 1>(_shape, expr, utils::make_index_sequence<value>());
+ sutils::copy_shape<0, 1>(_shape, expr, std::make_index_sequence<value>());
buffer += (arg.buffer - expr.arg.buffer);
- sutils::copy_strides<0, 1>(_strides, expr,
- utils::make_index_sequence<value>());
+ sutils::copy_strides<0, 1>(_strides, expr, std::make_index_sequence<value>());
}
template <class Arg, class... S>
template <class E>
- typename std::enable_if<may_overlap_gexpr<E>::value,
- numpy_gexpr<Arg, S...> &>::type
+ std::enable_if_t<may_overlap_gexpr<E>::value, numpy_gexpr<Arg, S...> &>
numpy_gexpr<Arg, S...>::_copy(E const &expr)
{
static_assert(value >= utils::dim_of<E>::value, "dimensions match");
@@ -449,27 +409,23 @@ namespace types
* perform a fuzzy alias check dynamically!
*/
assert(buffer);
- constexpr bool vectorize =
- is_vectorizable &&
- std::is_same<dtype, typename dtype_of<E>::type>::value &&
- is_vectorizable_array<E>::value;
+ constexpr bool vectorize = is_vectorizable &&
+ std::is_same<dtype, typename dtype_of<E>::type>::value &&
+ is_vectorizable_array<E>::value;
if (may_overlap(*this, expr)) {
- return utils::broadcast_copy<
- numpy_gexpr &, ndarray<typename E::dtype, typename E::shape_t>, value,
- value - utils::dim_of<E>::value, vectorize>(
+ return utils::broadcast_copy<numpy_gexpr &, ndarray<typename E::dtype, typename E::shape_t>,
+ value, value - utils::dim_of<E>::value, vectorize>(
*this, ndarray<typename E::dtype, typename E::shape_t>(expr));
} else {
// 100% sure there's no overlap
- return utils::broadcast_copy<numpy_gexpr &, E, value,
- value - utils::dim_of<E>::value, vectorize>(
- *this, expr);
+ return utils::broadcast_copy<numpy_gexpr &, E, value, value - utils::dim_of<E>::value,
+ vectorize>(*this, expr);
}
}
template <class Arg, class... S>
template <class E>
- typename std::enable_if<!may_overlap_gexpr<E>::value,
- numpy_gexpr<Arg, S...> &>::type
+ std::enable_if_t<!may_overlap_gexpr<E>::value, numpy_gexpr<Arg, S...> &>
numpy_gexpr<Arg, S...>::_copy(E const &expr)
{
return _copy_restrict(expr);
@@ -479,13 +435,11 @@ namespace types
template <class E>
numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::_copy_restrict(E const &expr)
{
- constexpr bool vectorize =
- is_vectorizable &&
- std::is_same<dtype, typename dtype_of<E>::type>::value &&
- is_vectorizable_array<E>::value;
+ constexpr bool vectorize = is_vectorizable &&
+ std::is_same<dtype, typename dtype_of<E>::type>::value &&
+ is_vectorizable_array<E>::value;
assert(buffer);
- return utils::broadcast_copy<numpy_gexpr &, E, value,
- (int)value - (int)utils::dim_of<E>::value,
+ return utils::broadcast_copy<numpy_gexpr &, E, value, (int)value - (int)utils::dim_of<E>::value,
vectorize>(*this, expr);
}
@@ -497,19 +451,17 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator=(numpy_gexpr<Arg, S...> const &expr)
{
if (buffer == nullptr) {
// arg = expr.arg;
- const_cast<typename std::decay<Arg>::type &>(arg) = expr.arg;
+ const_cast<std::decay_t<Arg> &>(arg) = expr.arg;
slices = expr.slices;
assert(expr.buffer);
buffer = arg.buffer + (expr.buffer - expr.arg.buffer);
_shape = expr._shape;
_strides = expr._strides;
- assert(sutils::getshape(*this) == sutils::getshape(expr) &&
- "compatible sizes");
+ assert(sutils::getshape(*this) == sutils::getshape(expr) && "compatible sizes");
return *this;
} else {
return _copy(expr);
@@ -518,12 +470,11 @@ namespace types
template <class Arg, class... S>
template <class Argp>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator=(numpy_gexpr<Argp, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator=(numpy_gexpr<Argp, S...> const &expr)
{
if (buffer == nullptr) {
// arg = expr.arg;
- const_cast<typename std::decay<Arg>::type &>(arg) = expr.arg;
+ const_cast<std::decay_t<Arg> &>(arg) = expr.arg;
slices = expr.slices;
assert(expr.buffer);
buffer = arg.buffer + (expr.buffer - expr.arg.buffer);
@@ -537,54 +488,42 @@ namespace types
template <class Arg, class... S>
template <class Op, class E>
- typename std::enable_if<!may_overlap_gexpr<E>::value,
- numpy_gexpr<Arg, S...> &>::type
+ std::enable_if_t<!may_overlap_gexpr<E>::value, numpy_gexpr<Arg, S...> &>
numpy_gexpr<Arg, S...>::update_(E const &expr)
{
- using BExpr =
- typename std::conditional<std::is_scalar<E>::value, broadcast<E, dtype>,
- E const &>::type;
+ using BExpr = std::conditional_t<std::is_scalar<E>::value, broadcast<E, dtype>, E const &>;
BExpr bexpr = expr;
// 100% sure there's no overlap
return utils::broadcast_update < Op, numpy_gexpr &, BExpr, value,
value - (std::is_scalar<E>::value + utils::dim_of<E>::value),
is_vectorizable &&
- types::is_vectorizable<typename std::remove_cv<
- typename std::remove_reference<BExpr>::type>::type>::value &&
- std::is_same<dtype, typename dtype_of<typename std::decay<
- BExpr>::type>::type>::value >
+ types::is_vectorizable<std::remove_cv_t<std::remove_reference_t<BExpr>>>::value &&
+ std::is_same<dtype, typename dtype_of<std::decay_t<BExpr>>::type>::value >
(*this, bexpr);
}
template <class Arg, class... S>
template <class Op, class E>
- typename std::enable_if<may_overlap_gexpr<E>::value,
- numpy_gexpr<Arg, S...> &>::type
+ std::enable_if_t<may_overlap_gexpr<E>::value, numpy_gexpr<Arg, S...> &>
numpy_gexpr<Arg, S...>::update_(E const &expr)
{
- using BExpr =
- typename std::conditional<std::is_scalar<E>::value, broadcast<E, dtype>,
- E const &>::type;
+ using BExpr = std::conditional_t<std::is_scalar<E>::value, broadcast<E, dtype>, E const &>;
BExpr bexpr = expr;
if (may_overlap(*this, expr)) {
- using NBExpr =
- ndarray<typename std::remove_reference<BExpr>::type::dtype,
- typename std::remove_reference<BExpr>::type::shape_t>;
+ using NBExpr = ndarray<typename std::remove_reference_t<BExpr>::dtype,
+ typename std::remove_reference_t<BExpr>::shape_t>;
return utils::broadcast_update < Op, numpy_gexpr &, NBExpr, value,
value - (std::is_scalar<E>::value + utils::dim_of<E>::value),
is_vectorizable && types::is_vectorizable<E>::value &&
- std::is_same<dtype,
- typename std::decay<BExpr>::type::dtype>::value >
+ std::is_same<dtype, typename std::decay_t<BExpr>::dtype>::value >
(*this, NBExpr(bexpr));
} else {
// 100% sure there's no overlap
return utils::broadcast_update < Op, numpy_gexpr &, BExpr, value,
value - (std::is_scalar<E>::value + utils::dim_of<E>::value),
is_vectorizable && types::is_vectorizable<E>::value &&
- std::is_same<dtype,
- typename std::decay<BExpr>::type::dtype>::value >
- (*this, bexpr);
+ std::is_same<dtype, typename std::decay_t<BExpr>::dtype>::value > (*this, bexpr);
}
}
@@ -596,8 +535,7 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator+=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator+=(numpy_gexpr<Arg, S...> const &expr)
{
return update_<pythonic::operator_::functor::iadd>(expr);
}
@@ -610,8 +548,7 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator-=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator-=(numpy_gexpr<Arg, S...> const &expr)
{
return update_<pythonic::operator_::functor::isub>(expr);
}
@@ -624,8 +561,7 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator*=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator*=(numpy_gexpr<Arg, S...> const &expr)
{
return update_<pythonic::operator_::functor::imul>(expr);
}
@@ -638,8 +574,7 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator/=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator/=(numpy_gexpr<Arg, S...> const &expr)
{
return update_<pythonic::operator_::functor::idiv>(expr);
}
@@ -652,8 +587,7 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator|=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator|=(numpy_gexpr<Arg, S...> const &expr)
{
return update_<pythonic::operator_::functor::ior>(expr);
}
@@ -666,8 +600,7 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator&=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator&=(numpy_gexpr<Arg, S...> const &expr)
{
return update_<pythonic::operator_::functor::iand>(expr);
}
@@ -680,51 +613,46 @@ namespace types
}
template <class Arg, class... S>
- numpy_gexpr<Arg, S...> &
- numpy_gexpr<Arg, S...>::operator^=(numpy_gexpr<Arg, S...> const &expr)
+ numpy_gexpr<Arg, S...> &numpy_gexpr<Arg, S...>::operator^=(numpy_gexpr<Arg, S...> const &expr)
{
return update_<pythonic::operator_::functor::ixor>(expr);
}
template <class Arg, class... S>
- typename numpy_gexpr<Arg, S...>::const_iterator
- numpy_gexpr<Arg, S...>::begin() const
+ typename numpy_gexpr<Arg, S...>::const_iterator numpy_gexpr<Arg, S...>::begin() const
{
- return make_const_nditerator < is_strided || value != 1 > ()(*this, 0);
+ return make_const_nditerator<is_strided || value != 1>()(*this, 0);
}
template <class Arg, class... S>
- typename numpy_gexpr<Arg, S...>::const_iterator
- numpy_gexpr<Arg, S...>::end() const
+ typename numpy_gexpr<Arg, S...>::const_iterator numpy_gexpr<Arg, S...>::end() const
{
- return make_const_nditerator < is_strided || value != 1 > ()(*this, size());
+ return make_const_nditerator<is_strided || value != 1>()(*this, size());
}
template <class Arg, class... S>
typename numpy_gexpr<Arg, S...>::iterator numpy_gexpr<Arg, S...>::begin()
{
- return make_nditerator < is_strided || value != 1 > ()(*this, 0);
+ return make_nditerator<is_strided || value != 1>()(*this, 0);
}
template <class Arg, class... S>
typename numpy_gexpr<Arg, S...>::iterator numpy_gexpr<Arg, S...>::end()
{
- return make_nditerator < is_strided || value != 1 > ()(*this, size());
+ return make_nditerator<is_strided || value != 1>()(*this, size());
}
#ifdef USE_XSIMD
template <class Arg, class... S>
template <class vectorizer>
- typename numpy_gexpr<Arg, S...>::simd_iterator
- numpy_gexpr<Arg, S...>::vbegin(vectorizer) const
+ typename numpy_gexpr<Arg, S...>::simd_iterator numpy_gexpr<Arg, S...>::vbegin(vectorizer) const
{
return {buffer};
}
template <class Arg, class... S>
template <class vectorizer>
- typename numpy_gexpr<Arg, S...>::simd_iterator
- numpy_gexpr<Arg, S...>::vend(vectorizer) const
+ typename numpy_gexpr<Arg, S...>::simd_iterator numpy_gexpr<Arg, S...>::vend(vectorizer) const
{
using vector_type = typename xsimd::batch<dtype>;
static const std::size_t vector_size = vector_type::size;
@@ -734,8 +662,7 @@ namespace types
#endif
template <class Arg, class... S>
- auto
- numpy_gexpr<Arg, S...>::operator[](long i) const -> decltype(this->fast(i))
+ auto numpy_gexpr<Arg, S...>::operator[](long i) const -> decltype(this->fast(i))
{
if (i < 0)
i += std::get<0>(_shape);
@@ -752,25 +679,23 @@ namespace types
template <class Arg, class... S>
template <class... Sp>
- auto numpy_gexpr<Arg, S...>::operator()(Sp const &...s) const
- -> decltype(make_gexpr(*this, s...))
+ auto numpy_gexpr<Arg, S...>::operator()(Sp const &...s) const -> decltype(make_gexpr(*this, s...))
{
return make_gexpr(*this, s...);
}
template <class Arg, class... S>
template <class Sp>
- auto numpy_gexpr<Arg, S...>::operator[](Sp const &s) const ->
- typename std::enable_if<is_slice<Sp>::value,
- decltype(make_gexpr(*this, (s.lower, s)))>::type
+ auto numpy_gexpr<Arg, S...>::operator[](Sp const &s) const
+ -> std::enable_if_t<is_slice<Sp>::value, decltype(make_gexpr(*this, (s.lower, s)))>
{
return make_gexpr(*this, s);
}
template <class Arg, class... S>
template <size_t M>
- auto numpy_gexpr<Arg, S...>::fast(array_tuple<long, M> const &indices)
- const & -> decltype(nget<M - 1>().fast(*this, indices))
+ auto numpy_gexpr<Arg, S...>::fast(
+ array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>().fast(*this, indices))
{
return nget<M - 1>().fast(*this, indices);
}
@@ -785,25 +710,24 @@ namespace types
template <class Arg, class... S>
template <size_t M>
- auto numpy_gexpr<Arg, S...>::operator[](array_tuple<long, M> const &indices)
- const & -> decltype(nget<M - 1>()(*this, indices))
+ auto numpy_gexpr<Arg, S...>::operator[](
+ array_tuple<long, M> const &indices) const & -> decltype(nget<M - 1>()(*this, indices))
{
return nget<M - 1>()(*this, indices);
}
template <class Arg, class... S>
template <size_t M>
- auto numpy_gexpr<Arg, S...>::operator[](array_tuple<long, M> const &indices)
- && -> decltype(nget<M - 1>()(std::move(*this), indices))
+ auto numpy_gexpr<Arg, S...>::operator[](
+ array_tuple<long, M> const &indices) && -> decltype(nget<M - 1>()(std::move(*this), indices))
{
return nget<M - 1>()(std::move(*this), indices);
}
template <class Arg, class... S>
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_gexpr<Arg, S...>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_gexpr<Arg, S...>, ndarray<long, pshape<long>>>>
numpy_gexpr<Arg, S...>::fast(F const &filter) const
{
long sz = filter.template shape<0>();
@@ -814,15 +738,13 @@ namespace types
raw[n++] = i;
// reallocate(raw, n);
long shp[1] = {n};
- return this->fast(
- ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
+ return this->fast(ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
}
template <class Arg, class... S>
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_gexpr<Arg, S...>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_gexpr<Arg, S...>, ndarray<long, pshape<long>>>>
numpy_gexpr<Arg, S...>::operator[](F const &filter) const
{
return fast(filter);
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp
index 5f44a4ae1bc..b1f8128a479 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_iexpr.hpp
@@ -43,8 +43,7 @@ namespace types
template <class Argp> // not using the default one, to make it possible to
// accept reference and non reference version of Argp
numpy_iexpr<Arg>::numpy_iexpr(numpy_iexpr<Argp &> const &other)
- : arg(const_cast<typename std::decay<Argp>::type &>(other.arg)),
- buffer(other.buffer)
+ : arg(const_cast<std::decay_t<Argp> &>(other.arg)), buffer(other.buffer)
{
assert(buffer);
}
@@ -67,10 +66,8 @@ namespace types
numpy_iexpr<Arg> &numpy_iexpr<Arg>::operator=(E const &expr)
{
assert(buffer);
- return utils::broadcast_copy < numpy_iexpr &, E, value,
- value - utils::dim_of<E>::value,
- is_vectorizable &&
- std::is_same<dtype, typename dtype_of<E>::type>::value &&
+ return utils::broadcast_copy < numpy_iexpr &, E, value, value - utils::dim_of<E>::value,
+ is_vectorizable && std::is_same<dtype, typename dtype_of<E>::type>::value &&
types::is_vectorizable<E>::value > (*this, expr);
}
@@ -86,8 +83,7 @@ namespace types
return utils::broadcast_copy < numpy_iexpr &, numpy_iexpr const &, value,
value - utils::dim_of<numpy_iexpr>::value,
is_vectorizable && numpy_iexpr<Arg>::is_vectorizable &&
- std::is_same<dtype, typename numpy_iexpr<Arg>::dtype>::value >
- (*this, expr);
+ std::is_same<dtype, typename numpy_iexpr<Arg>::dtype>::value > (*this, expr);
}
template <class Arg>
@@ -102,8 +98,7 @@ namespace types
return utils::broadcast_copy < numpy_iexpr &, numpy_iexpr const &, value,
value - utils::dim_of<numpy_iexpr>::value,
is_vectorizable && numpy_iexpr<Arg>::is_vectorizable &&
- std::is_same<dtype, typename numpy_iexpr<Arg>::dtype>::value >
- (*this, expr);
+ std::is_same<dtype, typename numpy_iexpr<Arg>::dtype>::value > (*this, expr);
}
template <class Arg>
@@ -111,18 +106,15 @@ namespace types
numpy_iexpr<Arg> &numpy_iexpr<Arg>::update_(Expr const &expr)
{
using BExpr =
- typename std::conditional<std::is_scalar<Expr>::value,
- broadcast<Expr, dtype>, Expr const &>::type;
+ std::conditional_t<std::is_scalar<Expr>::value, broadcast<Expr, dtype>, Expr const &>;
assert(buffer);
BExpr bexpr = expr;
utils::broadcast_update<
Op, numpy_iexpr &, BExpr, value,
value - (std::is_scalar<Expr>::value + utils::dim_of<Expr>::value),
is_vectorizable &&
- types::is_vectorizable<typename std::remove_cv<
- typename std::remove_reference<BExpr>::type>::type>::value &&
- std::is_same<dtype, typename dtype_of<typename std::decay<
- BExpr>::type>::type>::value>(*this, bexpr);
+ types::is_vectorizable<std::remove_cv_t<std::remove_reference_t<BExpr>>>::value &&
+ std::is_same<dtype, typename dtype_of<std::decay_t<BExpr>>::type>::value>(*this, bexpr);
return *this;
}
@@ -219,25 +211,25 @@ namespace types
template <class Arg>
typename numpy_iexpr<Arg>::const_iterator numpy_iexpr<Arg>::begin() const
{
- return make_const_nditerator < is_strided || value != 1 > ()(*this, 0);
+ return make_const_nditerator<is_strided || value != 1>()(*this, 0);
}
template <class Arg>
typename numpy_iexpr<Arg>::const_iterator numpy_iexpr<Arg>::end() const
{
- return make_const_nditerator < is_strided || value != 1 > ()(*this, size());
+ return make_const_nditerator<is_strided || value != 1>()(*this, size());
}
template <class Arg>
typename numpy_iexpr<Arg>::iterator numpy_iexpr<Arg>::begin()
{
- return make_nditerator < is_strided || value != 1 > ()(*this, 0);
+ return make_nditerator<is_strided || value != 1>()(*this, 0);
}
template <class Arg>
typename numpy_iexpr<Arg>::iterator numpy_iexpr<Arg>::end()
{
- return make_nditerator < is_strided || value != 1 > ()(*this, size());
+ return make_nditerator<is_strided || value != 1>()(*this, size());
}
template <class Arg>
@@ -265,15 +257,15 @@ namespace types
}
template <class T0, class T1>
- size_t compute_fast_offset(size_t offset, long mult, T0 const &indices,
- T1 const &shape, std::integral_constant<long, 0>)
+ size_t compute_fast_offset(size_t offset, long mult, T0 const &indices, T1 const &shape,
+ std::integral_constant<long, 0>)
{
return offset;
}
template <long I, class T0, class T1>
- size_t compute_fast_offset(size_t offset, long mult, T0 const &indices,
- T1 const &shape, std::integral_constant<long, I>)
+ size_t compute_fast_offset(size_t offset, long mult, T0 const &indices, T1 const &shape,
+ std::integral_constant<long, I>)
{
return compute_fast_offset(offset + std::get<I - 1>(indices) * mult,
mult * shape.template shape<I>(), indices, shape,
@@ -284,24 +276,20 @@ namespace types
typename numpy_iexpr<Arg>::dtype const &
numpy_iexpr<Arg>::fast(array_tuple<long, value> const &indices) const
{
- return buffer[compute_fast_offset(
- indices[value - 1], arg.template shape<value>(), indices, arg,
- std::integral_constant<long, value - 1>())];
+ return buffer[compute_fast_offset(indices[value - 1], arg.template shape<value>(), indices, arg,
+ std::integral_constant<long, value - 1>())];
}
template <class Arg>
- typename numpy_iexpr<Arg>::dtype &
- numpy_iexpr<Arg>::fast(array_tuple<long, value> const &indices)
+ typename numpy_iexpr<Arg>::dtype &numpy_iexpr<Arg>::fast(array_tuple<long, value> const &indices)
{
- return const_cast<dtype &>(
- const_cast<numpy_iexpr const &>(*this).fast(indices));
+ return const_cast<dtype &>(const_cast<numpy_iexpr const &>(*this).fast(indices));
}
template <class Arg>
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_iexpr<Arg>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_iexpr<Arg>, ndarray<long, pshape<long>>>>
numpy_iexpr<Arg>::fast(F const &filter) const
{
long sz = filter.template shape<0>();
@@ -312,23 +300,20 @@ namespace types
raw[n++] = i;
// reallocate(raw, n);
long shp[1] = {n};
- return this->fast(
- ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
+ return this->fast(ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
}
#ifdef USE_XSIMD
template <class Arg>
template <class vectorizer>
- typename numpy_iexpr<Arg>::simd_iterator
- numpy_iexpr<Arg>::vbegin(vectorizer) const
+ typename numpy_iexpr<Arg>::simd_iterator numpy_iexpr<Arg>::vbegin(vectorizer) const
{
return {buffer};
}
template <class Arg>
template <class vectorizer>
- typename numpy_iexpr<Arg>::simd_iterator
- numpy_iexpr<Arg>::vend(vectorizer) const
+ typename numpy_iexpr<Arg>::simd_iterator numpy_iexpr<Arg>::vend(vectorizer) const
{
using vector_type = typename xsimd::batch<dtype>;
static const std::size_t vector_size = vector_type::size;
@@ -353,8 +338,7 @@ namespace types
}
template <class Arg>
- auto
- numpy_iexpr<Arg>::operator[](long i) && -> decltype(std::move(*this).fast(i))
+ auto numpy_iexpr<Arg>::operator[](long i) && -> decltype(std::move(*this).fast(i))
{
if (i < 0)
i += size();
@@ -363,8 +347,7 @@ namespace types
template <class Arg>
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value,
- numpy_gexpr<numpy_iexpr<Arg>, normalize_t<Sp>>>::type
+ std::enable_if_t<is_slice<Sp>::value, numpy_gexpr<numpy_iexpr<Arg>, normalize_t<Sp>>>
numpy_iexpr<Arg>::operator[](Sp const &s0) const
{
return make_gexpr(*this, s0);
@@ -372,9 +355,8 @@ namespace types
template <class Arg>
template <class Sp, class... S>
- typename std::enable_if<
- is_slice<Sp>::value,
- numpy_gexpr<numpy_iexpr<Arg>, normalize_t<Sp>, normalize_t<S>...>>::type
+ std::enable_if_t<is_slice<Sp>::value,
+ numpy_gexpr<numpy_iexpr<Arg>, normalize_t<Sp>, normalize_t<S>...>>
numpy_iexpr<Arg>::operator()(Sp const &s0, S const &...s) const
{
return make_gexpr(*this, s0, s...);
@@ -382,44 +364,40 @@ namespace types
template <class Arg>
template <class F>
- typename std::enable_if<
- is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
- numpy_vexpr<numpy_iexpr<Arg>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value,
+ numpy_vexpr<numpy_iexpr<Arg>, ndarray<long, pshape<long>>>>
numpy_iexpr<Arg>::operator[](F const &filter) const
{
return fast(filter);
}
template <class T0, class T1>
- size_t compute_offset(size_t offset, long mult, T0 const &indices,
- T1 const &shape, std::integral_constant<long, 0>)
+ size_t compute_offset(size_t offset, long mult, T0 const &indices, T1 const &shape,
+ std::integral_constant<long, 0>)
{
return offset;
}
template <long I, class T0, class T1>
- size_t compute_offset(size_t offset, long mult, T0 const &indices,
- T1 const &shape, std::integral_constant<long, I>)
+ size_t compute_offset(size_t offset, long mult, T0 const &indices, T1 const &shape,
+ std::integral_constant<long, I>)
{
- return compute_offset(
- offset + (std::get<I - 1>(indices) < 0
- ? std::get<I - 1>(indices) + shape.template shape<I>()
- : std::get<I - 1>(indices)) *
- mult,
- mult * shape.template shape<I>(), indices, shape,
- std::integral_constant<long, I - 1>());
+ return compute_offset(offset + (std::get<I - 1>(indices) < 0
+ ? std::get<I - 1>(indices) + shape.template shape<I>()
+ : std::get<I - 1>(indices)) *
+ mult,
+ mult * shape.template shape<I>(), indices, shape,
+ std::integral_constant<long, I - 1>());
}
template <class Arg>
typename numpy_iexpr<Arg>::dtype const &
numpy_iexpr<Arg>::operator[](array_tuple<long, value> const &indices) const
{
- return buffer[compute_offset(indices[value - 1] < 0
- ? indices[value - 1] +
- arg.template shape<value>()
- : indices[value - 1],
- arg.template shape<value>(), indices, arg,
- std::integral_constant<long, value - 1>())];
+ return buffer[compute_offset(
+ indices[value - 1] < 0 ? indices[value - 1] + arg.template shape<value>()
+ : indices[value - 1],
+ arg.template shape<value>(), indices, arg, std::integral_constant<long, value - 1>())];
}
template <class Arg>
@@ -439,31 +417,28 @@ namespace types
}
template <class S, size_t... Is>
- long prod_helper(S const &shape, utils::index_sequence<Is...>)
+ long prod_helper(S const &shape, std::index_sequence<Is...>)
{
long res = 1;
- (void)std::initializer_list<long>{
- (res *= (long)(shape.template shape<Is>()))...};
+ (void)std::initializer_list<long>{(res *= (long)(shape.template shape<Is>()))...};
return res;
}
template <class Arg>
long numpy_iexpr<Arg>::flat_size() const
{
- return prod_helper(*this, utils::make_index_sequence<value>());
+ return prod_helper(*this, std::make_index_sequence<value>());
}
template <class Arg>
- long numpy_iexpr<Arg>::buffer_offset(Arg const &arg, long index,
- utils::int_<0>)
+ long numpy_iexpr<Arg>::buffer_offset(Arg const &arg, long index, utils::int_<0>)
{
return index;
}
template <class Arg>
template <class T, class pS, size_t N>
- long numpy_iexpr<Arg>::buffer_offset(ndarray<T, pS> const &arg, long index,
- utils::int_<N>)
+ long numpy_iexpr<Arg>::buffer_offset(ndarray<T, pS> const &arg, long index, utils::int_<N>)
{
return index * arg.template strides<0>();
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp
index 66644875fc4..5c36a435ddc 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_nary_expr.hpp
@@ -18,21 +18,17 @@ namespace functor
{
template <typename... T>
- auto NUMPY_NARY_FUNC_NAME::operator()(T &&...args) const ->
- typename std::enable_if<
- !types::valid_numexpr_parameters<
- typename std::decay<T>::type...>::value,
- decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>::type
+ auto NUMPY_NARY_FUNC_NAME::operator()(T &&...args) const
+ -> std::enable_if_t<!types::valid_numexpr_parameters<std::decay_t<T>...>::value,
+ decltype(NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...))>
{
return NUMPY_NARY_FUNC_SYM(std::forward<T>(args)...);
}
template <class... E>
- typename std::enable_if<
- types::valid_numexpr_parameters<typename std::decay<E>::type...>::value,
- types::numpy_expr<
- NUMPY_NARY_FUNC_NAME,
- typename types::NUMPY_NARY_RESHAPE_MODE<E, E...>::type...>>::type
+ std::enable_if_t<types::valid_numexpr_parameters<std::decay_t<E>...>::value,
+ types::numpy_expr<NUMPY_NARY_FUNC_NAME,
+ typename types::NUMPY_NARY_RESHAPE_MODE<E, E...>::type...>>
NUMPY_NARY_FUNC_NAME::operator()(E &&...args) const
{
return {std::forward<E>(args)...};
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp
index 47c47881b6d..1b71d0a3409 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_texpr.hpp
@@ -56,40 +56,30 @@ namespace types
}
template <class E>
- auto numpy_texpr_2<E>::fast(long i) const
- -> decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- i))
+ auto numpy_texpr_2<E>::fast(long i) const -> decltype(this->arg(
+ fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), i))
{
- return arg(
- cstride_slice<1>(pythonic::builtins::None, pythonic::builtins::None),
- i);
+ return arg(cstride_slice<1>(pythonic::builtins::None, pythonic::builtins::None), i);
}
template <class E>
- auto numpy_texpr_2<E>::fast(long i)
- -> decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- i))
+ auto numpy_texpr_2<E>::fast(long i) -> decltype(this->arg(
+ fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), i))
{
- return arg(
- cstride_slice<1>(pythonic::builtins::None, pythonic::builtins::None),
- i);
+ return arg(cstride_slice<1>(pythonic::builtins::None, pythonic::builtins::None), i);
}
#ifdef USE_XSIMD
template <class E>
template <class vectorizer>
- typename numpy_texpr_2<E>::simd_iterator
- numpy_texpr_2<E>::vbegin(vectorizer) const
+ typename numpy_texpr_2<E>::simd_iterator numpy_texpr_2<E>::vbegin(vectorizer) const
{
return {*this};
}
template <class E>
template <class vectorizer>
- typename numpy_texpr_2<E>::simd_iterator
- numpy_texpr_2<E>::vend(vectorizer) const
+ typename numpy_texpr_2<E>::simd_iterator numpy_texpr_2<E>::vend(vectorizer) const
{
return {*this}; // not vectorizable anyway
}
@@ -113,38 +103,26 @@ namespace types
template <class E>
template <class S>
- auto numpy_texpr_2<E>::operator[](S const &s0) const
- -> numpy_texpr<
- decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- (s0.step, s0)))>
+ auto numpy_texpr_2<E>::operator[](S const &s0) const -> numpy_texpr<decltype(this->arg(
+ fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), (s0.step, s0)))>
{
- return {arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- s0)};
+ return {arg(fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), s0)};
}
template <class E>
template <class S>
- auto numpy_texpr_2<E>::operator[](S const &s0)
- -> numpy_texpr<
- decltype(this->arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- (s0.step, s0)))>
+ auto numpy_texpr_2<E>::operator[](S const &s0) -> numpy_texpr<decltype(this->arg(
+ fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), (s0.step, s0)))>
{
- return {arg(fast_contiguous_slice(pythonic::builtins::None,
- pythonic::builtins::None),
- s0)};
+ return {arg(fast_contiguous_slice(pythonic::builtins::None, pythonic::builtins::None), s0)};
}
/* element filtering */
template <class E>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>
numpy_texpr_2<E>::fast(F const &filter) const
{
long sz = filter.template shape<0>();
@@ -154,17 +132,14 @@ namespace types
if (filter.fast(i))
raw[n++] = i;
// reallocate(raw, n);
- return this->fast(ndarray<long, pshape<long>>(raw, pshape<long>(n),
- types::ownership::owned));
+ return this->fast(ndarray<long, pshape<long>>(raw, pshape<long>(n), types::ownership::owned));
}
template <class E>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value != 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<typename numpy_texpr_2<E>::dtype, pshape<long>>,
- ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<typename numpy_texpr_2<E>::dtype, pshape<long>>,
+ ndarray<long, pshape<long>>>>
numpy_texpr_2<E>::fast(F const &filter) const
{
return numpy::functor::array{}(*this)
@@ -173,11 +148,9 @@ namespace types
template <class E>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value == 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value == 1 && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>
numpy_texpr_2<E>::operator[](F const &filter) const
{
return fast(filter);
@@ -185,12 +158,10 @@ namespace types
template <class E>
template <class F> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- std::is_same<bool, typename F::dtype>::value && F::value != 1 &&
- !is_pod_array<F>::value,
- numpy_vexpr<ndarray<typename numpy_texpr_2<E>::dtype, pshape<long>>,
- ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && std::is_same<bool, typename F::dtype>::value &&
+ F::value != 1 && !is_pod_array<F>::value,
+ numpy_vexpr<ndarray<typename numpy_texpr_2<E>::dtype, pshape<long>>,
+ ndarray<long, pshape<long>>>>
numpy_texpr_2<E>::operator[](F const &filter) const
{
return fast(filter);
@@ -198,51 +169,41 @@ namespace types
template <class E>
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>
numpy_texpr_2<E>::operator[](F const &filter) const
{
- static_assert(F::value == 1,
- "advanced indexing only supporint with 1D index");
+ static_assert(F::value == 1, "advanced indexing only supporint with 1D index");
return {*this, filter};
}
template <class E>
template <class F> // indexing through an array of indices -- a view
- typename std::enable_if<
- is_numexpr_arg<F>::value &&
- !std::is_same<bool, typename F::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<F>::value && !std::is_same<bool, typename F::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_texpr_2<E>, ndarray<long, pshape<long>>>>
numpy_texpr_2<E>::fast(F const &filter) const
{
- static_assert(F::value == 1,
- "advanced indexing only supported with 1D index");
+ static_assert(F::value == 1, "advanced indexing only supported with 1D index");
return {*this, filter};
}
template <class E>
template <class S0, class... S>
- auto numpy_texpr_2<E>::operator()(S0 const &s0, S const &...s) const ->
- typename std::enable_if<
- !is_numexpr_arg<S0>::value,
- decltype(this->_reverse_index(
- std::tuple<S0 const &, S const &...>{s0, s...},
- utils::make_reversed_index_sequence<1 + sizeof...(S)>()))>::type
+ auto numpy_texpr_2<E>::operator()(S0 const &s0, S const &...s) const -> std::enable_if_t<
+ !is_numexpr_arg<S0>::value,
+ decltype(this->_reverse_index(std::tuple<S0 const &, S const &...>{s0, s...},
+ utils::make_reversed_index_sequence<1 + sizeof...(S)>()))>
{
- return _reverse_index(
- std::tuple<S0 const &, S const &...>{s0, s...},
- utils::make_reversed_index_sequence<1 + sizeof...(S)>());
+ return _reverse_index(std::tuple<S0 const &, S const &...>{s0, s...},
+ utils::make_reversed_index_sequence<1 + sizeof...(S)>());
}
template <class E>
template <class S0, class... S>
- auto numpy_texpr_2<E>::operator()(S0 const &s0, S const &...s) const ->
- typename std::enable_if<is_numexpr_arg<S0>::value,
- decltype(this->copy()(s0, s...))>::type
+ auto numpy_texpr_2<E>::operator()(S0 const &s0, S const &...s) const
+ -> std::enable_if_t<is_numexpr_arg<S0>::value, decltype(this->copy()(s0, s...))>
{
return copy()(s0, s...);
}
@@ -269,16 +230,13 @@ namespace types
template <class Expr>
numpy_texpr_2<Arg> &numpy_texpr_2<Arg>::operator=(Expr const &expr)
{
- return utils::broadcast_copy < numpy_texpr_2 &, Expr, value,
- value - utils::dim_of<Expr>::value,
- is_vectorizable &&
- std::is_same<dtype, typename dtype_of<Expr>::type>::value &&
+ return utils::broadcast_copy < numpy_texpr_2 &, Expr, value, value - utils::dim_of<Expr>::value,
+ is_vectorizable && std::is_same<dtype, typename dtype_of<Expr>::type>::value &&
types::is_vectorizable<Expr>::value > (*this, expr);
}
template <class Arg>
template <class Expr>
- numpy_texpr_2<Arg> &
- numpy_texpr_2<Arg>::operator=(numpy_texpr<Expr> const &expr)
+ numpy_texpr_2<Arg> &numpy_texpr_2<Arg>::operator=(numpy_texpr<Expr> const &expr)
{
arg = expr.arg;
return *this;
@@ -289,17 +247,14 @@ namespace types
numpy_texpr_2<Arg> &numpy_texpr_2<Arg>::update_(Expr const &expr)
{
using BExpr =
- typename std::conditional<std::is_scalar<Expr>::value,
- broadcast<Expr, dtype>, Expr const &>::type;
+ std::conditional_t<std::is_scalar<Expr>::value, broadcast<Expr, dtype>, Expr const &>;
BExpr bexpr = expr;
utils::broadcast_update<
Op, numpy_texpr_2 &, BExpr, value,
value - (std::is_scalar<Expr>::value + utils::dim_of<Expr>::value),
is_vectorizable &&
- types::is_vectorizable<typename std::remove_cv<
- typename std::remove_reference<BExpr>::type>::type>::value &&
- std::is_same<dtype, typename dtype_of<typename std::decay<
- BExpr>::type>::type>::value>(*this, bexpr);
+ types::is_vectorizable<std::remove_cv_t<std::remove_reference_t<BExpr>>>::value &&
+ std::is_same<dtype, typename dtype_of<std::decay_t<BExpr>>::type>::value>(*this, bexpr);
return *this;
}
@@ -355,8 +310,7 @@ namespace types
// only implemented for N = 2
template <class T, class S0, class S1>
- numpy_texpr<ndarray<T, pshape<S0, S1>>>::numpy_texpr(
- ndarray<T, pshape<S0, S1>> const &arg)
+ numpy_texpr<ndarray<T, pshape<S0, S1>>>::numpy_texpr(ndarray<T, pshape<S0, S1>> const &arg)
: numpy_texpr_2<ndarray<T, pshape<S0, S1>>>{arg}
{
}
@@ -369,8 +323,7 @@ namespace types
}
template <class E, class... S>
- numpy_texpr<numpy_gexpr<E, S...>>::numpy_texpr(
- numpy_gexpr<E, S...> const &arg)
+ numpy_texpr<numpy_gexpr<E, S...>>::numpy_texpr(numpy_gexpr<E, S...> const &arg)
: numpy_texpr_2<numpy_gexpr<E, S...>>{arg}
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_unary_op.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_unary_op.hpp
index ee1371c2022..26c86486f3f 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_unary_op.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_unary_op.hpp
@@ -6,9 +6,8 @@
#endif
template <class E>
-typename std::enable_if<
- types::valid_numop_parameters<typename std::decay<E>::type>::value,
- types::numpy_expr<NUMPY_UNARY_FUNC_SYM, E>>::type
+std::enable_if_t<types::valid_numop_parameters<std::decay_t<E>>::value,
+ types::numpy_expr<NUMPY_UNARY_FUNC_SYM, E>>
NUMPY_UNARY_FUNC_NAME(E &&self)
{
return {std::forward<E>(self)};
diff --git a/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp b/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp
index 9bb66b6e177..6ab8ff1e3c0 100644
--- a/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/numpy_vexpr.hpp
@@ -10,7 +10,7 @@ namespace types
template <class T, class F>
template <class E>
- typename std::enable_if<is_iterable<E>::value, numpy_vexpr<T, F> &>::type
+ std::enable_if_t<is_iterable<E>::value, numpy_vexpr<T, F> &>
numpy_vexpr<T, F>::operator=(E const &expr)
{
// TODO: avoid the tmp copy when no aliasing
@@ -21,7 +21,7 @@ namespace types
}
template <class T, class F>
template <class E>
- typename std::enable_if<!is_iterable<E>::value, numpy_vexpr<T, F> &>::type
+ std::enable_if_t<!is_iterable<E>::value, numpy_vexpr<T, F> &>
numpy_vexpr<T, F>::operator=(E const &expr)
{
for (long i = 0, n = shape<0>(); i < n; ++i)
@@ -68,16 +68,14 @@ namespace types
#ifdef USE_XSIMD
template <class T, class F>
template <class vectorizer>
- typename numpy_vexpr<T, F>::simd_iterator
- numpy_vexpr<T, F>::vbegin(vectorizer) const
+ typename numpy_vexpr<T, F>::simd_iterator numpy_vexpr<T, F>::vbegin(vectorizer) const
{
return {*this, 0};
}
template <class T, class F>
template <class vectorizer>
- typename numpy_vexpr<T, F>::simd_iterator
- numpy_vexpr<T, F>::vend(vectorizer) const
+ typename numpy_vexpr<T, F>::simd_iterator numpy_vexpr<T, F>::vend(vectorizer) const
{
return {*this, 0};
}
@@ -86,11 +84,9 @@ namespace types
/* element filtering */
template <class T, class F>
template <class E> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- is_numexpr_arg<E>::value &&
- std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr<T, F>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<is_numexpr_arg<E>::value && std::is_same<bool, typename E::dtype>::value &&
+ !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr<T, F>, ndarray<long, pshape<long>>>>
numpy_vexpr<T, F>::fast(E const &filter) const
{
long sz = filter.template shape<0>();
@@ -101,17 +97,14 @@ namespace types
raw[n++] = i;
// reallocate(raw, n);
long shp[1] = {n};
- return this->fast(
- ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
+ return this->fast(ndarray<long, pshape<long>>(raw, shp, types::ownership::owned));
}
template <class T, class F>
template <class E> // indexing through an array of boolean -- a mask
- typename std::enable_if<
- !is_slice<E>::value && is_numexpr_arg<E>::value &&
- std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr<T, F>, ndarray<long, pshape<long>>>>::type
+ std::enable_if_t<!is_slice<E>::value && is_numexpr_arg<E>::value &&
+ std::is_same<bool, typename E::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr<T, F>, ndarray<long, pshape<long>>>>
numpy_vexpr<T, F>::operator[](E const &filter) const
{
return fast(filter);
@@ -119,11 +112,9 @@ namespace types
template <class T, class F>
template <class E> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<E>::value &&
- !is_array_index<E>::value &&
- !std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr<T, F>, E>>::type
+ std::enable_if_t<is_numexpr_arg<E>::value && !is_array_index<E>::value &&
+ !std::is_same<bool, typename E::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr<T, F>, E>>
numpy_vexpr<T, F>::operator[](E const &filter) const
{
return {*this, filter};
@@ -131,11 +122,9 @@ namespace types
template <class T, class F>
template <class E> // indexing through an array of indices -- a view
- typename std::enable_if<is_numexpr_arg<E>::value &&
- !is_array_index<E>::value &&
- !std::is_same<bool, typename E::dtype>::value &&
- !is_pod_array<F>::value,
- numpy_vexpr<numpy_vexpr<T, F>, E>>::type
+ std::enable_if_t<is_numexpr_arg<E>::value && !is_array_index<E>::value &&
+ !std::is_same<bool, typename E::dtype>::value && !is_pod_array<F>::value,
+ numpy_vexpr<numpy_vexpr<T, F>, E>>
numpy_vexpr<T, F>::fast(E const &filter) const
{
return (*this)[filter];
@@ -145,17 +134,14 @@ namespace types
numpy_vexpr<T, F> &numpy_vexpr<T, F>::update_(Expr const &expr)
{
using BExpr =
- typename std::conditional<std::is_scalar<Expr>::value,
- broadcast<Expr, dtype>, Expr const &>::type;
+ std::conditional_t<std::is_scalar<Expr>::value, broadcast<Expr, dtype>, Expr const &>;
BExpr bexpr = expr;
utils::broadcast_update<
Op, numpy_vexpr &, BExpr, value,
value - (std::is_scalar<Expr>::value + utils::dim_of<Expr>::value),
is_vectorizable &&
- types::is_vectorizable<typename std::remove_cv<
- typename std::remove_reference<BExpr>::type>::type>::value &&
- std::is_same<dtype, typename dtype_of<typename std::decay<
- BExpr>::type>::type>::value>(*this, bexpr);
+ types::is_vectorizable<std::remove_cv_t<std::remove_reference_t<BExpr>>>::value &&
+ std::is_same<dtype, typename dtype_of<std::decay_t<BExpr>>::type>::value>(*this, bexpr);
return *this;
}
template <class T, class F>
diff --git a/contrib/python/pythran/pythran/pythonic/types/pointer.hpp b/contrib/python/pythran/pythran/pythonic/types/pointer.hpp
index b55efcdf57e..fdb26d96ece 100644
--- a/contrib/python/pythran/pythran/pythonic/types/pointer.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/pointer.hpp
@@ -37,22 +37,19 @@ PYTHONIC_NS_END
namespace std
{
template <size_t I, class T>
- typename pythonic::types::pointer<T>::reference
- get(pythonic::types::pointer<T> &t)
+ typename pythonic::types::pointer<T>::reference get(pythonic::types::pointer<T> &t)
{
return t[I];
}
template <size_t I, class T>
- typename pythonic::types::pointer<T>::value_type
- get(pythonic::types::pointer<T> const &t)
+ typename pythonic::types::pointer<T>::value_type get(pythonic::types::pointer<T> const &t)
{
return t[I];
}
template <size_t I, class T>
- typename pythonic::types::pointer<T>::value_type
- get(pythonic::types::pointer<T> &&t)
+ typename pythonic::types::pointer<T>::value_type get(pythonic::types::pointer<T> &&t)
{
return t[I];
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/raw_array.hpp b/contrib/python/pythran/pythran/pythonic/types/raw_array.hpp
index bf79843b3b0..53a4460b42d 100644
--- a/contrib/python/pythran/pythran/pythonic/types/raw_array.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/raw_array.hpp
@@ -21,8 +21,7 @@ namespace types
}
template <class T>
- raw_array<T>::raw_array(size_t n)
- : data(utils::allocate<T>(n)), external(false)
+ raw_array<T>::raw_array(size_t n) : data(utils::allocate<T>(n)), external(false)
{
if (!data) {
std::ostringstream oss;
@@ -32,8 +31,7 @@ namespace types
}
template <class T>
- raw_array<T>::raw_array(T *d, ownership o)
- : data(d), external(o == ownership::external)
+ raw_array<T>::raw_array(T *d, ownership o) : data(d), external(o == ownership::external)
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/set.hpp b/contrib/python/pythran/pythran/pythonic/types/set.hpp
index 7c31ada0ec0..6be2d7f5334 100644
--- a/contrib/python/pythran/pythran/pythonic/types/set.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/set.hpp
@@ -85,30 +85,6 @@ namespace types
return data->end();
}
- template <class T>
- typename set<T>::reverse_iterator set<T>::rbegin()
- {
- return data->rbegin();
- }
-
- template <class T>
- typename set<T>::const_reverse_iterator set<T>::rbegin() const
- {
- return data->rbegin();
- }
-
- template <class T>
- typename set<T>::reverse_iterator set<T>::rend()
- {
- return data->rend();
- }
-
- template <class T>
- typename set<T>::const_reverse_iterator set<T>::rend() const
- {
- return data->rend();
- }
-
// modifiers
template <class T>
T set<T>::pop()
@@ -154,8 +130,7 @@ namespace types
// Remove element elem from the set. Raises KeyError if elem is !
// contained in the set.
if (!data->erase(elem))
- throw std::runtime_error(
- "set.delete() : couldn't delete element ! in the set.");
+ throw std::runtime_error("set.delete() : couldn't delete element ! in the set.");
}
// set interface
@@ -184,7 +159,7 @@ namespace types
bool set<T>::isdisjoint(U const &other) const
{
// Return true if the this has no elements in common with other.
- for (iterator it = begin(); it != end(); ++it) {
+ for (const_iterator it = begin(); it != end(); ++it) {
if (in(other, *it))
return false;
}
@@ -196,7 +171,7 @@ namespace types
bool set<T>::issubset(U const &other) const
{
// Test whether every element in the set is in other.
- for (iterator it = begin(); it != end(); ++it) {
+ for (const_iterator it = begin(); it != end(); ++it) {
if (!in(other, *it))
return false;
}
@@ -219,11 +194,9 @@ namespace types
template <class T>
template <typename U, typename... Types>
- typename __combined<set<T>, U, Types...>::type
- set<T>::union_(U &&other, Types &&...others) const
+ typename __combined<set<T>, U, Types...>::type set<T>::union_(U &&other, Types &&...others) const
{
- typename __combined<set<T>, U, Types...>::type tmp =
- union_(std::forward<Types...>(others)...);
+ typename __combined<set<T>, U, Types...>::type tmp = union_(std::forward<Types...>(others)...);
tmp.data->insert(other.begin(), other.end());
return tmp;
}
@@ -244,16 +217,14 @@ namespace types
template <class T>
template <typename U, typename... Types>
- typename __combined<set<T>, U, Types...>::type
- set<T>::intersection(U const &other, Types const &...others) const
+ typename __combined<set<T>, U, Types...>::type set<T>::intersection(U const &other,
+ Types const &...others) const
{
// Return a new set with elements common to the set && all others.
- typename __combined<set<T>, U, Types...>::type tmp =
- intersection(others...);
+ typename __combined<set<T>, U, Types...>::type tmp = intersection(others...);
for (auto it = begin(); it != end(); ++it) {
if (!in(other, *it))
- tmp.discard(
- *it); // faster than remove() but ! direct interaction with data
+ tmp.discard(*it); // faster than remove() but ! direct interaction with data
}
return tmp;
}
@@ -284,8 +255,7 @@ namespace types
}
*/ // This algo will do several times the same find(), because
// std::set::erase() calls find. Lame!
- for (typename U::const_iterator it = other.begin(); it != other.end();
- ++it) {
+ for (typename U::const_iterator it = other.begin(); it != other.end(); ++it) {
tmp.discard(*it);
}
return tmp;
@@ -307,8 +277,7 @@ namespace types
template <class T>
template <typename U>
- set<typename __combined<T, U>::type>
- set<T>::symmetric_difference(set<U> const &other) const
+ set<typename __combined<T, U>::type> set<T>::symmetric_difference(set<U> const &other) const
{
// Return a new set with elements in either the set || other but ! both.
// return ((*this-other) | (other-*this));
@@ -320,12 +289,11 @@ namespace types
template <class T>
template <typename U>
- typename __combined<U, set<T>>::type
- set<T>::symmetric_difference(U const &other) const
+ typename __combined<U, set<T>>::type set<T>::symmetric_difference(U const &other) const
{
// Return a new set with elements in either the set || other but ! both.
- set<typename std::iterator_traits<typename U::iterator>::value_type> tmp(
- other.begin(), other.end());
+ set<typename std::iterator_traits<typename U::iterator>::value_type> tmp(other.begin(),
+ other.end());
// We must use fcts && ! operators because fcts have to handle any
// iterable objects && operators only sets (cf python ref)
@@ -381,8 +349,7 @@ namespace types
template <class T>
template <class U>
- set<typename __combined<T, U>::type>
- set<T>::operator|(set<U> const &other) const
+ set<typename __combined<T, U>::type> set<T>::operator|(set<U> const &other) const
{
return union_(other);
}
@@ -396,8 +363,7 @@ namespace types
template <class T>
template <class U>
- set<typename __combined<U, T>::type>
- set<T>::operator&(set<U> const &other) const
+ set<typename __combined<U, T>::type> set<T>::operator&(set<U> const &other) const
{
return intersection(other);
}
@@ -425,8 +391,7 @@ namespace types
template <class T>
template <class U>
- set<typename __combined<U, T>::type>
- set<T>::operator^(set<U> const &other) const
+ set<typename __combined<U, T>::type> set<T>::operator^(set<U> const &other) const
{
return symmetric_difference(other);
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/slice.hpp b/contrib/python/pythran/pythran/pythonic/types/slice.hpp
index 5d053247e3e..5c7050b1c6f 100644
--- a/contrib/python/pythran/pythran/pythonic/types/slice.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/slice.hpp
@@ -33,19 +33,16 @@ namespace types
{
}
- inline normalized_slice
- normalized_slice::operator*(normalized_slice const &other) const
+ inline normalized_slice normalized_slice::operator*(normalized_slice const &other) const
{
- return {lower + step * other.lower, lower + step * other.upper,
- step * other.step};
+ return {lower + step * other.lower, lower + step * other.upper, step * other.step};
}
template <long stride>
- inline normalized_slice normalized_slice::operator*(
- cstride_normalized_slice<stride> const &other) const
+ inline normalized_slice
+ normalized_slice::operator*(cstride_normalized_slice<stride> const &other) const
{
- return {lower + step * other.lower, lower + step * other.upper,
- step * other.step};
+ return {lower + step * other.lower, lower + step * other.upper, step * other.step};
}
inline normalized_slice normalized_slice::operator*(slice const &other) const
{
@@ -53,8 +50,7 @@ namespace types
}
template <long stride>
- inline normalized_slice
- normalized_slice::operator*(cstride_slice<stride> const &other) const
+ inline normalized_slice normalized_slice::operator*(cstride_slice<stride> const &other) const
{
return (*this) * other.normalize(size());
}
@@ -74,8 +70,7 @@ namespace types
{
}
- inline slice::slice()
- : lower(builtins::None), upper(builtins::None), step(builtins::None)
+ inline slice::slice() : lower(builtins::None), upper(builtins::None), step(builtins::None)
{
}
@@ -86,10 +81,10 @@ namespace types
// TODO: We can skip these constraints if we know begin, end && step.
long sstep = (step.is_none()) ? 1 : (long)step;
long ostep = (other.step.is_none()) ? 1 : (long)other.step;
- assert(!((ostep < 0 || static_cast<long>(other.upper) < 0 ||
- static_cast<long>(other.lower) < 0) &&
- sstep != 1 && sstep != -1) &&
- "not implemented");
+ assert(
+ !((ostep < 0 || static_cast<long>(other.upper) < 0 || static_cast<long>(other.lower) < 0) &&
+ sstep != 1 && sstep != -1) &&
+ "not implemented");
bound<long> new_lower;
if (other.lower.is_none() || (long)other.lower == 0) {
if (ostep > 0)
@@ -217,57 +212,46 @@ namespace types
//
template <long stride>
- inline cstride_normalized_slice<stride>::cstride_normalized_slice(long lower,
- long upper,
- long)
+ inline cstride_normalized_slice<stride>::cstride_normalized_slice(long lower, long upper, long)
: lower(lower), upper(upper)
{
}
template <long stride>
- inline normalized_slice cstride_normalized_slice<stride>::operator*(
- normalized_slice const &other) const
+ inline normalized_slice
+ cstride_normalized_slice<stride>::operator*(normalized_slice const &other) const
{
- return {lower + step * other.lower, lower + step * other.upper,
- step * other.step};
+ return {lower + step * other.lower, lower + step * other.upper, step * other.step};
}
template <long stride>
template <long other_stride>
- inline
- typename std::conditional<(stride < 256 && other_stride < 256),
- cstride_normalized_slice<stride * other_stride>,
- normalized_slice>::type
- cstride_normalized_slice<stride>::operator*(
- cstride_normalized_slice<other_stride> const &other) const
+ inline std::conditional_t<(stride < 256 && other_stride < 256),
+ cstride_normalized_slice<stride * other_stride>, normalized_slice>
+ cstride_normalized_slice<stride>::operator*(
+ cstride_normalized_slice<other_stride> const &other) const
{
- return {lower + step * other.lower, lower + step * other.upper,
- step * other.step};
+ return {lower + step * other.lower, lower + step * other.upper, step * other.step};
}
template <long stride>
- inline normalized_slice
- cstride_normalized_slice<stride>::operator*(slice const &other) const
+ inline normalized_slice cstride_normalized_slice<stride>::operator*(slice const &other) const
{
return (*this) * other.normalize(size());
}
template <long stride>
inline cstride_normalized_slice<stride>
- cstride_normalized_slice<stride>::operator*(
- fast_contiguous_slice const &other) const
+ cstride_normalized_slice<stride>::operator*(fast_contiguous_slice const &other) const
{
return (*this) * other.normalize(size());
}
template <long stride>
template <long other_stride>
- inline
- typename std::conditional<(stride < 256 && other_stride < 256),
- cstride_normalized_slice<stride * other_stride>,
- normalized_slice>::type
- cstride_normalized_slice<stride>::operator*(
- cstride_slice<other_stride> const &other) const
+ inline std::conditional_t<(stride < 256 && other_stride < 256),
+ cstride_normalized_slice<stride * other_stride>, normalized_slice>
+ cstride_normalized_slice<stride>::operator*(cstride_slice<other_stride> const &other) const
{
return (*this) * other.normalize(size());
}
@@ -285,15 +269,13 @@ namespace types
}
template <long stride>
- inline cstride_slice<stride>::cstride_slice(none<long> lower,
- none<long> upper)
+ inline cstride_slice<stride>::cstride_slice(none<long> lower, none<long> upper)
: lower(lower), upper(upper)
{
}
template <long stride>
- inline cstride_slice<stride>::cstride_slice()
- : lower(builtins::None), upper(builtins::None)
+ inline cstride_slice<stride>::cstride_slice() : lower(builtins::None), upper(builtins::None)
{
}
@@ -346,11 +328,9 @@ namespace types
template <long stride>
template <long other_stride>
- inline typename std::conditional<(stride < 256 && other_stride < 256),
- cstride_slice<stride * other_stride>,
- slice>::type
- cstride_slice<stride>::operator*(
- cstride_slice<other_stride> const &other) const
+ inline std::conditional_t<(stride < 256 && other_stride < 256),
+ cstride_slice<stride * other_stride>, slice>
+ cstride_slice<stride>::operator*(cstride_slice<other_stride> const &other) const
{
bound<long> new_lower;
if (other.lower.is_none() || (long)other.lower == 0) {
@@ -384,8 +364,7 @@ namespace types
container
*/
template <long stride>
- inline cstride_normalized_slice<stride>
- cstride_slice<stride>::normalize(long max_size) const
+ inline cstride_normalized_slice<stride> cstride_slice<stride>::normalize(long max_size) const
{
long normalized_upper;
if (upper.is_none()) {
@@ -467,8 +446,7 @@ namespace types
return {new_lower, new_upper};
}
- inline fast_contiguous_slice::fast_contiguous_slice(none<long> lower,
- none<long> upper)
+ inline fast_contiguous_slice::fast_contiguous_slice(none<long> lower, none<long> upper)
: lower(lower.is_none ? 0 : (long)lower), upper(upper)
{
}
@@ -533,8 +511,7 @@ namespace types
It also check for value bigger than len(a) to fit the size of the
container
*/
- inline cstride_normalized_slice<1>
- fast_contiguous_slice::normalize(long max_size) const
+ inline cstride_normalized_slice<1> fast_contiguous_slice::normalize(long max_size) const
{
long normalized_upper;
if (upper.is_none())
@@ -565,11 +542,9 @@ namespace types
return (b.is_none() ? (os << "None") : (os << (T)b));
}
template <class S>
- typename std::enable_if<is_slice<S>::value, std::ostream &>::type
- operator<<(std::ostream &os, S const &s)
+ std::enable_if_t<is_slice<S>::value, std::ostream &> operator<<(std::ostream &os, S const &s)
{
- return os << "slice(" << s.lower << ", " << s.upper << ", " << s.step
- << ")";
+ return os << "slice(" << s.lower << ", " << s.upper << ", " << s.step << ")";
}
} // namespace types
PYTHONIC_NS_END
@@ -590,28 +565,23 @@ template <long stride>
inline PyObject *to_python<types::cstride_normalized_slice<stride>>::convert(
types::cstride_normalized_slice<stride> const &v)
{
- return PySlice_New(::to_python(v.lower), ::to_python(v.upper),
- ::to_python(v.step));
+ return PySlice_New(::to_python(v.lower), ::to_python(v.upper), ::to_python(v.step));
}
template <long stride>
-inline PyObject *to_python<types::cstride_slice<stride>>::convert(
- types::cstride_slice<stride> const &v)
+inline PyObject *
+to_python<types::cstride_slice<stride>>::convert(types::cstride_slice<stride> const &v)
{
- return PySlice_New(::to_python(v.lower), ::to_python(v.upper),
- ::to_python(v.step));
+ return PySlice_New(::to_python(v.lower), ::to_python(v.upper), ::to_python(v.step));
}
-inline PyObject *
-to_python<types::normalized_slice>::convert(types::normalized_slice const &v)
+inline PyObject *to_python<types::normalized_slice>::convert(types::normalized_slice const &v)
{
if (v.step > 0) {
- return PySlice_New(::to_python(v.lower), ::to_python(v.upper),
- ::to_python(v.step));
+ return PySlice_New(::to_python(v.lower), ::to_python(v.upper), ::to_python(v.step));
} else {
return PySlice_New(::to_python(v.lower),
- v.upper < 0 ? ::to_python(types::none_type{})
- : ::to_python(v.upper),
+ v.upper < 0 ? ::to_python(types::none_type{}) : ::to_python(v.upper),
::to_python(v.step));
}
}
@@ -619,12 +589,10 @@ to_python<types::normalized_slice>::convert(types::normalized_slice const &v)
inline PyObject *to_python<types::slice>::convert(types::slice const &v)
{
if (v.step > 0) {
- return PySlice_New(::to_python(v.lower), ::to_python(v.upper),
- ::to_python(v.step));
+ return PySlice_New(::to_python(v.lower), ::to_python(v.upper), ::to_python(v.step));
} else {
return PySlice_New(::to_python(v.lower),
- v.upper < 0 ? ::to_python(types::none_type{})
- : ::to_python(v.upper),
+ v.upper < 0 ? ::to_python(types::none_type{}) : ::to_python(v.upper),
::to_python(v.step));
}
}
@@ -637,15 +605,14 @@ inline bool from_python<types::slice>::is_convertible(PyObject *obj)
inline types::slice from_python<types::slice>::convert(PyObject *obj)
{
Py_ssize_t start, stop, step;
-#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 6) || \
- (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 6 && \
- PY_MICRO_VERSION >= 1 && !defined(PYPY_VERSION))
+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 6) || \
+ (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 6 && PY_MICRO_VERSION >= 1 && \
+ !defined(PYPY_VERSION))
PySlice_Unpack(obj, &start, &stop, &step);
#elif PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 1
PySlice_GetIndices((PyObject *)obj, PY_SSIZE_T_MAX, &start, &stop, &step);
#else
- PySlice_GetIndices((PySliceObject *)obj, PY_SSIZE_T_MAX, &start, &stop,
- &step);
+ PySlice_GetIndices((PySliceObject *)obj, PY_SSIZE_T_MAX, &start, &stop, &step);
#endif
types::none<long> nstart, nstop, nstep;
if (start != PY_SSIZE_T_MAX)
diff --git a/contrib/python/pythran/pythran/pythonic/types/str.hpp b/contrib/python/pythran/pythran/pythonic/types/str.hpp
index e5dbe6083b1..a7dd51af849 100644
--- a/contrib/python/pythran/pythran/pythonic/types/str.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/str.hpp
@@ -27,8 +27,7 @@ namespace types
}
/// const_sliced_str_iterator implementation
- inline const_sliced_str_iterator::const_sliced_str_iterator(char const *data,
- long step)
+ inline const_sliced_str_iterator::const_sliced_str_iterator(char const *data, long step)
: data(data), step(step)
{
}
@@ -39,20 +38,17 @@ namespace types
return *this;
}
- inline bool const_sliced_str_iterator::operator<(
- const_sliced_str_iterator const &other) const
+ inline bool const_sliced_str_iterator::operator<(const_sliced_str_iterator const &other) const
{
return (step > 0) ? (data < other.data) : (data > other.data);
}
- inline bool const_sliced_str_iterator::operator==(
- const_sliced_str_iterator const &other) const
+ inline bool const_sliced_str_iterator::operator==(const_sliced_str_iterator const &other) const
{
return data == other.data;
}
- inline bool const_sliced_str_iterator::operator!=(
- const_sliced_str_iterator const &other) const
+ inline bool const_sliced_str_iterator::operator!=(const_sliced_str_iterator const &other) const
{
return data != other.data;
}
@@ -62,16 +58,14 @@ namespace types
return (*data);
}
- inline const_sliced_str_iterator
- const_sliced_str_iterator::operator-(long n) const
+ inline const_sliced_str_iterator const_sliced_str_iterator::operator-(long n) const
{
const_sliced_str_iterator other(*this);
other.data -= step * n;
return other;
}
- inline long const_sliced_str_iterator::operator-(
- const_sliced_str_iterator const &other) const
+ inline long const_sliced_str_iterator::operator-(const_sliced_str_iterator const &other) const
{
return (data - other.data) / step;
}
@@ -84,21 +78,18 @@ namespace types
}
template <class S>
- sliced_str<S>::sliced_str(sliced_str const &s)
- : data(s.data), slicing(s.slicing)
+ sliced_str<S>::sliced_str(sliced_str const &s) : data(s.data), slicing(s.slicing)
{
}
template <class S>
- sliced_str<S>::sliced_str(sliced_str const &s,
- typename S::normalized_type const &sl)
+ sliced_str<S>::sliced_str(sliced_str const &s, typename S::normalized_type const &sl)
: data(s.data), slicing(s.slicing * sl)
{
}
template <class S>
- sliced_str<S>::sliced_str(str const &other,
- typename S::normalized_type const &s)
+ sliced_str<S>::sliced_str(str const &other, typename S::normalized_type const &s)
: data(other.data), slicing(s)
{
}
@@ -120,15 +111,13 @@ namespace types
template <class S>
typename sliced_str<S>::const_iterator sliced_str<S>::begin() const
{
- return typename sliced_str<S>::const_iterator(data->c_str() + slicing.lower,
- slicing.step);
+ return typename sliced_str<S>::const_iterator(data->c_str() + slicing.lower, slicing.step);
}
template <class S>
typename sliced_str<S>::const_iterator sliced_str<S>::end() const
{
- return typename sliced_str<S>::const_iterator(data->c_str() + slicing.upper,
- slicing.step);
+ return typename sliced_str<S>::const_iterator(data->c_str() + slicing.upper, slicing.step);
}
// size
@@ -156,8 +145,7 @@ namespace types
template <class S>
template <class Sp>
- typename std::enable_if<is_slice<Sp>::value, sliced_str<Sp>>::type
- sliced_str<S>::operator[](Sp const &s) const
+ std::enable_if_t<is_slice<Sp>::value, sliced_str<Sp>> sliced_str<S>::operator[](Sp const &s) const
{
return {*this, s.normalize(size())};
}
@@ -206,8 +194,7 @@ namespace types
{
if (size() != v.size())
return false;
- for (char const *iter = data->c_str() + slicing.lower,
- *end = data->c_str() + slicing.upper,
+ for (char const *iter = data->c_str() + slicing.lower, *end = data->c_str() + slicing.upper,
*oter = v.data->c_str();
iter < end; iter += slicing.step, ++oter)
if (*iter != *oter)
@@ -369,8 +356,7 @@ namespace types
if (other_size > size())
resize(other_size);
- for (long i = other_slice.lower; i < other_slice.upper;
- i = i + other_slice.step, j++)
+ for (long i = other_slice.lower; i < other_slice.upper; i = i + other_slice.step, j++)
my_data[j] = other_data[i];
if (j < size())
resize(j);
@@ -525,8 +511,7 @@ namespace types
{
if (size() != other.size())
return false;
- for (long i = other.get_slice().lower, j = 0L; j < size();
- i = i + other.get_slice().step, j++)
+ for (long i = other.get_slice().lower, j = 0L; j < size(); i = i + other.get_slice().step, j++)
if (other.get_data()[i] != chars()[j])
return false;
return true;
@@ -537,8 +522,7 @@ namespace types
}
template <class S>
- typename std::enable_if<is_slice<S>::value, sliced_str<S>>::type
- str::operator()(S const &s) const
+ std::enable_if_t<is_slice<S>::value, sliced_str<S>> str::operator()(S const &s) const
{
return operator[](s);
}
@@ -556,8 +540,7 @@ namespace types
}
template <class S>
- typename std::enable_if<is_slice<S>::value, sliced_str<S>>::type
- str::operator[](S const &s) const
+ std::enable_if_t<is_slice<S>::value, sliced_str<S>> str::operator[](S const &s) const
{
return {*this, s.normalize(size())};
}
@@ -689,8 +672,7 @@ namespace operator_
{
template <size_t N, class Arg>
- auto mod(const char (&fmt)[N],
- Arg &&arg) -> decltype(types::str(fmt) % std::forward<Arg>(arg))
+ auto mod(const char (&fmt)[N], Arg &&arg) -> decltype(types::str(fmt) % std::forward<Arg>(arg))
{
return types::str(fmt) % std::forward<Arg>(arg);
}
@@ -717,14 +699,12 @@ PYTHONIC_NS_END
namespace std
{
- inline size_t
- hash<pythonic::types::str>::operator()(const pythonic::types::str &x) const
+ inline size_t hash<pythonic::types::str>::operator()(const pythonic::types::str &x) const
{
return hash<std::string>()(x.chars());
}
- inline size_t
- hash<pythonic::types::chr>::operator()(const pythonic::types::chr &x) const
+ inline size_t hash<pythonic::types::chr>::operator()(const pythonic::types::chr &x) const
{
return x.c;
}
@@ -739,13 +719,26 @@ namespace std
#ifndef PyString_FromStringAndSize
#define PyString_FromStringAndSize PyUnicode_FromStringAndSize
+#endif
+#ifdef Py_LIMITED_API
+#define PyString_Check(x) \
+ (PyUnicode_Check(x) && [x]() { \
+ PyObject *tmp = PyUnicode_AsASCIIString(x); \
+ bool res = tmp != nullptr; \
+ Py_DECREF(tmp); \
+ PyErr_Clear(); \
+ return res; \
+ }())
+#else
#ifndef PyString_Check
-#define PyString_Check(x) PyUnicode_Check(x) && PyUnicode_IS_COMPACT_ASCII(x)
+#define PyString_Check(x) (PyUnicode_Check(x) && PyUnicode_IS_COMPACT_ASCII(x))
#endif
-#ifndef PyString_AS_STRING
-#define PyString_AS_STRING (char *)_PyUnicode_COMPACT_DATA
#endif
+
+#ifdef Py_LIMITED_API
+#define PyString_GET_SIZE PyUnicode_GetLength
+#else
#ifndef PyString_GET_SIZE
#define PyString_GET_SIZE PyUnicode_GET_LENGTH
#endif
@@ -764,8 +757,7 @@ inline PyObject *to_python<types::chr>::convert(types::chr const &v)
}
template <class S>
-PyObject *
-to_python<types::sliced_str<S>>::convert(types::sliced_str<S> const &v)
+PyObject *to_python<types::sliced_str<S>>::convert(types::sliced_str<S> const &v)
{
return ::to_python(types::str(v));
}
diff --git a/contrib/python/pythran/pythran/pythonic/types/tuple.hpp b/contrib/python/pythran/pythran/pythonic/types/tuple.hpp
index a91670a2f1c..10222a7fbef 100644
--- a/contrib/python/pythran/pythran/pythonic/types/tuple.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/tuple.hpp
@@ -51,11 +51,9 @@ std::tuple<Types0..., Types1...> operator+(std::tuple<Types0...> const &t0,
}
template <class... Types0, class... Types1>
-std::tuple<Types0..., Types1...> operator+(std::tuple<Types0...> &&t0,
- std::tuple<Types1...> &&t1)
+std::tuple<Types0..., Types1...> operator+(std::tuple<Types0...> &&t0, std::tuple<Types1...> &&t1)
{
- return std::tuple_cat(std::forward<Types0...>(t0),
- std::forward<Types1...>(t1));
+ return std::tuple_cat(std::forward<Types0...>(t0), std::forward<Types1...>(t1));
}
PYTHONIC_NS_BEGIN
@@ -69,12 +67,11 @@ namespace types
template <class S, class... Stail>
std::tuple<Stail...> tuple_tail(std::tuple<S, Stail...> const &t)
{
- return make_tuple_tail<0>(t,
- utils::make_index_sequence<sizeof...(Stail)>{});
+ return make_tuple_tail<0>(t, std::make_index_sequence<sizeof...(Stail)>{});
}
template <class T, size_t N, class V, class A, size_t... I>
- array_base<T, N, V> array_to_array(A const &a, utils::index_sequence<I...>)
+ array_base<T, N, V> array_to_array(A const &a, std::index_sequence<I...>)
{
return {(T)std::get<I>(a)...};
}
@@ -120,8 +117,7 @@ namespace types
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_iterator
- array_base<T, N, V>::begin() const noexcept
+ typename array_base<T, N, V>::const_iterator array_base<T, N, V>::begin() const noexcept
{
return {data()};
}
@@ -133,79 +129,68 @@ namespace types
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_iterator
- array_base<T, N, V>::end() const noexcept
+ typename array_base<T, N, V>::const_iterator array_base<T, N, V>::end() const noexcept
{
return {data() + N};
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::reverse_iterator
- array_base<T, N, V>::rbegin() noexcept
+ typename array_base<T, N, V>::reverse_iterator array_base<T, N, V>::rbegin() noexcept
{
return reverse_iterator(end());
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_reverse_iterator
- array_base<T, N, V>::rbegin() const noexcept
+ typename array_base<T, N, V>::const_reverse_iterator array_base<T, N, V>::rbegin() const noexcept
{
return const_reverse_iterator(end());
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::reverse_iterator
- array_base<T, N, V>::rend() noexcept
+ typename array_base<T, N, V>::reverse_iterator array_base<T, N, V>::rend() noexcept
{
return reverse_iterator(begin());
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_reverse_iterator
- array_base<T, N, V>::rend() const noexcept
+ typename array_base<T, N, V>::const_reverse_iterator array_base<T, N, V>::rend() const noexcept
{
return const_reverse_iterator(begin());
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_iterator
- array_base<T, N, V>::cbegin() const noexcept
+ typename array_base<T, N, V>::const_iterator array_base<T, N, V>::cbegin() const noexcept
{
return {&(buffer[0])};
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_iterator
- array_base<T, N, V>::cend() const noexcept
+ typename array_base<T, N, V>::const_iterator array_base<T, N, V>::cend() const noexcept
{
return {&(buffer[N])};
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_reverse_iterator
- array_base<T, N, V>::crbegin() const noexcept
+ typename array_base<T, N, V>::const_reverse_iterator array_base<T, N, V>::crbegin() const noexcept
{
return const_reverse_iterator(end());
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_reverse_iterator
- array_base<T, N, V>::crend() const noexcept
+ typename array_base<T, N, V>::const_reverse_iterator array_base<T, N, V>::crend() const noexcept
{
return const_reverse_iterator(begin());
}
// Capacity.
template <typename T, size_t N, class V>
- constexpr typename array_base<T, N, V>::size_type
- array_base<T, N, V>::size() const noexcept
+ constexpr typename array_base<T, N, V>::size_type array_base<T, N, V>::size() const noexcept
{
return N;
}
template <typename T, size_t N, class V>
- constexpr typename array_base<T, N, V>::size_type
- array_base<T, N, V>::max_size() const noexcept
+ constexpr typename array_base<T, N, V>::size_type array_base<T, N, V>::max_size() const noexcept
{
return N;
}
@@ -225,8 +210,7 @@ namespace types
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_reference
- array_base<T, N, V>::fast(long n) const noexcept
+ typename array_base<T, N, V>::const_reference array_base<T, N, V>::fast(long n) const noexcept
{
assert(n < (long)size());
return buffer[n];
@@ -235,16 +219,14 @@ namespace types
#ifdef USE_XSIMD
template <typename T, size_t N, class V>
template <class vectorizer>
- typename array_base<T, N, V>::simd_iterator
- array_base<T, N, V>::vbegin(vectorizer) const
+ typename array_base<T, N, V>::simd_iterator array_base<T, N, V>::vbegin(vectorizer) const
{
return {&buffer[0]};
}
template <typename T, size_t N, class V>
template <class vectorizer>
- typename array_base<T, N, V>::simd_iterator
- array_base<T, N, V>::vend(vectorizer) const
+ typename array_base<T, N, V>::simd_iterator array_base<T, N, V>::vend(vectorizer) const
{
using vector_type = typename xsimd::batch<dtype>;
static const std::size_t vector_size = vector_type::size;
@@ -253,8 +235,7 @@ namespace types
#endif
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::reference
- array_base<T, N, V>::operator[](long __n)
+ typename array_base<T, N, V>::reference array_base<T, N, V>::operator[](long __n)
{
auto const index = __n < 0 ? (__n + size()) : __n;
assert(0 <= index && index < size());
@@ -277,8 +258,7 @@ namespace types
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_reference
- array_base<T, N, V>::front() const
+ typename array_base<T, N, V>::const_reference array_base<T, N, V>::front() const
{
return *begin();
}
@@ -290,8 +270,7 @@ namespace types
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_reference
- array_base<T, N, V>::back() const
+ typename array_base<T, N, V>::const_reference array_base<T, N, V>::back() const
{
return N ? *(end() - 1) : *end();
}
@@ -303,8 +282,7 @@ namespace types
}
template <typename T, size_t N, class V>
- typename array_base<T, N, V>::const_pointer
- array_base<T, N, V>::data() const noexcept
+ typename array_base<T, N, V>::const_pointer array_base<T, N, V>::data() const noexcept
{
return &(buffer[0]);
}
@@ -327,8 +305,7 @@ namespace types
template <size_t M>
bool array_base<T, N, V>::operator<(array_base<T, M, V> const &other) const
{
- return std::lexicographical_compare(begin(), end(), other.begin(),
- other.end());
+ return std::lexicographical_compare(begin(), end(), other.begin(), other.end());
}
template <typename T, size_t N, class V>
@@ -345,23 +322,22 @@ namespace types
template <class... Types>
array_base<T, N, V>::operator std::tuple<Types...>() const
{
- return array_to_tuple(*this, utils::make_index_sequence<N>{},
+ return array_to_tuple(*this, std::make_index_sequence<N>{},
typename utils::type_sequence<Types...>{});
}
template <typename T, size_t N, class V>
template <typename Tp>
array_base<T, N, V>::operator array_base<Tp, N, V>() const
{
- return array_to_array<Tp, N, V>(*this, utils::make_index_sequence<N>{});
+ return array_to_array<Tp, N, V>(*this, std::make_index_sequence<N>{});
}
template <typename T, size_t N, class V>
auto array_base<T, N, V>::to_tuple() const
- -> decltype(array_to_tuple(*this, utils::make_index_sequence<N>{},
+ -> decltype(array_to_tuple(*this, std::make_index_sequence<N>{},
utils::make_repeated_type<T, N>()))
{
- return array_to_tuple(*this, utils::make_index_sequence<N>{},
- utils::make_repeated_type<T, N>());
+ return array_to_tuple(*this, std::make_index_sequence<N>{}, utils::make_repeated_type<T, N>());
}
template <typename T, size_t N, class V>
@@ -373,8 +349,7 @@ namespace types
/* array */
template <typename T, size_t N, class V>
- std::ostream &operator<<(std::ostream &os,
- types::array_base<T, N, V> const &v)
+ std::ostream &operator<<(std::ostream &os, types::array_base<T, N, V> const &v)
{
os << "(["[std::is_same<V, types::list_version>::value];
auto iter = v.begin();
@@ -387,24 +362,21 @@ namespace types
}
template <class T, size_t N, class V, class... Types>
- auto operator+(std::tuple<Types...> const &t,
- types::array_base<T, N, V> const &lt)
+ auto operator+(std::tuple<Types...> const &t, types::array_base<T, N, V> const &lt)
-> decltype(std::tuple_cat(t, lt.to_tuple()))
{
return std::tuple_cat(t, lt.to_tuple());
}
template <class T, size_t N, class V, class... Types>
- auto operator+(types::array_base<T, N, V> const &lt,
- std::tuple<Types...> const &t)
+ auto operator+(types::array_base<T, N, V> const &lt, std::tuple<Types...> const &t)
-> decltype(std::tuple_cat(lt.to_tuple(), t))
{
return std::tuple_cat(lt.to_tuple(), t);
}
template <class T, size_t N>
- dynamic_tuple<T> array_base_slicer::operator()(array_tuple<T, N> const &b,
- slice const &s)
+ dynamic_tuple<T> array_base_slicer::operator()(array_tuple<T, N> const &b, slice const &s)
{
normalized_slice ns = s.normalize(b.size());
array_tuple<T, N> tmp;
@@ -450,22 +422,18 @@ namespace
}
template <size_t index, class... types>
- size_t
- hash_impl<index, types...>::operator()(size_t a,
- const std::tuple<types...> &t) const
+ size_t hash_impl<index, types...>::operator()(size_t a, const std::tuple<types...> &t) const
{
- using nexttype =
- typename std::tuple_element<index, std::tuple<types...>>::type;
+ using nexttype = std::tuple_element_t<index, std::tuple<types...>>;
hash_impl<index - 1, types...> next;
size_t b = std::hash<nexttype>()(std::get<index>(t));
return next(hash_combiner(a, b), t);
}
template <class... types>
- size_t hash_impl<0, types...>::operator()(size_t a,
- const std::tuple<types...> &t) const
+ size_t hash_impl<0, types...>::operator()(size_t a, const std::tuple<types...> &t) const
{
- using nexttype = typename std::tuple_element<0, std::tuple<types...>>::type;
+ using nexttype = std::tuple_element_t<0, std::tuple<types...>>;
size_t b = std::hash<nexttype>()(std::get<0>(t));
return hash_combiner(a, b);
}
@@ -475,8 +443,7 @@ namespace
namespace std
{
template <class... Types>
- size_t
- hash<std::tuple<Types...>>::operator()(std::tuple<Types...> const &t) const
+ size_t hash<std::tuple<Types...>>::operator()(std::tuple<Types...> const &t) const
{
const size_t begin = std::tuple_size<std::tuple<Types...>>::value - 1;
return hash_impl<begin, Types...>()(1, t); // 1 should be some largervalue
@@ -519,8 +486,7 @@ namespace std
ostream &operator<<(ostream &os, tuple<Args...> const &t)
{
os << '(';
- pythonic::types::print_tuple(os, t,
- pythonic::utils::int_<sizeof...(Args) - 1>());
+ pythonic::types::print_tuple(os, t, pythonic::utils::int_<sizeof...(Args) - 1>());
return os << ')';
}
} // namespace std
@@ -532,6 +498,11 @@ namespace std
PYTHONIC_NS_BEGIN
+#ifdef Py_LIMITED_API
+#define PyTuple_SET_ITEM PyTuple_SetItem
+#define PyList_SET_ITEM PyList_SetItem
+#endif
+
template <typename K, typename V>
PyObject *to_python<std::pair<K, V>>::convert(std::pair<K, V> const &t)
{
@@ -542,8 +513,7 @@ PyObject *to_python<std::pair<K, V>>::convert(std::pair<K, V> const &t)
}
template <typename... Tys>
-PyObject *
-to_python<types::pshape<Tys...>>::convert(types::pshape<Tys...> const &t)
+PyObject *to_python<types::pshape<Tys...>>::convert(types::pshape<Tys...> const &t)
{
return ::to_python(t.array());
}
@@ -552,7 +522,7 @@ template <typename... Types>
template <size_t... S>
PyObject *to_python<std::tuple<Types...>>::
- do_convert(std::tuple<Types...> const &t, utils::index_sequence<S...>)
+ do_convert(std::tuple<Types...> const &t, std::index_sequence<S...>)
{
PyObject *out = PyTuple_New(sizeof...(Types));
(void)std::initializer_list<bool>{
@@ -561,16 +531,15 @@ PyObject *to_python<std::tuple<Types...>>::
}
template <typename... Types>
-PyObject *
-to_python<std::tuple<Types...>>::convert(std::tuple<Types...> const &t)
+PyObject *to_python<std::tuple<Types...>>::convert(std::tuple<Types...> const &t)
{
- return do_convert(t, utils::make_index_sequence<sizeof...(Types)>());
+ return do_convert(t, std::make_index_sequence<sizeof...(Types)>());
}
template <typename T, size_t N>
template <size_t... S>
-PyObject *to_python<types::array_tuple<T, N>>::do_convert(
- types::array_tuple<T, N> const &t, utils::index_sequence<S...>)
+PyObject *to_python<types::array_tuple<T, N>>::do_convert(types::array_tuple<T, N> const &t,
+ std::index_sequence<S...>)
{
PyObject *out = PyTuple_New(N);
(void)std::initializer_list<bool>{
@@ -580,8 +549,8 @@ PyObject *to_python<types::array_tuple<T, N>>::do_convert(
template <typename T, size_t N>
template <size_t... S>
-PyObject *to_python<types::static_list<T, N>>::do_convert(
- types::static_list<T, N> const &t, utils::index_sequence<S...>)
+PyObject *to_python<types::static_list<T, N>>::do_convert(types::static_list<T, N> const &t,
+ std::index_sequence<S...>)
{
PyObject *out = PyList_New(N);
(void)std::initializer_list<bool>{
@@ -590,40 +559,44 @@ PyObject *to_python<types::static_list<T, N>>::do_convert(
}
template <typename T, size_t N>
-PyObject *
-to_python<types::array_tuple<T, N>>::convert(types::array_tuple<T, N> const &t)
+PyObject *to_python<types::array_tuple<T, N>>::convert(types::array_tuple<T, N> const &t)
{
- return do_convert(t, utils::make_index_sequence<N>());
+ return do_convert(t, std::make_index_sequence<N>());
}
template <typename T, size_t N>
-PyObject *
-to_python<types::static_list<T, N>>::convert(types::static_list<T, N> const &t)
+PyObject *to_python<types::static_list<T, N>>::convert(types::static_list<T, N> const &t)
{
- return do_convert(t, utils::make_index_sequence<N>());
+ return do_convert(t, std::make_index_sequence<N>());
}
template <typename... Types>
template <size_t... S>
bool from_python<std::tuple<Types...>>
- ::do_is_convertible(PyObject *obj, typename utils::index_sequence<S...>)
+ ::do_is_convertible(PyObject *obj, typename std::index_sequence<S...>)
{
- bool checks[] = {::is_convertible<
- typename std::tuple_element<S, std::tuple<Types...>>::type>(
- PyTuple_GET_ITEM(obj, S))...};
- return std::find(std::begin(checks), std::end(checks), false) ==
- std::end(checks);
+ bool checks[] = {::is_convertible<std::tuple_element_t<S, std::tuple<Types...>>>(
+#ifdef Py_LIMITED_API
+ PyTuple_GetItem(obj, S)
+#else
+ PyTuple_GET_ITEM(obj, S)
+#endif
+ )...};
+ return std::find(std::begin(checks), std::end(checks), false) == std::end(checks);
}
template <typename... Types>
bool from_python<std::tuple<Types...>>::is_convertible(PyObject *obj)
{
if (PyTuple_Check(obj)) {
+#ifdef Py_LIMITED_API
+ auto n = PyTuple_Size(obj);
+#else
auto n = PyTuple_GET_SIZE(obj);
+#endif
if (n == sizeof...(Types)) {
- return do_is_convertible(obj,
- utils::make_index_sequence<sizeof...(Types)>());
+ return do_is_convertible(obj, std::make_index_sequence<sizeof...(Types)>());
}
}
return false;
@@ -631,17 +604,21 @@ bool from_python<std::tuple<Types...>>::is_convertible(PyObject *obj)
template <typename... Types>
template <size_t... S>
-std::tuple<Types...> from_python<std::tuple<Types...>>::do_convert(
- PyObject *obj, typename utils::index_sequence<S...>)
+std::tuple<Types...>
+from_python<std::tuple<Types...>>::do_convert(PyObject *obj, typename std::index_sequence<S...>)
{
- return std::tuple<Types...>{
- ::from_python<typename std::tuple_element<S, std::tuple<Types...>>::type>(
- PyTuple_GET_ITEM(obj, S))...};
+ return std::tuple<Types...>{::from_python<std::tuple_element_t<S, std::tuple<Types...>>>(
+#ifdef Py_LIMITED_API
+ PyTuple_GetItem(obj, S)
+#else
+ PyTuple_GET_ITEM(obj, S)
+#endif
+ )...};
}
template <typename... Types>
std::tuple<Types...> from_python<std::tuple<Types...>>::convert(PyObject *obj)
{
- return do_convert(obj, utils::make_index_sequence<sizeof...(Types)>());
+ return do_convert(obj, std::make_index_sequence<sizeof...(Types)>());
}
template <typename T, size_t N>
@@ -650,9 +627,19 @@ bool from_python<types::array_tuple<T, N>>::
is_convertible(PyObject *obj)
{
if (PyTuple_Check(obj)) {
+#ifdef Py_LIMITED_API
+ auto n = PyTuple_Size(obj);
+#else
auto n = PyTuple_GET_SIZE(obj);
+#endif
if (n == N) {
- return ::is_convertible<T>(PyTuple_GET_ITEM(obj, 0));
+ return ::is_convertible<T>(
+#ifdef Py_LIMITED_API
+ PyTuple_GetItem(obj, 0)
+#else
+ PyTuple_GET_ITEM(obj, 0)
+#endif
+ );
}
}
return false;
@@ -660,18 +647,29 @@ bool from_python<types::array_tuple<T, N>>::
template <typename T, size_t N>
template <size_t... S>
-types::array_tuple<T, N> from_python<types::array_tuple<T, N>>::do_convert(
- PyObject *obj, typename utils::index_sequence<S...>)
+types::array_tuple<T, N>
+from_python<types::array_tuple<T, N>>::do_convert(PyObject *obj, typename std::index_sequence<S...>)
{
- return {::from_python<T>(PyTuple_GET_ITEM(obj, S))...};
+ return {::from_python<T>(
+#ifdef Py_LIMITED_API
+ PyTuple_GetItem(obj, S)
+#else
+ PyTuple_GET_ITEM(obj, S)
+#endif
+ )...};
}
template <typename T, size_t N>
types::array_tuple<T, N> from_python<types::array_tuple<T, N>>::
convert(PyObject *obj)
{
- return do_convert(obj, utils::make_index_sequence<N>());
+ return do_convert(obj, std::make_index_sequence<N>());
}
+
+#ifdef Py_LIMITED_API
+#undef PyTuple_SET_ITEM
+#undef PyList_SET_ITEM
+#endif
PYTHONIC_NS_END
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/types/type.hpp b/contrib/python/pythran/pythran/pythonic/types/type.hpp
new file mode 100644
index 00000000000..97e75c467bc
--- /dev/null
+++ b/contrib/python/pythran/pythran/pythonic/types/type.hpp
@@ -0,0 +1,161 @@
+#ifndef PYTHONIC_TYPES_TYPE_HPP
+#define PYTHONIC_TYPES_TYPE_HPP
+
+#include "pythonic/include/types/type.hpp"
+
+#include "pythonic/builtins/bool_.hpp"
+#include "pythonic/builtins/complex.hpp"
+#include "pythonic/builtins/dict.hpp"
+#include "pythonic/builtins/float_.hpp"
+#include "pythonic/builtins/int_.hpp"
+#include "pythonic/builtins/list.hpp"
+#include "pythonic/builtins/set.hpp"
+#include "pythonic/builtins/slice.hpp"
+#include "pythonic/builtins/str.hpp"
+#include "pythonic/builtins/tuple.hpp"
+#include "pythonic/numpy/array.hpp"
+#include "pythonic/numpy/byte.hpp"
+#include "pythonic/numpy/complex256.hpp"
+#include "pythonic/numpy/complex64.hpp"
+#include "pythonic/numpy/float128.hpp"
+#include "pythonic/numpy/float32.hpp"
+#include "pythonic/numpy/int_.hpp"
+#include "pythonic/numpy/intc.hpp"
+#include "pythonic/numpy/longlong.hpp"
+#include "pythonic/numpy/short_.hpp"
+#include "pythonic/numpy/ubyte.hpp"
+#include "pythonic/numpy/uint.hpp"
+#include "pythonic/numpy/uintc.hpp"
+#include "pythonic/numpy/ulonglong.hpp"
+#include "pythonic/numpy/ushort.hpp"
+
+PYTHONIC_NS_BEGIN
+
+namespace types
+{
+ template <>
+ struct type_functor<bool> {
+ using type = builtins::functor::bool_;
+ };
+ template <>
+ struct type_functor<double> {
+ using type = builtins::functor::float_;
+ };
+ template <>
+ struct type_functor<types::str> {
+ using type = builtins::functor::str;
+ };
+ template <>
+ struct type_functor<std::complex<float>> {
+ using type = numpy::functor::complex64;
+ };
+ template <>
+ struct type_functor<std::complex<double>> {
+ using type = builtins::functor::complex;
+ };
+ template <>
+ struct type_functor<std::complex<long double>> {
+ using type = numpy::functor::complex256;
+ };
+ template <>
+ struct type_functor<types::empty_set> {
+ using type = builtins::functor::set;
+ };
+ template <class T>
+ struct type_functor<types::set<T>> {
+ using type = builtins::functor::set;
+ };
+ template <>
+ struct type_functor<types::slice> {
+ using type = builtins::functor::slice;
+ };
+ template <>
+ struct type_functor<types::empty_list> {
+ using type = builtins::functor::list;
+ };
+ template <class T>
+ struct type_functor<types::list<T>> {
+ using type = builtins::functor::list;
+ };
+ template <class T, size_t N>
+ struct type_functor<types::static_list<T, N>> {
+ using type = builtins::functor::list;
+ };
+ template <>
+ struct type_functor<types::empty_dict> {
+ using type = builtins::functor::dict;
+ };
+ template <class K, class V>
+ struct type_functor<types::dict<K, V>> {
+ using type = builtins::functor::dict;
+ };
+ template <class... Tys>
+ struct type_functor<std::tuple<Tys...>> {
+ using type = builtins::functor::tuple;
+ };
+ template <class T, size_t N>
+ struct type_functor<types::array_tuple<T, N>> {
+ using type = builtins::functor::tuple;
+ };
+ template <class T, class pS>
+ struct type_functor<types::ndarray<T, pS>> {
+ using type = numpy::functor::array;
+ };
+ template <>
+ struct type_functor<signed char> {
+ using type = numpy::functor::byte;
+ };
+ template <>
+ struct type_functor<unsigned char> {
+ using type = numpy::functor::ubyte;
+ };
+ template <>
+ struct type_functor<short> {
+ using type = numpy::functor::short_;
+ };
+ template <>
+ struct type_functor<unsigned short> {
+ using type = numpy::functor::ushort;
+ };
+ template <>
+ struct type_functor<int> {
+ using type = numpy::functor::intc;
+ };
+ template <>
+ struct type_functor<unsigned int> {
+ using type = numpy::functor::uintc;
+ };
+ template <>
+ struct type_functor<long> {
+ using type = numpy::functor::int_;
+ };
+ template <>
+ struct type_functor<unsigned long> {
+ using type = numpy::functor::uint;
+ };
+ template <>
+ struct type_functor<long long> {
+ using type = numpy::functor::longlong;
+ };
+ template <>
+ struct type_functor<unsigned long long> {
+ using type = numpy::functor::ulonglong;
+ };
+ template <>
+ struct type_functor<float> {
+ using type = numpy::functor::float32;
+ };
+ template <>
+ struct type_functor<long double> {
+ using type = numpy::functor::float128;
+ };
+
+ template <class T>
+ typename type_functor<T>::type type(T const &)
+ {
+ return {};
+ }
+} // namespace types
+PYTHONIC_NS_END
+
+#endif
diff --git a/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp b/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp
index 75dfcd11f11..bab78c4a5b1 100644
--- a/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/variant_functor.hpp
@@ -23,15 +23,13 @@ namespace types
template <class Type>
template <class OtherType>
- variant_functor_impl<Type>::variant_functor_impl(char mem[],
- OtherType const &t)
- : fun(nullptr)
+ variant_functor_impl<Type>::variant_functor_impl(char mem[], OtherType const &t) : fun(nullptr)
{
}
template <class Type>
- variant_functor_impl<Type>::variant_functor_impl(
- char mem[], variant_functor_impl<Type> const &t)
+ variant_functor_impl<Type>::variant_functor_impl(char mem[],
+ variant_functor_impl<Type> const &t)
: fun(t.fun ? new(mem) Type(*t.fun) : nullptr)
{
}
@@ -53,9 +51,7 @@ namespace types
}
template <class Type>
- void
- variant_functor_impl<Type>::assign(char mem[],
- variant_functor_impl<Type> const &other)
+ void variant_functor_impl<Type>::assign(char mem[], variant_functor_impl<Type> const &other)
{
if (fun != nullptr)
fun->~Type();
@@ -63,16 +59,16 @@ namespace types
fun = new (mem) Type(*other.fun);
}
template <class Type>
- void variant_functor_impl<Type>::assign(char mem[],
- variant_functor<Type> const &other)
+ void variant_functor_impl<Type>::assign(char mem[], variant_functor<Type> const &other)
{
assign(mem, static_cast<variant_functor_impl<Type> const &>(other));
}
template <class Type>
template <class OT0, class OT1, class... OtherTypes>
- void variant_functor_impl<Type>::assign(
- char mem[], variant_functor_impl<OT0, OT1, OtherTypes...> const &other)
+ void
+ variant_functor_impl<Type>::assign(char mem[],
+ variant_functor_impl<OT0, OT1, OtherTypes...> const &other)
{
assign(mem, other.head);
assign(mem, other.tail);
@@ -80,26 +76,22 @@ namespace types
template <class Type>
template <class OT0, class OT1, class... OtherTypes>
- void variant_functor_impl<Type>::assign(
- char mem[], variant_functor<OT0, OT1, OtherTypes...> const &other)
+ void variant_functor_impl<Type>::assign(char mem[],
+ variant_functor<OT0, OT1, OtherTypes...> const &other)
{
- assign(mem,
- static_cast<variant_functor_impl<OT0, OT1, OtherTypes...> const &>(
- other));
+ assign(mem, static_cast<variant_functor_impl<OT0, OT1, OtherTypes...> const &>(other));
}
template <class Type>
template <class OtherType>
- void variant_functor_impl<Type>::assign(
- char mem[], variant_functor_impl<OtherType> const &other)
+ void variant_functor_impl<Type>::assign(char mem[],
+ variant_functor_impl<OtherType> const &other)
{
}
template <class Type>
template <class OtherType>
- void
- variant_functor_impl<Type>::assign(char mem[],
- variant_functor<OtherType> const &other)
+ void variant_functor_impl<Type>::assign(char mem[], variant_functor<OtherType> const &other)
{
}
@@ -144,8 +136,7 @@ namespace types
template <class Type, class... Types>
template <class... OtherTypes>
- variant_functor_impl<Type, Types...>::variant_functor_impl(
- char mem[], OtherTypes const &...t)
+ variant_functor_impl<Type, Types...>::variant_functor_impl(char mem[], OtherTypes const &...t)
: head(mem, t...), tail(mem, t...)
{
}
@@ -159,8 +150,9 @@ namespace types
}
template <class Type, class... Types>
- void variant_functor_impl<Type, Types...>::assign(
- char mem[], variant_functor_impl<Type, Types...> const &other)
+ void
+ variant_functor_impl<Type, Types...>::assign(char mem[],
+ variant_functor_impl<Type, Types...> const &other)
{
head.assign(mem, other);
tail.assign(mem, other);
@@ -168,8 +160,7 @@ namespace types
template <class Type, class... Types>
template <class OtherType>
- void variant_functor_impl<Type, Types...>::assign(char mem[],
- OtherType const &other)
+ void variant_functor_impl<Type, Types...>::assign(char mem[], OtherType const &other)
{
head.assign(mem, other);
tail.assign(mem, other);
@@ -178,10 +169,8 @@ namespace types
template <class Type, class... Types>
template <class... Args>
auto variant_functor_impl<Type, Types...>::operator()(Args &&...args) ->
- typename __combined<
- decltype(std::declval<Type>()(std::forward<Args>(args)...)),
- decltype(std::declval<Types>()(
- std::forward<Args>(args)...))...>::type
+ typename __combined<decltype(std::declval<Type>()(std::forward<Args>(args)...)),
+ decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type
{
if (head.fun)
return head(std::forward<Args>(args)...);
@@ -191,12 +180,9 @@ namespace types
template <class Type, class... Types>
template <class... Args>
- auto
- variant_functor_impl<Type, Types...>::operator()(Args &&...args) const ->
- typename __combined<
- decltype(std::declval<Type>()(std::forward<Args>(args)...)),
- decltype(std::declval<Types>()(
- std::forward<Args>(args)...))...>::type
+ auto variant_functor_impl<Type, Types...>::operator()(Args &&...args) const ->
+ typename __combined<decltype(std::declval<Type>()(std::forward<Args>(args)...)),
+ decltype(std::declval<Types>()(std::forward<Args>(args)...))...>::type
{
if (head.fun)
return head(std::forward<Args>(args)...);
@@ -208,8 +194,7 @@ namespace types
template <class... Types>
variant_functor<Types...>::variant_functor(variant_functor const &other)
: details::variant_functor_impl<Types...>(
- mem,
- static_cast<details::variant_functor_impl<Types...> const &>(other))
+ mem, static_cast<details::variant_functor_impl<Types...> const &>(other))
{
}
@@ -223,8 +208,8 @@ namespace types
template <class... Types>
template <class... OtherTypes>
- variant_functor<Types...> &variant_functor<Types...>::operator=(
- variant_functor<OtherTypes...> const &other)
+ variant_functor<Types...> &
+ variant_functor<Types...>::operator=(variant_functor<OtherTypes...> const &other)
{
details::variant_functor_impl<Types...>::assign(mem, other);
return *this;
@@ -232,12 +217,10 @@ namespace types
template <class... Types>
template <class OtherType>
- variant_functor<Types...> &
- variant_functor<Types...>::operator=(OtherType const &other)
+ variant_functor<Types...> &variant_functor<Types...>::operator=(OtherType const &other)
{
- static_assert(
- utils::any_of<std::is_same<OtherType, Types>::value...>::value,
- "consistent assign");
+ static_assert(utils::any_of<std::is_same<OtherType, Types>::value...>::value,
+ "consistent assign");
details::variant_functor_impl<Types...>::assign(mem, other);
return *this;
}
@@ -251,12 +234,9 @@ namespace types
template <class... Types>
template <class... OtherTypes>
- variant_functor<Types...>::variant_functor(
- variant_functor<OtherTypes...> const &t)
+ variant_functor<Types...>::variant_functor(variant_functor<OtherTypes...> const &t)
: details::variant_functor_impl<Types...>(
- mem,
- static_cast<details::variant_functor_impl<OtherTypes...> const &>(
- t))
+ mem, static_cast<details::variant_functor_impl<OtherTypes...> const &>(t))
{
}
} // namespace types
diff --git a/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp b/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp
index 01f61e462ce..1860cc53eb5 100644
--- a/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp
+++ b/contrib/python/pythran/pythran/pythonic/types/vectorizable_type.hpp
@@ -108,9 +108,8 @@ namespace types
static const bool value =
!std::is_same<O, operator_::functor::mod>::value &&
(!std::is_same<O, operator_::functor::div>::value ||
- utils::all_of<std::is_same<
- Args, decltype(std::declval<O>()(
- std::declval<Args>()...))>::value...>::value) &&
+ utils::all_of<std::is_same<Args, decltype(std::declval<O>()(
+ std::declval<Args>()...))>::value...>::value) &&
!std::is_same<O, numpy::functor::logaddexp2>::value &&
// Return type for generic function should be generic
!std::is_same<O, numpy::functor::angle_in_rad>::value &&
@@ -131,8 +130,7 @@ namespace types
!std::is_same<O, numpy::functor::nextafter>::value &&
!std::is_same<O, numpy::functor::spacing>::value &&
// not supported for complex numbers
- !(utils::any_of<
- is_complex<typename dtype_of<Args>::type>::value...>::value &&
+ !(utils::any_of<is_complex<typename dtype_of<Args>::type>::value...>::value &&
(std::is_same<O, numpy::functor::floor_divide>::value ||
std::is_same<O, numpy::functor::maximum>::value ||
std::is_same<O, builtins::pythran::functor::abssqr>::value ||
@@ -150,8 +148,7 @@ namespace types
!std::is_same<O, numpy::functor::float32>::value &&
!std::is_same<O, numpy::functor::float64>::value &&
// not supported for integral numbers
- !(utils::any_of<std::is_integral<
- typename dtype_of<Args>::type>::value...>::value &&
+ !(utils::any_of<std::is_integral<typename dtype_of<Args>::type>::value...>::value &&
(std::is_same<O, numpy::functor::floor_divide>::value ||
std::is_same<O, numpy::functor::true_divide>::value ||
std::is_same<O, numpy::functor::divide>::value ||
diff --git a/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp b/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp
index 35d5352c9e1..94d79953416 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/array_helper.hpp
@@ -24,8 +24,7 @@ template <class A, size_t M>
auto nget<L>::fast(A &&self, types::array_tuple<long, M> const &indices)
-> decltype(nget<L - 1>().fast(std::forward<A>(self).fast(0), indices))
{
- return nget<L - 1>().fast(std::forward<A>(self).fast(indices[M - L - 1]),
- indices);
+ return nget<L - 1>().fast(std::forward<A>(self).fast(indices[M - L - 1]), indices);
}
template <class A, size_t M>
diff --git a/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp b/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp
index d892e4d580d..d63546e30ed 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/broadcast_copy.hpp
@@ -43,21 +43,18 @@ namespace utils
template <>
struct _broadcast_copy<fast_novectorize, 0, 0> {
- template <class E, class F, class SelfIndices, class OtherIndices,
- size_t... Is>
- void helper(E &&self, F const &other, SelfIndices &&self_indices,
- OtherIndices &&other_indices, utils::index_sequence<Is...>)
+ template <class E, class F, class SelfIndices, class OtherIndices, size_t... Is>
+ void helper(E &&self, F const &other, SelfIndices &&self_indices, OtherIndices &&other_indices,
+ std::index_sequence<Is...>)
{
std::forward<E>(self).store(
- (typename std::decay<E>::type::dtype)other.load(
- (long)std::get<Is>(other_indices)...),
+ (typename std::decay_t<E>::dtype)other.load((long)std::get<Is>(other_indices)...),
(long)std::get<Is>(self_indices)...);
}
template <class E, class F>
void operator()(E &&self, F const &other)
{
- return (*this)(std::forward<E>(self), other, std::tuple<>(),
- std::tuple<>());
+ return (*this)(std::forward<E>(self), other, std::tuple<>(), std::tuple<>());
}
template <class E, class F, class SelfIndices, class OtherIndices>
@@ -65,8 +62,7 @@ namespace utils
OtherIndices &&other_indices)
{
helper(std::forward<E>(self), other, self_indices, other_indices,
- utils::make_index_sequence<std::tuple_size<
- typename std::decay<SelfIndices>::type>::value>());
+ std::make_index_sequence<std::tuple_size<std::decay_t<SelfIndices>>::value>());
}
};
template <size_t N>
@@ -74,28 +70,23 @@ namespace utils
template <class E, class F>
void operator()(E &&self, F const &other)
{
- return (*this)(std::forward<E>(self), other, std::tuple<>(),
- std::tuple<>());
+ return (*this)(std::forward<E>(self), other, std::tuple<>(), std::tuple<>());
}
template <class E, class F, class SelfIndices, class OtherIndices>
void operator()(E &&self, F const &other, SelfIndices &&self_indices,
OtherIndices &&other_indices)
{
- long const other_size =
- other.template shape<std::decay<E>::type::value - N>();
- long const self_size =
- self.template shape<std::decay<E>::type::value - N>();
+ long const other_size = other.template shape<std::decay<E>::type::value - N>();
+ long const self_size = self.template shape<std::decay<E>::type::value - N>();
if (self_size == other_size)
for (long i = 0; i < self_size; ++i)
_broadcast_copy<fast_novectorize, N - 1, 0>{}(
- std::forward<E>(self), other,
- std::tuple_cat(self_indices, std::make_tuple(i)),
+ std::forward<E>(self), other, std::tuple_cat(self_indices, std::make_tuple(i)),
std::tuple_cat(other_indices, std::make_tuple(i)));
else
for (long i = 0; i < self_size; ++i)
_broadcast_copy<fast_novectorize, N - 1, 0>{}(
- std::forward<E>(self), other,
- std::tuple_cat(self_indices, std::make_tuple(i)),
+ std::forward<E>(self), other, std::tuple_cat(self_indices, std::make_tuple(i)),
std::tuple_cat(other_indices, std::make_tuple(0)));
}
};
@@ -105,21 +96,18 @@ namespace utils
template <class E, class F>
void operator()(E &&self, F const &other)
{
- return (*this)(std::forward<E>(self), other, std::tuple<>(),
- std::tuple<>());
+ return (*this)(std::forward<E>(self), other, std::tuple<>(), std::tuple<>());
}
template <class E, class F, class SelfIndices, class OtherIndices>
void operator()(E &&self, F const &other, SelfIndices &&self_indices,
OtherIndices &&other_indices)
{
- using broadcaster = typename std::conditional<
- types::is_dtype<F>::value,
- types::broadcast<F, typename std::decay<E>::type::dtype>,
- types::broadcasted<F>>::type;
- _broadcast_copy<fast_novectorize, N, D - 1>{}(
- std::forward<E>(self), broadcaster(other),
- std::forward<SelfIndices>(self_indices),
- std::forward<OtherIndices>(other_indices));
+ using broadcaster = std::conditional_t<types::is_dtype<F>::value,
+ types::broadcast<F, typename std::decay_t<E>::dtype>,
+ types::broadcasted<F>>;
+ _broadcast_copy<fast_novectorize, N, D - 1>{}(std::forward<E>(self), broadcaster(other),
+ std::forward<SelfIndices>(self_indices),
+ std::forward<OtherIndices>(other_indices));
}
};
@@ -179,8 +167,7 @@ namespace utils
const long other_size = other.size();
const long vbound = other_size / vN;
- for (auto iter = vectorizer::vbegin(self), end = iter + vbound; iter != end;
- ++iter, ++oiter) {
+ for (auto iter = vectorizer::vbegin(self), end = iter + vbound; iter != end; ++iter, ++oiter) {
iter.store(*oiter);
}
@@ -212,8 +199,7 @@ namespace utils
template <class E, class F>
void operator()(E &&self, F const &other)
{
- return vbroadcast_copy<types::vectorizer_nobroadcast>(
- std::forward<E>(self), other);
+ return vbroadcast_copy<types::vectorizer_nobroadcast>(std::forward<E>(self), other);
}
};
@@ -243,8 +229,7 @@ namespace utils
};
template <class E, class F, size_t N, int D, bool vector_form>
- E &broadcast_copy_helper(E &self, F const &other,
- std::integral_constant<bool, true>,
+ E &broadcast_copy_helper(E &self, F const &other, std::integral_constant<bool, true>,
std::integral_constant<bool, false>)
{
static_assert(D >= 0, "downcasting already happened");
@@ -261,8 +246,7 @@ namespace utils
}
template <class E, class F, size_t N, int D, bool vector_form>
- E &broadcast_copy_helper(E &self, F const &other,
- std::integral_constant<bool, true>,
+ E &broadcast_copy_helper(E &self, F const &other, std::integral_constant<bool, true>,
std::integral_constant<bool, true>)
{
if (D == 0) {
@@ -270,14 +254,12 @@ namespace utils
return self;
} else {
return broadcast_copy_helper<E, F, N, D, vector_form>(
- self, other, std::integral_constant<bool, true>(),
- std::integral_constant<bool, false>{});
+ self, other, std::integral_constant<bool, true>(), std::integral_constant<bool, false>{});
}
}
template <class E, class F, size_t N, int D, bool vector_form, bool plain>
- E &broadcast_copy_helper(E &self, F const &other,
- std::integral_constant<bool, false>,
+ E &broadcast_copy_helper(E &self, F const &other, std::integral_constant<bool, false>,
std::integral_constant<bool, plain> is_plain)
{
auto reshaped = other.reshape(sutils::getshape(self));
@@ -298,10 +280,8 @@ namespace utils
E &broadcast_copy(E &self, F const &other)
{
return broadcast_copy_helper<E, F, N, D, vector_form>(
- self, other, std::integral_constant<bool, (D >= 0)>(),
- std::integral_constant < bool,
- std::decay<E>::type::is_flat
- &&is_flat<typename std::decay<F>::type>::value > {});
+ self, other, std::integral_constant<bool, (D >= 0)>(), std::integral_constant < bool,
+ std::decay<E>::type::is_flat &&is_flat<std::decay_t<F>>::value > {});
}
/* update
@@ -359,10 +339,9 @@ namespace utils
template <class Op>
struct _broadcast_update<Op, fast_novectorize, 0, 0> {
- template <class E, class F, class SelfIndices, class OtherIndices,
- size_t... Is>
- void helper(E &&self, F const &other, SelfIndices &&self_indices,
- OtherIndices &&other_indices, utils::index_sequence<Is...>)
+ template <class E, class F, class SelfIndices, class OtherIndices, size_t... Is>
+ void helper(E &&self, F const &other, SelfIndices &&self_indices, OtherIndices &&other_indices,
+ std::index_sequence<Is...>)
{
self.template update<Op>(other.load((long)std::get<Is>(other_indices)...),
(long)std::get<Is>(self_indices)...);
@@ -370,8 +349,7 @@ namespace utils
template <class E, class F>
void operator()(E &&self, F const &other)
{
- return (*this)(std::forward<E>(self), other, std::tuple<>(),
- std::tuple<>());
+ return (*this)(std::forward<E>(self), other, std::tuple<>(), std::tuple<>());
}
template <class E, class F, class SelfIndices, class OtherIndices>
@@ -379,8 +357,7 @@ namespace utils
OtherIndices &&other_indices)
{
helper(std::forward<E>(self), other, self_indices, other_indices,
- utils::make_index_sequence<std::tuple_size<
- typename std::decay<SelfIndices>::type>::value>());
+ std::make_index_sequence<std::tuple_size<std::decay_t<SelfIndices>>::value>());
}
};
@@ -389,28 +366,23 @@ namespace utils
template <class E, class F>
void operator()(E &&self, F const &other)
{
- return (*this)(std::forward<E>(self), other, std::tuple<>(),
- std::tuple<>());
+ return (*this)(std::forward<E>(self), other, std::tuple<>(), std::tuple<>());
}
template <class E, class F, class SelfIndices, class OtherIndices>
void operator()(E &&self, F const &other, SelfIndices &&self_indices,
OtherIndices &&other_indices)
{
- auto const other_size =
- other.template shape<std::decay<E>::type::value - N>();
- auto const self_size =
- self.template shape<std::decay<E>::type::value - N>();
+ auto const other_size = other.template shape<std::decay<E>::type::value - N>();
+ auto const self_size = self.template shape<std::decay<E>::type::value - N>();
if (self_size == other_size)
for (long i = 0; i < self_size; ++i)
_broadcast_update<Op, fast_novectorize, N - 1, 0>{}(
- std::forward<E>(self), other,
- std::tuple_cat(self_indices, std::make_tuple(i)),
+ std::forward<E>(self), other, std::tuple_cat(self_indices, std::make_tuple(i)),
std::tuple_cat(other_indices, std::make_tuple(i)));
else
for (long i = 0; i < self_size; ++i)
_broadcast_update<Op, fast_novectorize, N - 1, 0>{}(
- std::forward<E>(self), other,
- std::tuple_cat(self_indices, std::make_tuple(i)),
+ std::forward<E>(self), other, std::tuple_cat(self_indices, std::make_tuple(i)),
std::tuple_cat(other_indices, std::make_tuple(0)));
}
};
@@ -419,20 +391,17 @@ namespace utils
template <class E, class F>
void operator()(E &&self, F const &other)
{
- return (*this)(std::forward<E>(self), other, std::tuple<>(),
- std::tuple<>());
+ return (*this)(std::forward<E>(self), other, std::tuple<>(), std::tuple<>());
}
template <class E, class F, class SelfIndices, class OtherIndices>
void operator()(E &&self, F const &other, SelfIndices &&self_indices,
OtherIndices &&other_indices)
{
- using broadcaster = typename std::conditional<
- types::is_dtype<F>::value,
- types::broadcast<F, typename std::decay<E>::type::dtype>,
- types::broadcasted<F>>::type;
+ using broadcaster = std::conditional_t<types::is_dtype<F>::value,
+ types::broadcast<F, typename std::decay_t<E>::dtype>,
+ types::broadcasted<F>>;
_broadcast_update<Op, fast_novectorize, N, D - 1>{}(
- std::forward<E>(self), broadcaster(other),
- std::forward<SelfIndices>(self_indices),
+ std::forward<E>(self), broadcaster(other), std::forward<SelfIndices>(self_indices),
std::forward<OtherIndices>(other_indices));
}
};
@@ -493,8 +462,7 @@ namespace utils
template <class... Args>
void operator()(Args &&...args)
{
- vbroadcast_update<Op, types::vectorizer_nobroadcast>(
- std::forward<Args>(args)...);
+ vbroadcast_update<Op, types::vectorizer_nobroadcast>(std::forward<Args>(args)...);
}
};
@@ -517,8 +485,7 @@ namespace utils
void operator()(E &self, F const &other)
{
if (utils::no_broadcast_vectorize(other))
- _broadcast_update<Op, types::vectorizer_nobroadcast, N, D>{}(self,
- other);
+ _broadcast_update<Op, types::vectorizer_nobroadcast, N, D>{}(self, other);
else
_broadcast_update<Op, types::vectorizer, N, D>{}(self, other);
}
diff --git a/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp b/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp
index cda0e6b2e17..a16e2f4e761 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/iterator.hpp
@@ -35,8 +35,7 @@ namespace utils
}
template <class T, class... Others>
- iterator_reminder<true, T, Others...>::iterator_reminder(
- T const &v, Others const &...others)
+ iterator_reminder<true, T, Others...>::iterator_reminder(T const &v, Others const &...others)
: values(v, others...)
{
}
diff --git a/contrib/python/pythran/pythran/pythonic/utils/meta.hpp b/contrib/python/pythran/pythran/pythonic/utils/meta.hpp
index 71bc19eed77..bdb9c4c88fd 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/meta.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/meta.hpp
@@ -9,7 +9,7 @@ struct static_assert_check {
static constexpr bool value = C;
};
-#define pythran_static_assert(value, str, ...) \
+#define pythran_static_assert(value, str, ...) \
static_assert(static_assert_check<value, __VA_ARGS__>::value, str)
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp b/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp
index 2996e4e2e18..b14d4bc1371 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/nested_container.hpp
@@ -15,11 +15,11 @@ namespace utils
long nested_container_size<T>::flat_size(T const &t)
{
auto n = t.size();
- return n ? n * nested_container_size<typename std::conditional<
+ return n ? n * nested_container_size<std::conditional_t<
// If we have a scalar or a complex, we want to stop
// recursion, and then dispatch to bool specialization
types::is_dtype<typename Type::value_type>::value, bool,
- typename Type::value_type>::type>::flat_size(*t.begin())
+ typename Type::value_type>>::flat_size(*t.begin())
: 0;
}
diff --git a/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp b/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp
index 82c1638b114..1768706303f 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/numpy_conversion.hpp
@@ -5,28 +5,26 @@
#include "pythonic/utils/numpy_traits.hpp"
#if _MSC_VER && !__clang__
-#define NUMPY_EXPR_TO_NDARRAY0_IMPL(fname) \
- template <class E, class... Types, \
- typename std::enable_if<!types::is_ndarray<E>::value && \
- types::is_numexpr_arg<E>::value, \
- E>::type * = nullptr> \
- auto fname(E const &expr, Types &&...others) \
- { \
- return fname(types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
- std::forward<Types>(others)...); \
+#define NUMPY_EXPR_TO_NDARRAY0_IMPL(fname) \
+ template <class E, class... Types, \
+ std::enable_if_t<!types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, E> \
+ * = nullptr> \
+ auto fname(E const &expr, Types &&...others) \
+ { \
+ return fname(types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
+ std::forward<Types>(others)...); \
}
#else
-#define NUMPY_EXPR_TO_NDARRAY0_IMPL(fname) \
- template <class E, class... Types> \
- auto fname(E const &expr, Types &&...others) -> \
- typename std::enable_if< \
- !types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, \
- decltype(fname( \
- types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
- std::forward<Types>(others)...))>::type \
- { \
- return fname(types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
- std::forward<Types>(others)...); \
+#define NUMPY_EXPR_TO_NDARRAY0_IMPL(fname) \
+ template <class E, class... Types> \
+ auto fname(E const &expr, Types &&...others) \
+ -> std::enable_if_t<!types::is_ndarray<E>::value && types::is_numexpr_arg<E>::value, \
+ decltype(fname( \
+ types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
+ std::forward<Types>(others)...))> \
+ { \
+ return fname(types::ndarray<typename E::dtype, typename E::shape_t>{expr}, \
+ std::forward<Types>(others)...); \
}
#endif
#endif
diff --git a/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp b/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp
index 7fce8403d8d..3763327d191 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/pdqsort.hpp
@@ -243,8 +243,7 @@ namespace pdqsort_detail
// pivot is a median of at least 3 elements and that [begin, end) is at least
// insertion_sort_threshold long. Uses branchless partitioning.
template <class Iter, class Compare>
- inline std::pair<Iter, bool> partition_right_branchless(Iter begin, Iter end,
- Compare comp)
+ inline std::pair<Iter, bool> partition_right_branchless(Iter begin, Iter end, Compare comp)
{
typedef typename std::iterator_traits<Iter>::value_type T;
@@ -346,8 +345,7 @@ namespace pdqsort_detail
// Swap elements and update block sizes and first/last boundaries.
int num = std::min(num_l, num_r);
- swap_offsets(first, last, offsets_l + start_l, offsets_r + start_r, num,
- num_l == num_r);
+ swap_offsets(first, last, offsets_l + start_l, offsets_r + start_r, num, num_l == num_r);
num_l -= num;
num_r -= num;
start_l += num;
@@ -359,8 +357,7 @@ namespace pdqsort_detail
}
int l_size = 0, r_size = 0;
- int unknown_left =
- (int)(last - first) - ((num_r || num_l) ? block_size : 0);
+ int unknown_left = (int)(last - first) - ((num_r || num_l) ? block_size : 0);
if (num_r) {
// Handle leftover block by assigning the unknown elements to the other
// block.
@@ -395,8 +392,7 @@ namespace pdqsort_detail
}
int num = std::min(num_l, num_r);
- swap_offsets(first, last, offsets_l + start_l, offsets_r + start_r, num,
- num_l == num_r);
+ swap_offsets(first, last, offsets_l + start_l, offsets_r + start_r, num, num_l == num_r);
num_l -= num;
num_r -= num;
start_l += num;
@@ -438,8 +434,7 @@ namespace pdqsort_detail
// pivot is a median of at least 3 elements and that [begin, end) is at least
// insertion_sort_threshold long.
template <class Iter, class Compare>
- inline std::pair<Iter, bool> partition_right(Iter begin, Iter end,
- Compare comp)
+ inline std::pair<Iter, bool> partition_right(Iter begin, Iter end, Compare comp)
{
typedef typename std::iterator_traits<Iter>::value_type T;
@@ -577,9 +572,8 @@ namespace pdqsort_detail
}
// Partition and get results.
- std::pair<Iter, bool> part_result =
- Branchless ? partition_right_branchless(begin, end, comp)
- : partition_right(begin, end, comp);
+ std::pair<Iter, bool> part_result = Branchless ? partition_right_branchless(begin, end, comp)
+ : partition_right(begin, end, comp);
Iter pivot_pos = part_result.first;
bool already_partitioned = part_result.second;
@@ -626,8 +620,7 @@ namespace pdqsort_detail
// If we were decently balanced and we tried to sort an already
// partitioned
// sequence try to use insertion sort.
- if (already_partitioned &&
- partial_insertion_sort(begin, pivot_pos, comp) &&
+ if (already_partitioned && partial_insertion_sort(begin, pivot_pos, comp) &&
partial_insertion_sort(pivot_pos + 1, end, comp))
return;
}
@@ -635,8 +628,7 @@ namespace pdqsort_detail
// Sort the left partition first using recursion and do tail recursion
// elimination for
// the right-hand partition.
- pdqsort_loop<Iter, Compare, Branchless>(begin, pivot_pos, comp,
- bad_allowed, leftmost);
+ pdqsort_loop<Iter, Compare, Branchless>(begin, pivot_pos, comp, bad_allowed, leftmost);
begin = pivot_pos + 1;
leftmost = false;
}
@@ -652,14 +644,12 @@ inline void pdqsort(Iter begin, Iter end, Compare comp)
#if __cplusplus >= 201103L
pdqsort_detail::pdqsort_loop<
Iter, Compare,
- pdqsort_detail::is_default_compare<
- typename std::decay<Compare>::type>::value &&
- std::is_arithmetic<
- typename std::iterator_traits<Iter>::value_type>::value>(
+ pdqsort_detail::is_default_compare<std::decay_t<Compare>>::value &&
+ std::is_arithmetic<typename std::iterator_traits<Iter>::value_type>::value>(
begin, end, comp, pdqsort_detail::log2(end - begin));
#else
- pdqsort_detail::pdqsort_loop<Iter, Compare, false>(
- begin, end, comp, pdqsort_detail::log2(end - begin));
+ pdqsort_detail::pdqsort_loop<Iter, Compare, false>(begin, end, comp,
+ pdqsort_detail::log2(end - begin));
#endif
}
@@ -675,8 +665,8 @@ inline void pdqsort_branchless(Iter begin, Iter end, Compare comp)
{
if (begin == end)
return;
- pdqsort_detail::pdqsort_loop<Iter, Compare, true>(
- begin, end, comp, pdqsort_detail::log2(end - begin));
+ pdqsort_detail::pdqsort_loop<Iter, Compare, true>(begin, end, comp,
+ pdqsort_detail::log2(end - begin));
}
template <class Iter>
diff --git a/contrib/python/pythran/pythran/pythonic/utils/shared_ref.hpp b/contrib/python/pythran/pythran/pythonic/utils/shared_ref.hpp
index 44ec82982c2..c8b7bb5ab26 100644
--- a/contrib/python/pythran/pythran/pythonic/utils/shared_ref.hpp
+++ b/contrib/python/pythran/pythran/pythonic/utils/shared_ref.hpp
@@ -39,8 +39,7 @@ namespace utils
template <class T>
template <class... Types>
shared_ref<T>::shared_ref(Types &&...args)
- : mem(new(utils::allocate<memory>(1))
- memory(std::forward<Types>(args)...))
+ : mem(new(utils::allocate<memory>(1)) memory(std::forward<Types>(args)...))
{
}
diff --git a/contrib/python/pythran/pythran/pythran-darwin.cfg b/contrib/python/pythran/pythran/pythran-darwin.cfg
index 87aaeaf5333..240327b5a5f 100644
--- a/contrib/python/pythran/pythran/pythran-darwin.cfg
+++ b/contrib/python/pythran/pythran/pythran-darwin.cfg
@@ -4,7 +4,7 @@ undefs=
include_dirs=
libs=
library_dirs=
-cflags=-std=c++11 -fno-math-errno -Wno-unused-function
+cflags=-std=c++14 -fno-math-errno -Wno-unused-function
ldflags=
blas=blas
CC=
diff --git a/contrib/python/pythran/pythran/pythran-default.cfg b/contrib/python/pythran/pythran/pythran-default.cfg
index 01e1003edc0..950a788ea81 100644
--- a/contrib/python/pythran/pythran/pythran-default.cfg
+++ b/contrib/python/pythran/pythran/pythran-default.cfg
@@ -4,7 +4,7 @@ undefs=
include_dirs=
libs=
library_dirs=
-cflags=-std=c++11
+cflags=-std=c++14
ldflags=
blas=blas
CC=
diff --git a/contrib/python/pythran/pythran/pythran-linux.cfg b/contrib/python/pythran/pythran/pythran-linux.cfg
index a5ea2093d83..51c55f77e98 100644
--- a/contrib/python/pythran/pythran/pythran-linux.cfg
+++ b/contrib/python/pythran/pythran/pythran-linux.cfg
@@ -4,7 +4,7 @@ undefs=
include_dirs=
libs=
library_dirs=
-cflags=-std=c++11 -fno-math-errno -fvisibility=hidden -fno-wrapv -Wno-unused-function -Wno-int-in-bool-context -Wno-unknown-warning-option
+cflags=-std=c++14 -fno-math-errno -fvisibility=hidden -fno-wrapv -Wno-unused-function -Wno-int-in-bool-context -Wno-unknown-warning-option
ldflags=-fvisibility=hidden -Wl,-strip-all
blas=blas
CC=
diff --git a/contrib/python/pythran/pythran/pythran-linux2.cfg b/contrib/python/pythran/pythran/pythran-linux2.cfg
index a5ea2093d83..51c55f77e98 100644
--- a/contrib/python/pythran/pythran/pythran-linux2.cfg
+++ b/contrib/python/pythran/pythran/pythran-linux2.cfg
@@ -4,7 +4,7 @@ undefs=
include_dirs=
libs=
library_dirs=
-cflags=-std=c++11 -fno-math-errno -fvisibility=hidden -fno-wrapv -Wno-unused-function -Wno-int-in-bool-context -Wno-unknown-warning-option
+cflags=-std=c++14 -fno-math-errno -fvisibility=hidden -fno-wrapv -Wno-unused-function -Wno-int-in-bool-context -Wno-unknown-warning-option
ldflags=-fvisibility=hidden -Wl,-strip-all
blas=blas
CC=
diff --git a/contrib/python/pythran/pythran/pythran.cfg b/contrib/python/pythran/pythran/pythran.cfg
index 3665a6e8d56..ed0885b26da 100644
--- a/contrib/python/pythran/pythran/pythran.cfg
+++ b/contrib/python/pythran/pythran/pythran.cfg
@@ -63,3 +63,7 @@ annotation_kind = 'comment'
# make generated module compatible with freethreading, see
# https://py-free-threading.github.io/
freethreading_compatible = true
+
+# Use limited API, see https://docs.python.org/3/c-api/stable.html#limited-c-api.
+# Set to "3.7" or more to enable.
+limited_api = false
diff --git a/contrib/python/pythran/pythran/spec.py b/contrib/python/pythran/pythran/spec.py
index 838f99ccd0e..afa07a0003b 100644
--- a/contrib/python/pythran/pythran/spec.py
+++ b/contrib/python/pythran/pythran/spec.py
@@ -10,7 +10,7 @@ import re
import ply.lex as lex
import ply.yacc as yacc
-from pythran.typing import List, Set, Dict, NDArray, Tuple, Pointer, Fun
+from pythran.typing import List, Set, Dict, NDArray, Tuple, Pointer, Fun, Type
from pythran.syntax import PythranSyntaxError
from pythran.config import cfg
@@ -166,6 +166,8 @@ class SpecParser(object):
'ufunc': 'UFUNC',
'or': 'OR',
'list': 'LIST',
+ 'type': 'TYPE',
+ 'tuple': 'TUPLE',
'set': 'SET',
'dict': 'DICT',
'slice': 'SLICE',
@@ -340,6 +342,8 @@ class SpecParser(object):
p[0] = tuple(List[t] for t in p[1])
elif len(p) == 3 and p[2] == 'set':
p[0] = tuple(Set[t] for t in p[1])
+ elif len(p) == 3 and p[2] == 'type':
+ p[0] = tuple(Type[t] for t in p[1])
elif len(p) == 3:
if p[2] is None:
expanded = []
@@ -380,6 +384,7 @@ class SpecParser(object):
| pointer_type
| type LIST
| type SET
+ | generic_type TYPE
| type LPAREN opt_types RPAREN
| type COLUMN type DICT
| LPAREN types RPAREN
@@ -387,6 +392,26 @@ class SpecParser(object):
| type OR type
'''
+ def p_generic_type(self, p):
+ if len(p) == 2:
+ p[0] = {'list': list, 'set': set, 'dict': dict, 'tuple': tuple}.get(p[1], p[1]),
+ elif len(p) == 3 and p[2] == 'type':
+ p[0] = tuple(Type[t] for t in p[1])
+ elif len(p) == 4 and p[2] == 'or':
+ p[0] = p[1] + p[3]
+ else:
+ msg = "Invalid Pythran spec. Unknown text '{0}'".format(p.value)
+ self.p_error(p, msg)
+
+ p_generic_type.__doc__ = '''generic_type : term
+ | LIST
+ | SET
+ | generic_type TYPE
+ | DICT
+ | TUPLE
+ | generic_type OR generic_type
+ '''
+
def p_opt_order(self, p):
if len(p) > 1:
if p[3] not in 'CF':
diff --git a/contrib/python/pythran/pythran/tables.py b/contrib/python/pythran/pythran/tables.py
index a61709d198b..a9f57122259 100644
--- a/contrib/python/pythran/pythran/tables.py
+++ b/contrib/python/pythran/pythran/tables.py
@@ -45,7 +45,9 @@ cxx_keywords = {
'using', 'virtual', 'void', 'volatile', 'wchar_t', 'while',
'xor', 'xor_eq',
# C++11 additions
- 'constexpr', 'decltype', 'noexcept', 'nullptr', 'static_assert',
+ 'constexpr', 'decltype', 'thread_local', 'noexcept', 'nullptr', 'static_assert',
+ 'alignof', 'alignas',
+ # C++14 additions (nothing)
# reserved namespaces
'std',
}
@@ -3752,10 +3754,13 @@ MODULES = {
"fmin": UFunc(REDUCED_BINARY_UFUNC),
"fmod": UFunc(BINARY_UFUNC),
"frexp": ConstFunctionIntr(),
+ "frombuffer": ConstFunctionIntr(),
"fromfunction": ConstFunctionIntr(),
"fromiter": ConstFunctionIntr(args=("iterable", "dtype", "count"),
defaults=(-1,)),
- "fromstring": ConstFunctionIntr(),
+ "fromstring": ConstFunctionIntr(args=('string', 'dtype', 'count',),
+ kwonlyargs=('sep', 'like'),
+ defaults=(float, -1, '', None)),
"fromfile": FunctionIntr(args=('file', 'dtype', 'count', "sep", "offset"),
defaults=(None, None, -1, None, 0),
global_effects=True),
@@ -4641,7 +4646,9 @@ def save_arguments(module_name, elements):
defaults = list(spec.defaults or [])
args += [ast.Name(arg, ast.Param(), None, None)
for arg in spec.kwonlyargs]
- defaults += [spec.kwonlydefaults[kw] for kw in spec.kwonlyargs]
+ if spec.kwonlydefaults:
+ defaults += [spec.kwonlydefaults[kw] for kw in
+ spec.kwonlyargs[-len(spec.kwonlydefaults):]]
# Check if we already have a pythran description for that object
if signature.args.args:
diff --git a/contrib/python/pythran/pythran/toolchain.py b/contrib/python/pythran/pythran/toolchain.py
index 42dcc072ad2..498cff92503 100644
--- a/contrib/python/pythran/pythran/toolchain.py
+++ b/contrib/python/pythran/pythran/toolchain.py
@@ -331,11 +331,8 @@ def compile_cxxfile(module_name, cxxfile, output_binary=None, **kwargs):
# local import so that we don't depend on setuptools for the code generation
# part
from pythran.dist import PythranExtension, PythranBuildExt
- try:
- # `numpy.distutils is deprecated, may not be present, or broken
- from numpy.distutils.core import setup
- except Exception:
- from setuptools import setup
+
+ from setuptools import setup
builddir = mkdtemp()
buildtmp = mkdtemp()
@@ -367,6 +364,10 @@ def compile_cxxfile(module_name, cxxfile, output_binary=None, **kwargs):
dest.write(src.read())
ext = sysconfig.get_config_var('EXT_SUFFIX')
+ if getattr(extension, 'py_limited_api', False):
+ _, ext = os.path.splitext(ext)
+ ext = f".abi3{ext}"
+
# Copy all generated files including the module name prefix (.pdb, ...)
for f in glob.glob(os.path.join(builddir, module_name + "*")):
if f.endswith(ext):
diff --git a/contrib/python/pythran/pythran/transformations/remove_named_arguments.py b/contrib/python/pythran/pythran/transformations/remove_named_arguments.py
index b70c278e141..48bec09269d 100644
--- a/contrib/python/pythran/pythran/transformations/remove_named_arguments.py
+++ b/contrib/python/pythran/pythran/transformations/remove_named_arguments.py
@@ -1,10 +1,13 @@
""" RemoveNamedArguments turns named arguments into regular ones. """
-from pythran.analyses import Aliases
+from pythran.analyses import Aliases, DefUseChains
+from pythran.conversion import PYTHRAN_IMPORT_MANGLING
+from pythran.errors import PythranInternalError
from pythran.passmanager import Transformation
from pythran.syntax import PythranSyntaxError
from pythran.tables import MODULES
+
import gast as ast
from copy import deepcopy
@@ -15,7 +18,20 @@ def handle_special_calls(func_alias, node):
node.args.insert(0, ast.Constant(0, None))
-class RemoveNamedArguments(Transformation[Aliases]):
+def same_nodes(n0, n1):
+ if type(n0) is not type(n1):
+ return False
+ if isinstance(n0, ast.Constant):
+ return type(n0.value) is type(n1.value) and n0.value == n1.value
+ if isinstance(n0, ast.Attribute):
+ return n0.attr == n1.attr and same_nodes(n0.value, n1.value)
+ if isinstance(n0, ast.Name):
+ assert n0.id.startswith(PYTHRAN_IMPORT_MANGLING), "should be an import"
+ return n0.id == n1.id
+ raise NotImplementedError((n0, n1))
+
+
+class RemoveNamedArguments(Transformation[Aliases, DefUseChains]):
'''
Replace call with named arguments to regular calls
@@ -92,6 +108,10 @@ class RemoveNamedArguments(Transformation[Aliases]):
return replacements
+ def visit_FunctionDef(self, node):
+ self.current_function = node
+ return super().generic_visit(node)
+
def visit_Call(self, node):
if node.keywords:
self.update = True
@@ -102,22 +122,59 @@ class RemoveNamedArguments(Transformation[Aliases]):
# all aliases should have the same structural type...
# call to self.handle_keywords raises an exception otherwise
try:
- replacements = {}
- for func_alias in aliases:
- handle_special_calls(func_alias, node)
+ def visit_aliases(aliases):
+ all_replacements = []
+ for func_alias in aliases:
+ handle_special_calls(func_alias, node)
+
+ if func_alias is None: # aliasing computation failed
+ pass
+ elif isinstance(func_alias, ast.Call): # nested function
+ # func_alias looks like functools.partial(foo, a)
+ # so we reorder using alias for 'foo'
+ offset = len(func_alias.args) - 1
+ call = func_alias.args[0]
+ for func_alias in self.aliases[call]:
+ all_replacements.append(self.handle_keywords(func_alias,
+ node,
+ offset))
+ elif isinstance(func_alias, ast.Name):
+ if not isinstance(func_alias.ctx, ast.Param):
+ raise PythranInternalError(
+ "Unexpected non-parameter reference in call")
+ index = self.current_function.args.args.index(func_alias)
+ def_ = self.def_use_chains.chains[self.current_function]
+ for def_user in def_.users():
+ for user in def_user.users():
+ if not isinstance(user.node, ast.Call):
+ continue
+ effective_arg = user.node.args[index]
+ arg_aliases = self.aliases[effective_arg]
+ all_replacements.append(visit_aliases(arg_aliases))
- if func_alias is None: # aliasing computation failed
- pass
- elif isinstance(func_alias, ast.Call): # nested function
- # func_alias looks like functools.partial(foo, a)
- # so we reorder using alias for 'foo'
- offset = len(func_alias.args) - 1
- call = func_alias.args[0]
- for func_alias in self.aliases[call]:
- replacements = self.handle_keywords(func_alias,
- node, offset)
+
+ else:
+ all_replacements.append(self.handle_keywords(func_alias,
+ node))
+
+ if not all_replacements:
+ return {}
+ elif len(all_replacements) == 1:
+ return all_replacements[0]
else:
- replacements = self.handle_keywords(func_alias, node)
+ replacement = {}
+ for candidate in all_replacements:
+ for k, v in candidate.items():
+ if k not in replacement:
+ replacement[k] = v
+ else:
+ if not same_nodes(v, replacement[k]):
+ raise PythranSyntaxError(
+ "different default argument values depending on the call site for this node", node)
+
+ return replacement
+
+ replacements = visit_aliases(aliases)
# if we reach this point, we should have a replacement
# candidate, or nothing structural typing issues would have
diff --git a/contrib/python/pythran/pythran/types/conversion.py b/contrib/python/pythran/pythran/types/conversion.py
index e149b7fb47d..d90f82cbec5 100644
--- a/contrib/python/pythran/pythran/types/conversion.py
+++ b/contrib/python/pythran/pythran/types/conversion.py
@@ -4,11 +4,12 @@ from numpy import int8, int16, int32, int64, intp, intc
from numpy import uint8, uint16, uint32, uint64, uintp, uintc
from numpy import float64, float32, complex64, complex128
import numpy
-from pythran.typing import List, Dict, Set, Tuple, NDArray, Pointer, Fun
+from pythran.typing import List, Dict, Set, Tuple, NDArray, Pointer, Fun, Type
PYTYPE_TO_CTYPE_TABLE = {
numpy.uint: 'npy_uint',
#
+ bytes: 'pythonic::types::str', # FIXME: using types::str as backend
complex: 'std::complex<double>',
bool: 'bool',
int: 'long',
@@ -53,10 +54,20 @@ TYPE_TO_SUFFIX = {
def pytype_to_ctype(t):
""" Python -> pythonic type binding. """
- if isinstance(t, List):
+ if t in (list, set):
+ return f'pythonic::types::{t.__name__}<void>'
+ elif t is dict:
+ return f'pythonic::types::{t.__name__}<void, void>'
+ elif t is tuple:
+ return f'std::tuple<void>'
+ elif isinstance(t, List):
return 'pythonic::types::list<{0}>'.format(
pytype_to_ctype(t.__args__[0])
)
+ elif isinstance(t, Type):
+ return 'pythonic::types::type_t<{0}>'.format(
+ pytype_to_ctype(t.__args__[0])
+ )
elif isinstance(t, Set):
return 'pythonic::types::set<{0}>'.format(
pytype_to_ctype(t.__args__[0])
@@ -105,8 +116,12 @@ def pytype_to_ctype(t):
def pytype_to_pretty_type(t):
""" Python -> docstring type. """
- if isinstance(t, List):
+ if t in (list, set, dict, tuple):
+ return t.__name__
+ elif isinstance(t, List):
return '{0} list'.format(pytype_to_pretty_type(t.__args__[0]))
+ elif isinstance(t, Type):
+ return '{0} type'.format(pytype_to_pretty_type(t.__args__[0]))
elif isinstance(t, Set):
return '{0} set'.format(pytype_to_pretty_type(t.__args__[0]))
elif isinstance(t, Dict):
diff --git a/contrib/python/pythran/pythran/types/signature.py b/contrib/python/pythran/pythran/types/signature.py
index c56f20ed3f7..fd44a0c40a0 100644
--- a/contrib/python/pythran/pythran/types/signature.py
+++ b/contrib/python/pythran/pythran/types/signature.py
@@ -1,4 +1,4 @@
-from pythran.typing import List, Dict, Set, Fun, TypeVar
+from pythran.typing import List, Dict, Set, Fun, TypeVar, Type
from pythran.typing import Union, Iterable
@@ -20,7 +20,7 @@ def dep_builder(type_var, ppal_index, index, t, self, node):
return lambda arg: (arg
if index == ppal_index
else self.result[node.args[index]])
- elif isinstance(t, (List, Set, Iterable, Dict)):
+ elif isinstance(t, (List, Set, Iterable, Dict, Type)):
return lambda arg: self.builder.IteratorContentType(
dep_builder(type_var,
ppal_index,
@@ -41,6 +41,9 @@ def path_to(self, t, deps_builders, node):
return deps_builders[t]
else:
raise InfeasibleCombiner()
+ if isinstance(t, Type):
+ return lambda arg: self.builder.TypeType(
+ path_to(self, t.__args__[0], deps_builders, node)(arg))
if isinstance(t, List):
return lambda arg: self.builder.ListType(
path_to(self, t.__args__[0], deps_builders, node)(arg))
diff --git a/contrib/python/pythran/pythran/types/type_dependencies.py b/contrib/python/pythran/pythran/types/type_dependencies.py
index 15674ceecec..8edc40c68db 100644
--- a/contrib/python/pythran/pythran/types/type_dependencies.py
+++ b/contrib/python/pythran/pythran/types/type_dependencies.py
@@ -9,14 +9,18 @@ from pythran.errors import PythranInternalError
from pythran.passmanager import ModuleAnalysis
from pythran.types.conversion import PYTYPE_TO_CTYPE_TABLE
from pythran.utils import get_variable
-from pythran.typing import List, Set, Dict, NDArray, Tuple, Pointer, Fun
+from pythran.typing import List, Set, Dict, NDArray, Tuple, Pointer, Fun, Type
from pythran.graph import DiGraph
def pytype_to_deps_hpp(t):
"""python -> pythonic type hpp filename."""
- if isinstance(t, List):
+ if t in (list, set, dict, tuple):
+ return {f"{t.__name__}.hpp"}
+ elif isinstance(t, List):
return {'list.hpp'}.union(pytype_to_deps_hpp(t.__args__[0]))
+ elif isinstance(t, Type):
+ return {'type.hpp'}.union(pytype_to_deps_hpp(t.__args__[0]))
elif isinstance(t, Set):
return {'set.hpp'}.union(pytype_to_deps_hpp(t.__args__[0]))
elif isinstance(t, Dict):
diff --git a/contrib/python/pythran/pythran/types/types.py b/contrib/python/pythran/pythran/types/types.py
index 40cfcdf0308..a6c0752f6f3 100644
--- a/contrib/python/pythran/pythran/types/types.py
+++ b/contrib/python/pythran/pythran/types/types.py
@@ -17,7 +17,7 @@ from pythran.tables import operator_to_lambda, MODULES
from pythran.typing import List, Dict, Set, Tuple, NDArray, Union
from pythran.types.conversion import pytype_to_ctype, PYTYPE_TO_CTYPE_TABLE
from pythran.types.reorder import Reorder
-from pythran.utils import attr_to_path, cxxid, isnum, isextslice
+from pythran.utils import attr_to_path, isnum, isextslice
from collections import defaultdict
from functools import reduce
@@ -76,7 +76,7 @@ def alias_key(a):
if isinstance(a, ast.Call):
return ('call:',) + alias_key(a.func)
if isinstance(a, ContainerOf):
- return sum((alias_key(c) for c in sorted(a.containees, key=alias_key)), ())
+ return sum((alias_key(c) for c in sorted(a.containees, key=alias_key)), (str(a.index),))
if isinstance(a, ast.Constant):
return ('cst:', str(a.value))
# FIXME: how could we order those?
@@ -353,9 +353,9 @@ class Types(ModuleAnalysis[Reorder, StrictAliases, LazynessAnalysis,
# integral index make it possible to correctly
# update tuple type
if isinstance(index, int):
- kty = self.builder.NamedType(
- 'std::integral_constant<long,{}>'
- .format(index))
+ kty = self.builder.IntegralConstant(
+ self.builder.NamedType("long"),
+ index)
return self.builder.IndexableContainerType(kty,
ty)
elif isinstance(index, float):
@@ -368,20 +368,24 @@ class Types(ModuleAnalysis[Reorder, StrictAliases, LazynessAnalysis,
for node_alias in self.sorted_strict_aliases(name,
extra=[name]):
- def traverse_alias(alias, l):
+ def traverse_alias(alias, depth, l):
+ # not interested in aliases too deep
+ if len(depth) <= l:
+ return
if isinstance(alias, ContainerOf):
- for containee in sorted(alias.containees,
- key=alias_key):
- traverse_alias(containee, l + 1)
+ d = depth[l]
+ if d is None or np.isnan(alias.index) or d == alias.index:
+ for containee in sorted(alias.containees, key=alias_key):
+ traverse_alias(containee, depth, l + 1)
else:
def local_op(*args):
- return reduce(merge_container_type,
- depth[:-l] if l else depth,
+ t = reduce(merge_container_type,
+ depth[l:],
former_op(*args))
- if len(depth) > l:
- self.combine_(alias, local_op, othernode)
+ return t
+ self.combine_(alias, local_op, othernode)
- traverse_alias(node_alias, 0)
+ traverse_alias(node_alias, depth, 0)
return
except UnboundableRValue:
pass
@@ -394,6 +398,12 @@ class Types(ModuleAnalysis[Reorder, StrictAliases, LazynessAnalysis,
if isinstance(container_type, (self.builder.ListType,
self.builder.SetType)):
return container_type.of
+ if isinstance(container_type, self.builder.IndexableContainerType):
+ if np.isnan(node.index):
+ return container_type.of_val
+ elif isinstance(container_type.of_key, self.builder.IntegralConstant):
+ if container_type.of_key.index != node.index:
+ raise NotImplementedError
return self.builder.ElementType(
0 if np.isnan(node.index) else node.index,
container_type)
@@ -710,11 +720,16 @@ class Types(ModuleAnalysis[Reorder, StrictAliases, LazynessAnalysis,
sty = pytype_to_ctype(ty)
if node in self.immediates:
if sty == 'pythonic::types::chr':
- sty = "std::integral_constant<char, '%s'>" % (node.value)
+ sty = self.builder.IntegralConstant(
+ self.builder.NamedType("char"),
+ f"'{node.value}'")
else:
- sty = "std::integral_constant<%s, %s>" % (sty,
- str(node.value).lower())
- self.result[node] = self.builder.NamedType(sty)
+ sty = self.builder.IntegralConstant(
+ self.builder.NamedType(sty),
+ node.value)
+ else:
+ sty = self.builder.NamedType(sty)
+ self.result[node] = sty
def visit_Attribute(self, node):
""" Compute typing for an attribute node. """
@@ -724,8 +739,7 @@ class Types(ModuleAnalysis[Reorder, StrictAliases, LazynessAnalysis,
typename = pytype_to_ctype(obj.signature)
self.result[node] = self.builder.NamedType(typename)
else:
- path = '::'.join(map(cxxid, path)) + '{}'
- self.result[node] = self.builder.DeclType(path)
+ self.result[node] = self.builder.FunctionType(*path)
def visit_Slice(self, node):
"""
diff --git a/contrib/python/pythran/pythran/typing.py b/contrib/python/pythran/pythran/typing.py
index 3ead03a1927..01a3ebc4a87 100644
--- a/contrib/python/pythran/pythran/typing.py
+++ b/contrib/python/pythran/pythran/typing.py
@@ -28,6 +28,12 @@ class ListMeta(type):
return List(item)
+class TypeMeta(type):
+
+ def __getitem__(cls, item):
+ return Type(item)
+
+
class IterableMeta(type):
def __getitem__(cls, item):
@@ -64,7 +70,7 @@ class PointerMeta(type):
return Pointer(item)
-class Type(type):
+class TypeBase(type):
def __new__(cls, args):
return type.__new__(
@@ -78,47 +84,47 @@ class Type(type):
pass
-class Fun(Type, metaclass=FunMeta):
+class Fun(TypeBase, metaclass=FunMeta):
pass
-class Dict(Type, metaclass=DictMeta):
+class Dict(TypeBase, metaclass=DictMeta):
pass
-class Union(Type, metaclass=UnionMeta):
+class Union(TypeBase, metaclass=UnionMeta):
pass
-class Set(Type, metaclass=SetMeta):
+class Set(TypeBase, metaclass=SetMeta):
pass
-class List(Type, metaclass=ListMeta):
+class List(TypeBase, metaclass=ListMeta):
pass
-class Iterable(Type, metaclass=IterableMeta):
+class Iterable(TypeBase, metaclass=IterableMeta):
pass
-class Generator(Type, metaclass=GeneratorMeta):
+class Generator(TypeBase, metaclass=GeneratorMeta):
pass
-class Tuple(Type, metaclass=TupleMeta):
+class Tuple(TypeBase, metaclass=TupleMeta):
pass
-class Optional(Type, metaclass=OptionalMeta):
+class Optional(TypeBase, metaclass=OptionalMeta):
pass
-class NDArray(Type, metaclass=NDArrayMeta):
+class NDArray(TypeBase, metaclass=NDArrayMeta):
pass
-class Pointer(Type, metaclass=PointerMeta):
+class Pointer(TypeBase, metaclass=PointerMeta):
pass
@@ -138,3 +144,7 @@ class Any(object):
class File(object):
pass
+
+
+class Type(TypeBase, metaclass=TypeMeta):
+ pass
diff --git a/contrib/python/pythran/pythran/utils.py b/contrib/python/pythran/pythran/utils.py
index 55a7e8ad6f9..f60aec447e8 100644
--- a/contrib/python/pythran/pythran/utils.py
+++ b/contrib/python/pythran/pythran/utils.py
@@ -105,8 +105,8 @@ def get_variable(assignable):
... ctx=ast.Load()),
... slice=ast.Name('j', ast.Load(), None, None),
... ctx=ast.Load())
- >>> ast.dump(get_variable(ref))
- "Name(id='a', ctx=Load())"
+ >>> get_variable(ref).id
+ 'a'
"""
msg = "Only name and subscript can be assigned."
assert isinstance(assignable, (ast.Name, ast.Subscript)), msg
diff --git a/contrib/python/pythran/pythran/version.py b/contrib/python/pythran/pythran/version.py
index f083a1bd668..062ca1d78a6 100644
--- a/contrib/python/pythran/pythran/version.py
+++ b/contrib/python/pythran/pythran/version.py
@@ -1,2 +1,2 @@
-__version__ = '0.18.0'
+__version__ = '0.18.1'
__descr__ = 'Ahead of Time compiler for numeric kernels'
diff --git a/contrib/python/pythran/pythran/xsimd/arch/xsimd_avx.hpp b/contrib/python/pythran/pythran/xsimd/arch/xsimd_avx.hpp
index f41702babac..e6b4f296d7f 100644
--- a/contrib/python/pythran/pythran/xsimd/arch/xsimd_avx.hpp
+++ b/contrib/python/pythran/pythran/xsimd/arch/xsimd_avx.hpp
@@ -355,7 +355,7 @@ namespace xsimd
{
return _mm256_castsi256_pd(self);
}
- template <class A, class T, class Tp, class = typename std::enable_if<std::is_integral<typename std::common_type<T, Tp>::type>::value, void>::type>
+ template <class A, class T, class Tp, class = typename std::enable_if<std::is_integral<std::common_type_t<T, Tp>>::value, void>::type>
XSIMD_INLINE batch<Tp, A> bitwise_cast(batch<T, A> const& self, batch<Tp, A> const&, requires_arch<avx>) noexcept
{
return batch<Tp, A>(self.data);
diff --git a/contrib/python/pythran/ya.make b/contrib/python/pythran/ya.make
index ace834763b2..2263f1298d0 100644
--- a/contrib/python/pythran/ya.make
+++ b/contrib/python/pythran/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(0.18.0)
+VERSION(0.18.1)
LICENSE(BSD-3-Clause)