Name

Quaternions: Quaternions are a relative of complex numbers.


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>  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

Detailed Description

Click here for more details.


Limitation

None


Feedback

For additional information or queries on this page send feedback.


© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top

Legal Disclaimer Please note, that by using some of the links in this document you will leave the Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. website and the site you enter is not operated by Nokia. If you choose to access such sites, you should take precautions for security or content. By using the site, you shall review and agree to the site's rules of use before using the site. You agree and acknowledge that Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. has no control over the service and will not assume any liability or responsibility for the availability of the site, nor for any aspects of the service.