#ifndef PYTHONIC_INCLUDE_NUMPY_LINALG_NORM_HPP #define PYTHONIC_INCLUDE_NUMPY_LINALG_NORM_HPP #include "pythonic/include/numpy/sqrt.hpp" #include "pythonic/include/builtins/pythran/abssqr.hpp" #include "pythonic/include/numpy/sum.hpp" #include "pythonic/include/numpy/asfarray.hpp" PYTHONIC_NS_BEGIN namespace numpy { namespace linalg { template auto norm(Array &&array, types::none_type ord = {}, types::none_type axis = {}) -> decltype( pythonic::numpy::functor::sqrt{}(pythonic::numpy::functor::sum{}( pythonic::builtins::pythran::functor::abssqr{}( std::forward(array))))); template using norm_dtype_t = typename std::conditional< std::is_floating_point< typename std::decay::type::dtype()>::value, typename std::decay::type::dtype(), double>::type; template using norm_t = typename std::conditional< std::decay::type::value == 1, norm_dtype_t, types::ndarray< norm_dtype_t, types::array::type::value - 1>>>::type; template norm_t norm(Array &&array, double ord, types::none_type axis = {}); template norm_t norm(Array &&array, types::none_type ord, double axis); template norm_t norm(Array &&array, double ord, long axis); template norm_t norm(Array &&array, double ord, types::array axis); template norm_t norm(Array &&array, double ord, types::array axis); DEFINE_FUNCTOR(pythonic::numpy::linalg, norm); } } PYTHONIC_NS_END #endif