| Home | Libraries | People | FAQ | More

## Octonion Specializations

    namespace boost{ namespace math{

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

       explicit  octonion(float const & requested_a = 0.0f, float const & requested_b = 0.0f, float const & requested_c = 0.0f, float const & requested_d = 0.0f, float const & requested_e = 0.0f, float const & requested_f = 0.0f, float const & requested_g = 0.0f, float const & requested_h = 0.0f);
       explicit  octonion(::std::complex<float> const & z0, ::std::complex<float> const & z1 = ::std::complex<float>(), ::std::complex<float> const & z2 = ::std::complex<float>(), ::std::complex<float> const & z3 = ::std::complex<float>());
       explicit  octonion(::boost::math::quaternion<float> const & q0, ::boost::math::quaternion<float> const & q1 = ::boost::math::quaternion<float>());
       explicit  octonion(octonion<double> const & a_recopier);
       explicit  octonion(octonion<long double> const & a_recopier);

       float                             real() const;
       octonion<float>                   unreal() const;

       float                             R_component_1() const;
       float                             R_component_2() const;
       float                             R_component_3() const;
       float                             R_component_4() const;
       float                             R_component_5() const;
       float                             R_component_6() const;
       float                             R_component_7() const;
       float                             R_component_8() const;

       ::std::complex<float>             C_component_1() const;
       ::std::complex<float>             C_component_2() const;
       ::std::complex<float>             C_component_3() const;
       ::std::complex<float>             C_component_4() const;

       ::boost::math::quaternion<float>  H_component_1() const;
       ::boost::math::quaternion<float>  H_component_2() const;

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

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

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

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

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

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

       explicit  octonion(double const & requested_a = 0.0, double const & requested_b = 0.0, double const & requested_c = 0.0, double const & requested_d = 0.0, double const & requested_e = 0.0, double const & requested_f = 0.0, double const & requested_g = 0.0, double const & requested_h = 0.0);
       explicit  octonion(::std::complex<double> const & z0, ::std::complex<double> const & z1 = ::std::complex<double>(), ::std::complex<double> const & z2 = ::std::complex<double>(), ::std::complex<double> const & z3 = ::std::complex<double>());
       explicit  octonion(::boost::math::quaternion<double> const & q0, ::boost::math::quaternion<double> const & q1 = ::boost::math::quaternion<double>());
       explicit  octonion(octonion<float> const & a_recopier);
       explicit  octonion(octonion<long double> const & a_recopier);

       double                             real() const;
       octonion<double>                   unreal() const;

       double                             R_component_1() const;
       double                             R_component_2() const;
       double                             R_component_3() const;
       double                             R_component_4() const;
       double                             R_component_5() const;
       double                             R_component_6() const;
       double                             R_component_7() const;
       double                             R_component_8() const;

       ::std::complex<double>             C_component_1() const;
       ::std::complex<double>             C_component_2() const;
       ::std::complex<double>             C_component_3() const;
       ::std::complex<double>             C_component_4() const;

       ::boost::math::quaternion<double>  H_component_1() const;
       ::boost::math::quaternion<double>  H_component_2() const;

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

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

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

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

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

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

       explicit   octonion(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, long double const & requested_e = 0.0L, long double const & requested_f = 0.0L, long double const & requested_g = 0.0L, long double const & requested_h = 0.0L);
       explicit   octonion( ::std::complex<long double> const & z0, ::std::complex<long double> const & z1 = ::std::complex<long double>(), ::std::complex<long double> const & z2 = ::std::complex<long double>(), ::std::complex<long double> const & z3 = ::std::complex<long double>());
       explicit   octonion( ::boost::math::quaternion<long double> const & q0, ::boost::math::quaternion<long double> const & z1 = ::boost::math::quaternion<long double>());
       explicit   octonion(octonion<float> const & a_recopier);
       explicit   octonion(octonion<double> const & a_recopier);

       long double                             real() const;
       octonion<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;
       long double                             R_component_5() const;
       long double                             R_component_6() const;
       long double                             R_component_7() const;
       long double                             R_component_8() const;

       ::std::complex<long double>             C_component_1() const;
       ::std::complex<long double>             C_component_2() const;
       ::std::complex<long double>             C_component_3() const;
       ::std::complex<long double>             C_component_4() const;

       ::boost::math::quaternion<long double>  H_component_1() const;
       ::boost::math::quaternion<long double>  H_component_2() const;

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

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

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

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

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

    } } // namespaces