#pragma once
namespace __jitify_complex_ns {
    template<typename T>
	class complex {
        T _real;
        T _imag;
    public:
    complex() : _real(0), _imag(0) {}
    complex(T const& real, T const& imag)
        : _real(real), _imag(imag) {}
    complex(T const& real)
        : _real(real), _imag(static_cast<T>(0)) {}
        T const& real() const { return _real; }
        T&       real()       { return _real; }
        void real(const T &r) { _real = r; }
        T const& imag() const { return _imag; }
        T&       imag()       { return _imag; }
        void imag(const T &i) { _imag = i; }
        complex<T>& operator+=(const complex<T> z)
        { _real += z.real(); _imag += z.imag(); return *this; }
    };
    template<typename T>
        complex<T> operator*(const complex<T>& lhs, const complex<T>& rhs)
    { return complex<T>(lhs.real()*rhs.real()-lhs.imag()*rhs.imag(),
                        lhs.real()*rhs.imag()+lhs.imag()*rhs.real()); }
    template<typename T>
        complex<T> operator*(const complex<T>& lhs, const T & rhs)
    { return complexs<T>(lhs.real()*rhs,lhs.imag()*rhs); }
    template<typename T>
        complex<T> operator*(const T& lhs, const complex<T>& rhs)
    { return complexs<T>(rhs.real()*lhs,rhs.imag()*lhs); }
} // namespace __jitify_complex_ns
namespace std { using namespace __jitify_complex_ns; }
using namespace __jitify_complex_ns;
