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/allclose.hpp
#ifndef PYTHONIC_NUMPY_ALLCLOSE_HPP
#define PYTHONIC_NUMPY_ALLCLOSE_HPP

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

#include "pythonic/utils/functor.hpp"
#include "pythonic/types/ndarray.hpp"
#include "pythonic/numpy/abs.hpp"
#include "pythonic/numpy/isfinite.hpp"

PYTHONIC_NS_BEGIN

namespace numpy
{
  namespace
  {
    template <class I0, class I1>
    bool _allclose(I0 begin, I0 end, I1 ibegin, double rtol, double atol,
                   utils::int_<1>)
    {
      for (; begin != end; ++begin, ++ibegin) {
        auto u = *begin;
        auto v = *ibegin;
        if (((!functor::isfinite()(u) || !functor::isfinite()(v)) &&
             u != v) || // Infinite && NaN cases
            functor::abs()(u - v) > (atol + rtol * functor::abs()(v))) {
          return false;
        }
      }
      return true;
    }

    template <class I0, class I1, size_t 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>()))
          return false;
      return true;
    }
  }

  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>());
  }
}
PYTHONIC_NS_END

#endif

Youez - 2016 - github.com/yon3zu
LinuXploit