From 159ef14fb9e198bb0066ea14e6b980f065de63dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= Date: Tue, 31 Jul 2018 16:22:25 +0200 Subject: New upstream version 0.8.0+dfsg --- silx/math/combo.pyx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'silx/math/combo.pyx') diff --git a/silx/math/combo.pyx b/silx/math/combo.pyx index 95676af..3fd9f66 100644 --- a/silx/math/combo.pyx +++ b/silx/math/combo.pyx @@ -30,20 +30,10 @@ of first occurrences (i.e., argmin/argmax) in a single pass. __authors__ = ["T. Vincent"] __license__ = "MIT" -__date__ = "18/10/2017" +__date__ = "24/04/2018" cimport cython - -# Windows compatibility: Cross-platform INFINITY -from libc.float cimport DBL_MAX -cdef double INFINITY = DBL_MAX + DBL_MAX -# from libc.math cimport INFINITY - -# Replacement from libc.math cimport isnan -# which is not available on Windows for Python2.7 -cdef extern from "isnan.h": - bint isnan(double x) nogil - bint isfinite(double x) nogil +from math_compatibility cimport isnan, isfinite, INFINITY import numpy @@ -281,6 +271,11 @@ def min_max(data not None, bint min_positive=False, bint finite=False): NaNs are ignored while computing min/max unless all data is NaNs, in which case returned min/max are NaNs. + The result data type is that of the input data, except for the following cases. + For input using non-native bytes order, the result is returned as native + floating-point or integers. For input using 16-bits floating-point, + the result is returned as 32-bits floating-point. + Examples: >>> import numpy @@ -324,6 +319,9 @@ def min_max(data not None, bint min_positive=False, bint finite=False): """ data = numpy.array(data, copy=False) native_endian_dtype = data.dtype.newbyteorder('N') + if native_endian_dtype.kind == 'f' and native_endian_dtype.itemsize == 2: + # Use native float32 instead of float16 + native_endian_dtype = "=f4" data = numpy.ascontiguousarray(data, dtype=native_endian_dtype).ravel() if finite and data.dtype.kind == 'f': return _finite_min_max(data, min_positive) -- cgit v1.2.3