| Home | Libraries | People | FAQ | More

### Quaternion Specializations

    namespace boost{ namespace math{

    template<>
    class quaternion<float>
    {
    public:
       typedef float value_type;

       explicit quaternion(float const & requested_a = 0.0f, float const & requested_b = 0.0f, float const & requested_c = 0.0f, float const & requested_d = 0.0f);
       explicit quaternion(::std::complex<float> const & z0, ::std::complex<float> const & z1 = ::std::complex<float>());
       explicit quaternion(quaternion<double> const & a_recopier);
       explicit quaternion(quaternion<long double> const & a_recopier);

       float                  real() const;
       quaternion<float>      unreal() const;
       float                  R_component_1() const;
       float                  R_component_2() const;
       float                  R_component_3() const;
       float                  R_component_4() const;
       ::std::complex<float>  C_component_1() const;
       ::std::complex<float>  C_component_2() const;

       quaternion<float>&     operator = (quaternion<float> const  & a_affecter);
       template<typename X>
       quaternion<float>&     operator = (quaternion<X> const  & a_affecter);
       quaternion<float>&     operator = (float const  & a_affecter);
       quaternion<float>&     operator = (::std::complex<float> const & a_affecter);

       quaternion<float>&     operator += (float const & rhs);
       quaternion<float>&     operator += (::std::complex<float> const & rhs);
       template<typename X>
       quaternion<float>&     operator += (quaternion<X> const & rhs);

       quaternion<float>&     operator -= (float const & rhs);
       quaternion<float>&     operator -= (::std::complex<float> const & rhs);
       template<typename X>
       quaternion<float>&     operator -= (quaternion<X> const & rhs);

       quaternion<float>&     operator *= (float const & rhs);
       quaternion<float>&     operator *= (::std::complex<float> const & rhs);
       template<typename X>
       quaternion<float>&     operator *= (quaternion<X> const & rhs);

       quaternion<float>&     operator /= (float const & rhs);
       quaternion<float>&     operator /= (::std::complex<float> const & rhs);
       template<typename X>
       quaternion<float>&     operator /= (quaternion<X> const & rhs);
    };

    template<>
    class quaternion<double>
    {
    public:
       typedef double value_type;

       explicit quaternion(double const & requested_a = 0.0, double const & requested_b = 0.0, double const & requested_c = 0.0, double const & requested_d = 0.0);
       explicit quaternion(::std::complex<double> const & z0, ::std::complex<double> const & z1 = ::std::complex<double>());
       explicit quaternion(quaternion<float> const & a_recopier);
       explicit quaternion(quaternion<long double> const & a_recopier);

       double                  real() const;
       quaternion<double>      unreal() const;
       double                  R_component_1() const;
       double                  R_component_2() const;
       double                  R_component_3() const;
       double                  R_component_4() const;
       ::std::complex<double>  C_component_1() const;
       ::std::complex<double>  C_component_2() const;

       quaternion<double>&     operator = (quaternion<double> const  & a_affecter);
       template<typename X>
       quaternion<double>&     operator = (quaternion<X> const  & a_affecter);
       quaternion<double>&     operator = (double const  & a_affecter);
       quaternion<double>&     operator = (::std::complex<double> const & a_affecter);

       quaternion<double>&     operator += (double const & rhs);
       quaternion<double>&     operator += (::std::complex<double> const & rhs);
       template<typename X>
       quaternion<double>&     operator += (quaternion<X> const & rhs);

       quaternion<double>&     operator -= (double const & rhs);
       quaternion<double>&     operator -= (::std::complex<double> const & rhs);
       template<typename X>
       quaternion<double>&     operator -= (quaternion<X> const & rhs);

       quaternion<double>&     operator *= (double const & rhs);
       quaternion<double>&     operator *= (::std::complex<double> const & rhs);
       template<typename X>
       quaternion<double>&     operator *= (quaternion<X> const & rhs);

       quaternion<double>&     operator /= (double const & rhs);
       quaternion<double>&     operator /= (::std::complex<double> const & rhs);
       template<typename X>
       quaternion<double>&     operator /= (quaternion<X> const & rhs);
    };

    template<>
    class quaternion<long double>
    {
    public:
       typedef long double value_type;

       explicit quaternion(long double const & requested_a = 0.0L, long double const & requested_b = 0.0L, long double const & requested_c = 0.0L, long double const & requested_d = 0.0L);
       explicit quaternion(::std::complex<long double> const & z0, ::std::complex<long double> const & z1 = ::std::complex<long double>());
       explicit quaternion(quaternion<float> const & a_recopier);
       explicit quaternion(quaternion<double> const & a_recopier);

       long double                  real() const;
       quaternion<long double>      unreal() const;
       long double                  R_component_1() const;
       long double                  R_component_2() const;
       long double                  R_component_3() const;
       long double                  R_component_4() const;
       ::std::complex<long double>  C_component_1() const;
       ::std::complex<long double>  C_component_2() const;

       quaternion<long double>&     operator = (quaternion<long double> const  & a_affecter);
       template<typename X>
       quaternion<long double>&     operator = (quaternion<X> const  & a_affecter);
       quaternion<long double>&     operator = (long double const  & a_affecter);
       quaternion<long double>&     operator = (::std::complex<long double> const & a_affecter);

       quaternion<long double>&     operator += (long double const & rhs);
       quaternion<long double>&     operator += (::std::complex<long double> const & rhs);
       template<typename X>
       quaternion<long double>&     operator += (quaternion<X> const & rhs);

       quaternion<long double>&     operator -= (long double const & rhs);
       quaternion<long double>&     operator -= (::std::complex<long double> const & rhs);
       template<typename X>
       quaternion<long double>&     operator -= (quaternion<X> const & rhs);

       quaternion<long double>&     operator *= (long double const & rhs);
       quaternion<long double>&     operator *= (::std::complex<long double> const & rhs);
       template<typename X>
       quaternion<long double>&     operator *= (quaternion<X> const & rhs);

       quaternion<long double>&     operator /= (long double const & rhs);
       quaternion<long double>&     operator /= (::std::complex<long double> const & rhs);
       template<typename X>
       quaternion<long double>&     operator /= (quaternion<X> const & rhs);
    };

    } // namespace math
    } // namespace boost