| 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 : |
#ifndef PYTHONIC_NUMPY_UNION1D_HPP
#define PYTHONIC_NUMPY_UNION1D_HPP
#include "pythonic/include/numpy/union1d.hpp"
#include "pythonic/utils/functor.hpp"
#include "pythonic/types/ndarray.hpp"
#include <set>
PYTHONIC_NS_BEGIN
namespace numpy
{
namespace
{
template <class I, class O>
void _union1d(I begin, I end, O &out, utils::int_<1>)
{
for (; begin != end; ++begin)
out.insert(*begin);
}
template <class I, class O, size_t N>
void _union1d(I begin, I end, O &out, utils::int_<N>)
{
for (; begin != end; ++begin)
_union1d((*begin).begin(), (*begin).end(), out, utils::int_<N - 1>());
}
}
template <class E, class F>
types::ndarray<
typename __combined<typename E::dtype, typename F::dtype>::type,
types::pshape<long>>
union1d(E const &e, F const &f)
{
std::set<typename __combined<typename E::dtype, typename F::dtype>::type>
res;
_union1d(e.begin(), e.end(), res, utils::int_<E::value>());
_union1d(f.begin(), f.end(), res, utils::int_<F::value>());
return {res};
}
}
PYTHONIC_NS_END
#endif