summaryrefslogtreecommitdiffstats
path: root/contrib/python/pythran/pythran/pythonic/numpy/ptp.hpp
blob: 572f7b2e236de9c250da93635ef6ec3178ab9394 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef PYTHONIC_NUMPY_PTP_HPP
#define PYTHONIC_NUMPY_PTP_HPP

#include "pythonic/include/numpy/ptp.hpp"

#include "pythonic/numpy/min.hpp"
#include "pythonic/numpy/max.hpp"

PYTHONIC_NS_BEGIN

namespace numpy
{
  template <class E>
  auto ptp(E const &expr, long axis)
      -> decltype(max(expr, axis) - min(expr, axis))
  {
    return max(expr, axis) - min(expr, axis);
  }

  template <class E>
  auto ptp(E const &expr) -> decltype(max(expr) - min(expr))
  {
    return max(expr) - min(expr);
  }
}
PYTHONIC_NS_END

#endif