| Home | Libraries | People | FAQ | More

## Synopsis

    namespace boost{ namespace math{

    template<typename T> class quaternion;
    template<>           class quaternion<float>;
    template<>           class quaternion<double>;
    template<>           class quaternion<long double>;

    // operators
    template<typename T> quaternion<T> operator + (T const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator + (quaternion<T> const & lhs, T const & rhs);
    template<typename T> quaternion<T> operator + (::std::complex<T> const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator + (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
    template<typename T> quaternion<T> operator + (quaternion<T> const & lhs, quaternion<T> const & rhs);

    template<typename T> quaternion<T> operator - (T const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator - (quaternion<T> const & lhs, T const & rhs);
    template<typename T> quaternion<T> operator - (::std::complex<T> const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator - (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
    template<typename T> quaternion<T> operator - (quaternion<T> const & lhs, quaternion<T> const & rhs);

    template<typename T> quaternion<T> operator * (T const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator * (quaternion<T> const & lhs, T const & rhs);
    template<typename T> quaternion<T> operator * (::std::complex<T> const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator * (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
    template<typename T> quaternion<T> operator * (quaternion<T> const & lhs, quaternion<T> const & rhs);

    template<typename T> quaternion<T> operator / (T const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator / (quaternion<T> const & lhs, T const & rhs);
    template<typename T> quaternion<T> operator / (::std::complex<T> const & lhs, quaternion<T> const & rhs);
    template<typename T> quaternion<T> operator / (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
    template<typename T> quaternion<T> operator / (quaternion<T> const & lhs, quaternion<T> const & rhs);

    template<typename T> quaternion<T> operator + (quaternion<T> const & q);
    template<typename T> quaternion<T> operator - (quaternion<T> const & q);

    template<typename T> bool operator == (T const & lhs, quaternion<T> const & rhs);
    template<typename T> bool operator == (quaternion<T> const & lhs, T const & rhs);
    template<typename T> bool operator == (::std::complex<T> const & lhs, quaternion<T> const & rhs);
    template<typename T> bool operator == (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
    template<typename T> bool operator == (quaternion<T> const & lhs, quaternion<T> const & rhs);

    template<typename T> bool operator != (T const & lhs, quaternion<T> const & rhs);
    template<typename T> bool operator != (quaternion<T> const & lhs, T const & rhs);
    template<typename T> bool operator != (::std::complex<T> const & lhs, quaternion<T> const & rhs);
    template<typename T> bool operator != (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
    template<typename T> bool operator != (quaternion<T> const & lhs, quaternion<T> const & rhs);

    template<typename T, typename charT, class traits>
    ::std::basic_istream<charT,traits>& operator >> (::std::basic_istream<charT,traits> & is, quaternion<T> & q);

    template<typename T, typename charT, class traits>
    ::std::basic_ostream<charT,traits>& operator operator << (::std::basic_ostream<charT,traits> & os, quaternion<T> const & q);

    // values
    template<typename T> T              real(quaternion<T> const & q);
    template<typename T> quaternion<T>  unreal(quaternion<T> const & q);

    template<typename T> T              sup(quaternion<T> const & q);
    template<typename T> T              l1(quaternion<T> const & q);
    template<typename T> T              abs(quaternion<T> const & q);
    template<typename T> T              norm(quaternion<T>const  & q);
    template<typename T> quaternion<T>  conj(quaternion<T> const & q);

    template<typename T> quaternion<T>  math_quaternions.creation_spherical(T const & rho, T const & theta, T const & phi1, T const & phi2);
    template<typename T> quaternion<T>  semipolar(T const & rho, T const & alpha, T const & theta1, T const & theta2);
    template<typename T> quaternion<T>  multipolar(T const & rho1, T const & theta1, T const & rho2, T const & theta2);
    template<typename T> quaternion<T>  cylindrospherical(T const & t, T const & radius, T const & longitude, T const & latitude);
    template<typename T> quaternion<T>  cylindrical(T const & r, T const & angle, T const & h1, T const & h2);

    // transcendentals
    template<typename T> quaternion<T>  exp(quaternion<T> const & q);
    template<typename T> quaternion<T>  cos(quaternion<T> const & q);
    template<typename T> quaternion<T>  sin(quaternion<T> const & q);
    template<typename T> quaternion<T>  tan(quaternion<T> const & q);
    template<typename T> quaternion<T>  cosh(quaternion<T> const & q);
    template<typename T> quaternion<T>  sinh(quaternion<T> const & q);
    template<typename T> quaternion<T>  tanh(quaternion<T> const & q);
    template<typename T> quaternion<T>  pow(quaternion<T> const & q, int n);

    } // namespace math
    } // namespace boost