Template Class octonion

| Home | Libraries | People | FAQ | More

### Template Class octonion

    namespace boost{ namespace math {

    template<typename T>
    class octonion
    {
    public:
       typedef T value_type;

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

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

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

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

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

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

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

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

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

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

    } } // namespaces