%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/pythran/pythonic/numpy/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/pythran/pythonic/numpy/clip.hpp

#ifndef PYTHONIC_NUMPY_CLIP_HPP
#define PYTHONIC_NUMPY_CLIP_HPP

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

#include "pythonic/utils/functor.hpp"
#include "pythonic/types/ndarray.hpp"

PYTHONIC_NS_BEGIN

namespace numpy
{
  namespace wrapper
  {
    template <class T, class Mi, class Ma>
    typename __combined<T, Mi, Ma>::type clip(T const &v, Mi a_min, Ma a_max)
    {
      if (v < a_min)
        return a_min;
      else if (v > a_max)
        return a_max;
      else
        return v;
    }

    template <class T, class Mi>
    typename __combined<T, Mi>::type clip(T const &v, Mi a_min)
    {
      if (v < a_min)
        return a_min;
      else
        return v;
    }
  }

#define NUMPY_NARY_FUNC_NAME clip
#define NUMPY_NARY_FUNC_SYM wrapper::clip
#include "pythonic/types/numpy_nary_expr.hpp"
}
PYTHONIC_NS_END

#endif

Zerion Mini Shell 1.0