From dceafaadef7c346d6bb6318714d193e73c90903f Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 5 Apr 2006 12:33:15 +0000 Subject: [PATCH] Removed old docs: the quickbook version now takes over. [SVN r33559] --- doc/common_factor.html | 263 -------- doc/index.html | 101 --- octonion/index.html | 58 -- octonion/octonion.html | 731 ---------------------- quaternion/index.html | 58 -- quaternion/quaternion.html | 634 ------------------- special_functions/index.html | 60 -- special_functions/inverse_hyperbolic.html | 49 -- special_functions/sinc_sinhc.html | 29 - special_functions/special_functions.html | 118 ---- 10 files changed, 2101 deletions(-) delete mode 100644 doc/common_factor.html delete mode 100644 doc/index.html delete mode 100644 octonion/index.html delete mode 100644 octonion/octonion.html delete mode 100644 quaternion/index.html delete mode 100644 quaternion/quaternion.html delete mode 100644 special_functions/index.html delete mode 100644 special_functions/inverse_hyperbolic.html delete mode 100644 special_functions/sinc_sinhc.html delete mode 100644 special_functions/special_functions.html diff --git a/doc/common_factor.html b/doc/common_factor.html deleted file mode 100644 index eb39e3cf1..000000000 --- a/doc/common_factor.html +++ /dev/null @@ -1,263 +0,0 @@ - - - -Boost GCD & LCM Library - - - -

-boost.png (6897 bytes)Greatest Common Divisor
- Least -Common Multiple

- -

The class and function templates in <boost/math/common_factor.hpp> - provide run-time and compile-time evaluation of the greatest -common divisor (GCD) or least common multiple (LCM) of two integers. -These facilities are useful for many numeric-oriented generic -programming problems.

- -

Contents

- - - -

Header <boost/math/common_factor.hpp>

- -

This header simply includes the headers <boost/math/common_factor_ct.hpp> -and <boost/math/common_factor_rt.hpp>. -It used to contain the code, but the compile-time and run-time -facilities were moved to separate headers (since they were independent), -and this header maintains compatibility.

- -

Synopsis

- -
namespace boost
-{
-namespace math
-{
-
-template < typename IntegerType >
-    class gcd_evaluator;
-template < typename IntegerType >
-    class lcm_evaluator;
-
-template < typename IntegerType >
-    IntegerType  gcd( IntegerType const &a, IntegerType const &b );
-template < typename IntegerType >
-    IntegerType  lcm( IntegerType const &a, IntegerType const &b );
-
-template < unsigned long Value1, unsigned long Value2 >
-    struct static_gcd;
-template < unsigned long Value1, unsigned long Value2 >
-    struct static_lcm;
-
-}
-}
-
- -

Header <boost/math/common_factor_rt.hpp>

- -

GCD Function Object

- -
template < typename IntegerType >
-class boost::math::gcd_evaluator
-{
-public:
-    // Types
-    typedef IntegerType  result_type;
-    typedef IntegerType  first_argument_type;
-    typedef IntegerType  second_argument_type;
-
-    // Function object interface
-    result_type  operator ()( first_argument_type const &a,
-     second_argument_type const &b ) const;
-};
-
- -

The boost::math::gcd_evaluator class template defines a -function object class to return the greatest common divisor of two -integers. The template is parameterized by a single type, called -IntegerType here. This type should be a numeric type that -represents integers. The result of the function object is always -nonnegative, even if either of the operator arguments is negative.

- -

This function object class template is used in the corresponding -version of the GCD function template. If a -numeric type wants to customize evaluations of its greatest common -divisors, then the type should specialize on the -gcd_evaluator class template.

- -

LCM Function Object

- -
template < typename IntegerType >
-class boost::math::lcm_evaluator
-{
-public:
-    // Types
-    typedef IntegerType  result_type;
-    typedef IntegerType  first_argument_type;
-    typedef IntegerType  second_argument_type;
-
-    // Function object interface
-    result_type  operator ()( first_argument_type const &a,
-     second_argument_type const &b ) const;
-};
-
- -

The boost::math::lcm_evaluator class template defines a -function object class to return the least common multiple of two -integers. The template is parameterized by a single type, called -IntegerType here. This type should be a numeric type that -represents integers. The result of the function object is always -nonnegative, even if either of the operator arguments is negative. If -the least common multiple is beyond the range of the integer type, the -results are undefined.

- -

This function object class template is used in the corresponding -version of the LCM function template. If a -numeric type wants to customize evaluations of its least common -multiples, then the type should specialize on the -lcm_evaluator class template.

- -

Run-time GCD & LCM Determination

- -
template < typename IntegerType >
-IntegerType  boost::math::gcd( IntegerType const &a, IntegerType const &b );
-
-template < typename IntegerType >
-IntegerType  boost::math::lcm( IntegerType const &a, IntegerType const &b );
-
- -

The boost::math::gcd function template returns the -greatest common (nonnegative) divisor of the two integers passed to it. -The boost::math::lcm function template returns the least -common (nonnegative) multiple of the two integers passed to it. The -function templates are parameterized on the function arguments' -IntegerType, which is also the return type. Internally, -these function templates use an object of the corresponding version of -the gcd_evaluator and lcm_evaluator class templates, -respectively.

- -

Header <boost/math/common_factor_ct.hpp>

- -
template < unsigned long Value1, unsigned long Value2 >
-struct boost::math::static_gcd
-{
-    static unsigned long const  value = implementation_defined;
-};
-
-template < unsigned long Value1, unsigned long Value2 >
-struct boost::math::static_lcm
-{
-    static unsigned long const  value = implementation_defined;
-};
-
- -

The boost::math::static_gcd and -boost::math::static_lcm class templates take two -value-based template parameters of the unsigned long type -and have a single static constant data member, value, of -that same type. The value of that member is the greatest common factor -or least common multiple, respectively, of the template arguments. A -compile-time error will occur if the least common multiple is beyond the -range of an unsigned long.

- -

Example

- -
#include <boost/math/common_factor.hpp>
-#include <algorithm>
-#include <iterator>
-
-
-int main()
-{
-    using std::cout;
-    using std::endl;
-
-    cout << "The GCD and LCM of 6 and 15 are "
-     << boost::math::gcd(6, 15) << " and "
-     << boost::math::lcm(6, 15) << ", respectively."
-     << endl;
-
-    cout << "The GCD and LCM of 8 and 9 are "
-     << boost::math::static_gcd<8, 9>::value
-     << " and "
-     << boost::math::static_lcm<8, 9>::value
-     << ", respectively." << endl;
-
-    int  a[] = { 4, 5, 6 }, b[] = { 7, 8, 9 }, c[3];
-    std::transform( a, a + 3, b, c, boost::math::gcd_evaluator<int>() );
-    std::copy( c, c + 3, std::ostream_iterator<int>(cout, " ") );
-}
-
- -

Demonstration Program

- -

The program common_factor_test.cpp is a -demonstration of the results from instantiating various examples of the -run-time GCD and LCM function templates and the compile-time GCD and -LCM class templates. (The run-time GCD and LCM class templates are -tested indirectly through the run-time function templates.)

- -

Rationale

- -

The greatest common divisor and least common multiple functions are -greatly used in some numeric contexts, including some of the other Boost -libraries. Centralizing these functions to one header improves code -factoring and eases maintainence.

- -

History

- -
-
2 Jul 2002 -
Compile-time and run-time items separated to new headers. - -
7 Nov 2001 -
Initial version -
- -

Credits

- -

The author of the Boost compilation of GCD and LCM computations is Daryle Walker. The code was -prompted by existing code hiding in the implementations of Paul Moore's rational library and Steve Cleary's pool library. The code had updates by -Helmut Zeisel.

- -
- -

Revised July 2, 2002

- -

© Copyright Daryle Walker 2001-2002. Permission to copy, use, -modify, sell and distribute this document is granted provided this -copyright notice appears in all copies. This document is provided -"as is" without express or implied warranty, and with no claim -as to its suitability for any purpose.

- - \ No newline at end of file diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index e6ae55c49..000000000 --- a/doc/index.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - Boost Math Library - - - - - - - - - - - -
- boost.png (6897 bytes)HomeLibrariesPeopleFAQMore
-

Boost Math Library

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Header / Docs - Contents
- <boost/math_fwd.hpp> - Forward declaration header. -
- <boost/math/octonion.hpp>
-
- documentation -
Octonion class templates and octonion algebra function templates. -
- <boost/math/quaternion.hpp>
-
- documentation -
Quaternion class templates and quaternion algebra function - templates. -
-

<boost/math/complex.html>

-

Documentation

-
The inverse complex number trig functions required by the C99 - standard, and the C++ technical Report on Standard Library Extensions.
-

<boost/math/special_functions/log1p.hpp>
- <boost/math/special_functions/expm1.hpp>
- <boost/math/special_functions/hypot.hpp>

-

Documentation

-
Selected special math functions from the C99 standard.
- <boost/math/special_functions/acosh.hpp>
- <boost/math/special_functions/asinh.hpp>
- <boost/math/special_functions/atanh.hpp>
- <boost/math/special_functions/sinc.hpp>
- <boost/math/special_functions/sinhc.hpp>
-
- documentation -
"Special" mathematical function templates. -
- <boost/math/common_factor.hpp>
- <boost/math/common_factor_ct.hpp>
- <boost/math/common_factor_rt.hpp>
-
- documentation -
Compile-time and run-time class and function templates for - greatest common divisor and least common multiple. -
-

Rationale

-

The math sub-library of Boost helps segregate the large number of Boost - headers. This sub-library should contain various math-related items.

-
-

Revised - 2 July, 2002

- - diff --git a/octonion/index.html b/octonion/index.html deleted file mode 100644 index 61c6551ea..000000000 --- a/octonion/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - -Boost class octonion - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
boost.png (6897 bytes)Home Libraries People FAQ More
- - - -

The octonion Class

-

Class quaternion provides an implementation of the mathematical object of the same name.  See the documentation for details. -

-
-

Revised 18 Sep 2002 - -

- - - - - diff --git a/octonion/octonion.html b/octonion/octonion.html deleted file mode 100644 index 26ab3998b..000000000 --- a/octonion/octonion.html +++ /dev/null @@ -1,731 +0,0 @@ - - - - -Class octonion Documentation - - - - - - -

c++boost.gif (8819 bytes)Class octonion

- -

-

Octonions, like quaternions, are a relative of complex numbers.

-

Octonions see some use in theoretical physics.

-

In practical terms, an octonion is simply an octuple of real numbers , which we can write in the form , where , and are the same objects as for quaternions, and , , and are distinct objects which play essentially the same kind of role as (or or ).

-

An addition and a multiplication is defined on the set of octonions, which generalize their quaternionic counterparts. The main novelty this time is that the multiplication is not only not commutative, is now not even associative (i.e. there are quaternions , and such that ). A way of remembering things is by using the following multiplication table:

-
-

-
-

Octonions (and their kin) are described in far more details in this other document (with errata and addenda).

-

Some traditional constructs, such as the exponential, carry over without too much change into the realms of octonions, but other, such as taking a square root, do not (the fact that the exponential has a closed form is a result of the author, but the fact that the exponential exists at all for octonions is known since quite a long time ago).

-

Acknowledgements

-

The mathematical text has been typeset with Nisus Writer. Jens Maurer has helped with portability and standard adherence, and was the Review Manager for this library. More acknowledgements in the History section. Thank you to all who contributed to the discution about this library.

-

Header File

-

The interface and implementation are both supplied by the header file octonion.h.

-

Test Program

-

The octonion_test.cpp test program tests octonions specialisations for float, double and long double (sample output).

-

If you define the symbol BOOST_OCTONION_TEST_VERBOSE, you will get additional output (verbose output); this will only be helpfull if you enable message output at the same time, of course (by uncommenting the relevant line in the test or by adding --log_level=messages to your command line,...). In that case, and if you are running interactively, you may in addition define the symbol BOOST_INTERACTIVE_TEST_INPUT_ITERATOR to interactively test the input operator with input of your choice from the standard input (instead of hard-coding it in the test).

-

Synopsis

-
namespace boost
-{
-	namespace math
-	{
-		
-		template<typename T> class octonion;
-		template<>           class octonion<float>;
-		template<>           class octonion<double>; 
-		template<>           class octonion<long double>; 
-		
-		// operators
-		
-		template<typename T> inline octonion<T> operator + (T const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator + (octonion<T> const & lhs, T const & rhs);
-		template<typename T> inline octonion<T> operator + (::std::complex<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator + (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline octonion<T> operator + (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator + (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-		template<typename T> inline octonion<T> operator + (octonion<T> const & lhs, octonion<T> const & rhs);
-		
-		template<typename T> inline octonion<T> operator - (T const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator - (octonion<T> const & lhs, T const & rhs);
-		template<typename T> inline octonion<T> operator - (::std::complex<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator - (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline octonion<T> operator - (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator - (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-		template<typename T> inline octonion<T> operator - (octonion<T> const & lhs, octonion<T> const & rhs);
-		
-		template<typename T> inline octonion<T> operator * (T const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator * (octonion<T> const & lhs, T const & rhs);
-		template<typename T> inline octonion<T> operator * (::std::complex<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator * (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline octonion<T> operator * (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator * (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-		template<typename T> inline octonion<T> operator * (octonion<T> const & lhs, octonion<T> const & rhs);
-		
-		template<typename T> inline octonion<T> operator / (T const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator / (octonion<T> const & lhs, T const & rhs);
-		template<typename T> inline octonion<T> operator / (::std::complex<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator / (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline octonion<T> operator / (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline octonion<T> operator / (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-		template<typename T> inline octonion<T> operator / (octonion<T> const & lhs, octonion<T> const & rhs); 
-		
-		template<typename T> inline octonion<T> operator + (octonion<T> const & o);
-		template<typename T> inline octonion<T> operator - (octonion<T> const & o); 
-		
-		template<typename T> inline bool operator == (T const & lhs, octonion<T> const & rhs);
-		template<typename T> inline bool operator == (octonion<T> const & lhs, T const & rhs);
-		template<typename T> inline bool operator == (::std::complex<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline bool operator == (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline bool operator == (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline bool operator == (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-		template<typename T> inline bool operator == (octonion<T> const & lhs, octonion<T> const & rhs);
-		
-		template<typename T> inline bool operator != (T const & lhs, octonion<T> const & rhs);
-		template<typename T> inline bool operator != (octonion<T> const & lhs, T const & rhs);
-		template<typename T> inline bool operator != (::std::complex<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline bool operator != (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline bool operator != (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-		template<typename T> inline bool operator != (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-		template<typename T> inline bool operator != (octonion<T> const & lhs, octonion<T> const & rhs); 
-		
-		template<typename T, typename charT, class traits>
-		::std::basic_istream<charT,traits> &	operator >> (::std::basic_istream<charT,traits> & is, octonion<T> & o);
-		
-		template<typename T, typename charT, class traits>
-		::std::basic_ostream<charT,traits> &	operator << (::std::basic_ostream<charT,traits> & os, octonion<T> const & o);
-		
-		// values
-		
-		template<typename T>	inline T		real(octonion<T> const & o);
-		template<typename T>	inline octonion<T>	unreal(octonion<T> const & o);
-		
-		template<typename T>	inline T		sup(octonion<T> const & o);
-		template<typename T>	inline T		l1(octonion<T>const & o);	
-		template<typename T>	inline T		abs(octonion<T> const & o);
-		template<typename T>	inline T		norm(octonion<T>const  & o);
-		template<typename T>	inline octonion<T>	conj(octonion<T> const & o);
-		
-		template<typename T>	inline octonion<T>	spherical(T const & rho, T const & theta, T const & phi1, T const & phi2, T const & phi3, T const & phi4, T const & phi5, T const & phi6);
-		template<typename T>	inline octonion<T>	multipolar(T const & rho1, T const & theta1, T const & rho2, T const & theta2, T const & rho3, T const & theta3, T const & rho4, T const & theta4);
-		template<typename T>	inline octonion<T>	cylindrical(T const & r, T const & angle, T const & h1, T const & h2, T const & h3, T const & h4, T const & h5, T const & h6);
-		
-		// transcendentals
-		
-		template<typename T>	inline octonion<T>	exp(octonion<T> const & o);
-		template<typename T>	inline octonion<T>	cos(octonion<T> const & o);
-		template<typename T>	inline octonion<T>	sin(octonion<T> const & o);
-		template<typename T>	inline octonion<T>	tan(octonion<T> const & o);
-		template<typename T>	inline octonion<T>	cosh(octonion<T> const & o);
-		template<typename T>	inline octonion<T>	sinh(octonion<T> const & o);
-		template<typename T>	inline octonion<T>	tanh(octonion<T> const & o);
-		
-		template<typename T>	octonion<T>		pow(octonion<T> const & o, int n);
-		
-	}
-}
-

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);
-			
-		};
-		
-	}
-}
-

-

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::octonion<float>	H_component_1() const;
-			::boost::math::octonion<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);
-			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);
-		};
-		
-	}
-}
-

-

octonion typedefs

-

value_type

-
typedef T value_type;
-
-

Template version.

-
-
typedef float value_type;
-
-

Float specialization version.

-
-
typedef double value_type;
-
-

Double specialization version.

-
-
typedef long double value_type;
-
-

Long double specialization version.

-

These provide easy acces to the type the template is built upon.

-
-

octonion member functions

-

Constructors

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

Template version.

-
-
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 specialization version.

-
-
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 specialization version.

-
-
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 & q1 = ::boost::math::quaternion<long double>());
-explicit		octonion(octonion<float> const & a_recopier);
-explicit		octonion(octonion<double> const & a_recopier);
-
-

Long double specialization version.

-

A default constructor is provided for each form, which initializes each component to the default values for their type (i.e. zero for floating numbers). This constructor can also accept one to eight base type arguments. A constructor is also provided to build octonions from one to four complex numbers sharing the same base type, and another taking one or two quaternionssharing the same base type. The unspecialized template also sports a templarized copy constructor, while the specialized forms have copy constructors from the other two specializations, which are explicit when a risk of precision loss exists. For the unspecialized form, the base type's constructors must not throw.

-

Destructors and untemplated copy constructors (from the same type) are provided by the compiler. Converting copy constructors make use of a templated helper function in a "detail" subnamespace.

-
-

Other member functions

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

Like complex number, octonions do have a meaningful notion of "real part", but unlike them there is no meaningful notion of "imaginary part". Instead there is an "unreal part" which itself is a octonion, and usually nothing simpler (as opposed to the complex number case). These are returned by the first two functions.

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

A octonion having eight real components, these are returned by these eight functions. Hence real and R_component_1 return the same value.

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

A octonion likewise has four complex components. Actually, octonions are indeed a (left) vector field over the complexes, but beware, as for any octonion we also have (note the minus sign in the last factor). What the C_component_n functions return, however, are the complexes which could be used to build the octonion using the constructor, and not the components of the octonion on the basis .

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

Likewise, for any octonion we also have , though there is no meaningful vector-space-like structure based on the quaternions. What the H_component_n functions return are the quaternions which could be used to build the octonion using the constructor.

-
-

octonion member operators

-

Assignment operators

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

These perform the expected assignment, with type modification if necessary (for instance, assigning from a base type will set the real part to that value, and all other components to zero). For the unspecialized form, the base type's assignment operators must not throw.

-
-

Other member operators

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

These perform the mathematical operation (*this)+rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.

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

These perform the mathematical operation (*this)-rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.

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

These perform the mathematical operation (*this)*rhs in this order (order is important as multiplication is not commutative for octonions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw. Also, for clarity's sake, you should always group the factors in a multiplication by groups of two, as the multiplication is not even associative on the octonions (though there are of course cases where this does not matter, it usually does).

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

These perform the mathematical operation (*this)*inverse_of(rhs) in this order (order is important as multiplication is not commutative for octonions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw. As for the multiplication, remember to group any two factors using parenthesis.

-
-

octonion non-member operations

-
template<typename T>	inline octonion<T>	operator + (octonion<T> const & o);
-
-

This unary operator simply returns o.

-
-
template<typename T>	inline octonion<T>	operator - (octonion<T> const & o);
-
-

This unary operator returns the opposite of o.

-
-
template<typename T>	inline octonion<T>	operator + (T const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator + (octonion<T> const & lhs, T const & rhs);
-template<typename T>	inline octonion<T>	operator + (::std::complex<T> const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator + (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-template<typename T>	inline octonion<T>	operator + (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator + (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator + (octonion<T> const & lhs, octonion<T> const & rhs);
-
-

These operators return octonion<T>(lhs) += rhs.

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

These operators return octonion<T>(lhs) -= rhs.

-
-
template<typename T>	inline octonion<T>	operator * (T const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator * (octonion<T> const & lhs, T const & rhs);
-template<typename T>	inline octonion<T>	operator * (::std::complex<T> const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator * (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-template<typename T>	inline octonion<T>	operator * (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator * (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator * (octonion<T> const & lhs, octonion<T> const & rhs);
-
-

These operators return octonion<T>(lhs) *= rhs.

-
-
template<typename T>	inline octonion<T>	operator / (T const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator / (octonion<T> const & lhs, T const & rhs);
-template<typename T>	inline octonion<T>	operator / (::std::complex<T> const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator / (octonion<T> const & lhs, ::std::complex<T> const & rhs);
-template<typename T>	inline octonion<T>	operator / (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator / (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
-template<typename T>	inline octonion<T>	operator / (octonion<T> const & lhs, octonion<T> const & rhs);
-
-

These operators return octonion<T>(lhs) /= rhs. It is of course still an error to divide by zero...

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

These return true if and only if the four components of octonion<T>(lhs) are equal to their counterparts in octonion<T>(rhs). As with any floating-type entity, this is essentially meaningless.

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

These return true if and only if octonion<T>(lhs) == octonion<T>(rhs) is false. As with any floating-type entity, this is essentially meaningless.

-
-
template<typename T, typename charT, class traits>
-::std::basic_istream<charT,traits> &	operator >> (::std::basic_istream<charT,traits> & is, octonion<T> & o);
-
-

Extracts an octonion o. We accept any format which seems reasonable. However, since this leads to a great many ambiguities, decisions were made to lift these. In case of doubt, stick to lists of reals.

-

The input values must be convertible to T. If bad input is encountered, calls is.setstate(ios::failbit) (which may throw ios::failure (27.4.5.3)).

-

Returns is.

-
-
template<typename T, typename charT, class traits>
-::std::basic_ostream<charT,traits> &	operator << (::std::basic_ostream<charT,traits> & os, octonion<T> const & o);
-
-

Inserts the octonion o onto the stream os as if it were implemented as follows:

-
-
	template<typename T, typename charT, class traits>
-	::std::basic_ostream<charT,traits> &	operator << (	::std::basic_ostream<charT,traits> & os,
-								octonion<T> const & o)
-					{
-						::std::basic_ostringstream<charT,traits>	s;
-						
-						s.flags(os.flags());
-						s.imbue(os.getloc());
-						s.precision(os.precision());
-						
-						s << '('	<< o.R_component_1() << ','
-								<< o.R_component_2() << ','
-								<< o.R_component_3() << ','
-								<< o.R_component_4() << ','
-								<< o.R_component_5() << ','
-								<< o.R_component_6() << ','
-								<< o.R_component_7() << ','
-								<< o.R_component_8() << ')';
-									
-						return os << s.str();
-					}
-

octonion value operations

-
template<typename T>	inline T		real(octonion<T> const & o);
-template<typename T>	inline octonion<T>	unreal(octonion<T> const & o);
-
-

These return o.real() and o.unreal() respectively.

-
-
template<typename T>	inline octonion<T>	conj(octonion<T> const & o);
-
-

This returns the conjugate of the octonion.

-
-
template<typename T>	inline T	 	sup(octonion<T> const & o);
-
-

This return the sup norm (the greatest among abs(o.R_component_1())...abs(o.R_component_8())) of the octonion.

-
-
template<typename T>	inline T	 	l1(octonion<T> const & o);
-
-

This return the l1 norm (abs(o.R_component_1())+...+abs(o.R_component_8())) of the octonion.

-
-
template<typename T>	inline T	 	abs(octonion<T> const & o);
-
-

This return the magnitude (Euclidian norm) of the octonion.

-
-
template<typename T>	inline T		norm(octonion<T>const  & o);
-
-

This return the (Cayley) norm of the octonion. The term "norm" might be confusing, as most people associate it with the Euclidian norm (and quadratic functionals). For this version of (the mathematical objects known as) octonions, the Euclidian norm (also known as magnitude) is the square root of the Cayley norm.

-
-
template<typename T>	inline octonion<T>	spherical(T const & rho, T const & theta, T const & phi1, T const & phi2, T const & phi3, T const & phi4, T const & phi5, T const & phi6);
-template<typename T>	inline octonion<T>	multipolar(T const & rho1, T const & theta1, T const & rho2, T const & theta2, T const & rho3, T const & theta3, T const & rho4, T const & theta4);
-template<typename T>	inline octonion<T>	cylindrical(T const & r, T const & angle, T const & h1, T const & h2, T const & h3, T const & h4, T const & h5, T const & h6);
-
-

These build octonions in a way similar to the way polar builds complex numbers, as there is no strict equivalent to polar coordinates for octonions.

-

spherical is a simple transposition of polar, it takes as inputs a (positive) magnitude and a point on the hypersphere, given by three angles. The first of these, theta has a natural range of -pi to +pi, and the other two have natural ranges of -pi/2 to +pi/2 (as is the case with the usual spherical coordinates in R^3). Due to the many symmetries and periodicities, nothing untoward happens if the magnitude is negative or the angles are outside their natural ranges. The expected degeneracies (a magnitude of zero ignores the angles settings...) do happen however.

-

cylindrical is likewise a simple transposition of the usual cylindrical coordinates in R^3, which in turn is another derivative of planar polar coordinates. The first two inputs are the polar coordinates of the first C component of the octonion. The third and fourth inputs are placed into the third and fourth R components of the octonion, respectively.

-

multipolar is yet another simple generalization of polar coordinates. This time, both C components of the octonion are given in polar coordinates.

-
-

In this version of our implementation of octonions, there is no analogue of the complex value operation arg as the situation is somewhat more complicated.

-

octonion transcendentals

-

There is no log or sqrt provided for octonions in this implementation, and pow is likewise restricted to integral powers of the exponent. There are several reasons to this: on the one hand, the equivalent of analytic continuation for octonions ("branch cuts") remains to be investigated thoroughly (by me, at any rate...), and we wish to avoid the nonsense introduced in the standard by exponentiations of complexes by complexes (which is well defined, but not in the standard...). Talking of nonsense, saying that pow(0,0) is "implementation defined" is just plain brain-dead...

-

We do, however provide several transcendentals, chief among which is the exponential. That it allows for a "closed formula" is a result of the author (the existence and definition of the exponential, on the octonions among others, on the other hand, is a few centuries old). Basically, any converging power series with real coefficients which allows for a closed formula in C can be transposed to O. More transcendentals of this type could be added in a further revision upon request. It should be noted that it is these functions which force the dependency upon the boost/math/special_functions/sinc.hpp and the boost/math/special_functions/sinhc.hpp headers.

-

exp

-
template<typename T>	inline octonion<T>	exp(octonion<T> const & o);
-
-

Computes the exponential of the octonion.

-
-

cos

-
template<typename T>	inline octonion<T>	cos(octonion<T> const & o);
-
-

Computes the cosine of the octonion

-
-

sin

-
template<typename T>	inline octonion<T>	sin(octonion<T> const & o);
-
-

Computes the sine of the octonion.

-
-

tan

-
template<typename T>	inline octonion<T>	tan(octonion<T> const & o);
-
-

Computes the tangent of the octonion.

-
-

cosh

-
template<typename T>	inline octonion<T>	cosh(octonion<T> const & o);
-
-

Computes the hyperbolic cosine of the octonion.

-
-

sinh

-
template<typename T>	inline octonion<T>	sinh(octonion<T> const & o);
-
-

Computes the hyperbolic sine of the octonion.

-
-

tanh

-
template<typename T>	inline octonion<T>	tanh(octonion<T> const & o);
-
-

Computes the hyperbolic tangent of the octonion.

-
-

pow

-
template<typename T>	octonion<T>		pow(octonion<T> const & o, int n);
-
-

Computes the n-th power of the octonion q.

-
-

History

- -

To Do

- -
-

Revised 25 Feb 2003

-

© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied  warranty, and with no claim as to its suitability for any purpose.

- - - diff --git a/quaternion/index.html b/quaternion/index.html deleted file mode 100644 index c558680b3..000000000 --- a/quaternion/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - -Boost class quaternion - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
boost.png (6897 bytes)Home Libraries People FAQ More
- - - -

The quaternion Class

-

Class quaternion provides an implementation of the mathematical object of the same name.  See the documentation for details. -

-
-

Revised 24 Feb 2003 - -

- - - - - diff --git a/quaternion/quaternion.html b/quaternion/quaternion.html deleted file mode 100644 index 2c1ed69d1..000000000 --- a/quaternion/quaternion.html +++ /dev/null @@ -1,634 +0,0 @@ - - - - Class quaternion Documentation - - - - - -

c++boost.gif (8819 bytes)Class quaternion

- -

-

Quaternions are a relative of complex numbers.

-

Quaternions are in fact part of a small hierarchy of structures built upon the real numbers, which comprise only the set of real numbers (traditionally named ), the set of complex numbers (traditionally named ), the set of quaternions (traditionally named ) and the set of octonions (traditionally named ), which possess interesting mathematical properties (chief among which is the fact that they are division algebras, i.e. where the following property is true: if is an element of that algebra and is not equal to zero, then , where and denote elements of that algebra, implies that ). Each member of the hierarchy is a super-set of the former.

-

One of the most important aspects of quaternions is that they provide an efficient way to parameterize rotations in (the usual three-dimensional space) and .

-

In practical terms, a quaternion is simply a quadruple of real numbers , which we can write in the form , where is the same object as for complex numbers, and and are distinct objects which play essentially the same kind of role as .

-

An addition and a multiplication is defined on the set of quaternions, which generalize their real and complex counterparts. The main novelty here is that the multiplication is not commutative (i.e. there are quaternions and such that ). A good mnemotechnical way of remembering things is by using the formula .

-

Quaternions (and their kin) are described in far more details in this other document (with errata and addenda).

-

Some traditional constructs, such as the exponential, carry over without too much change into the realms of quaternions, but other, such as taking a square root, do not.

-

Acknowledgements

-

The mathematical text has been typeset with Nisus Writer. Jens Maurer has helped with portability and standard adherence, and was the Review Manager for this library. More acknowledgements in the History section. Thank you to all who contributed to the discution about this library.

-

Header File

-

The interface and implementation are both supplied by the header file quaternion.h.

-

Test Program

-

The quaternion_test.cpp test program tests quaternions specializations for float, double and long double (sample output, with message output enabled).

-

If you define the symbol BOOST_QUATERNION_TEST_VERBOSE, you will get additional output (verbose output); this will only be helpfull if you enable message output at the same time, of course (by uncommenting the relevant line in the test or by adding --log_level=messages to your command line,...). In that case, and if you are running interactively, you may in addition define the symbol BOOST_INTERACTIVE_TEST_INPUT_ITERATOR to interactively test the input operator with input of your choice from the standard input (instead of hard-coding it in the test).

-

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> inline quaternion<T> operator + (T const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator + (quaternion<T> const & lhs, T const & rhs);
-		template<typename T> inline quaternion<T> operator + (::std::complex<T> const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator + (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline quaternion<T> operator + (quaternion<T> const & lhs, quaternion<T> const & rhs);
-		
-		template<typename T> inline quaternion<T> operator - (T const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator - (quaternion<T> const & lhs, T const & rhs);
-		template<typename T> inline quaternion<T> operator - (::std::complex<T> const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator - (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline quaternion<T> operator - (quaternion<T> const & lhs, quaternion<T> const & rhs);
-		
-		template<typename T> inline quaternion<T> operator * (T const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator * (quaternion<T> const & lhs, T const & rhs);
-		template<typename T> inline quaternion<T> operator * (::std::complex<T> const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator * (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline quaternion<T> operator * (quaternion<T> const & lhs, quaternion<T> const & rhs);
-		
-		template<typename T> inline quaternion<T> operator / (T const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator / (quaternion<T> const & lhs, T const & rhs);
-		template<typename T> inline quaternion<T> operator / (::std::complex<T> const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline quaternion<T> operator / (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline quaternion<T> operator / (quaternion<T> const & lhs, quaternion<T> const & rhs); 
-		
-		template<typename T> inline quaternion<T> operator + (quaternion<T> const & q);
-		template<typename T> inline quaternion<T> operator - (quaternion<T> const & q); 
-		
-		template<typename T> inline bool operator == (T const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline bool operator == (quaternion<T> const & lhs, T const & rhs);
-		template<typename T> inline bool operator == (::std::complex<T> const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline bool operator == (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline bool operator == (quaternion<T> const & lhs, quaternion<T> const & rhs);
-		
-		template<typename T> inline bool operator != (T const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline bool operator != (quaternion<T> const & lhs, T const & rhs);
-		template<typename T> inline bool operator != (::std::complex<T> const & lhs, quaternion<T> const & rhs);
-		template<typename T> inline bool operator != (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
-		template<typename T> inline 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 << (::std::basic_ostream<charT,traits> & os, quaternion<T> const & q);
-		
-		// values
-		
-		template<typename T>	inline T		real(quaternion<T> const & q);
-		template<typename T>	inline quaternion<T>	unreal(quaternion<T> const & q);
-		
-		template<typename T>	inline T		sup(quaternion<T> const & q);
-		template<typename T>	inline T		l1(quaternion<T> const & q);
-		template<typename T>	inline T		abs(quaternion<T> const & q);
-		template<typename T>	inline T		norm(quaternion<T>const  & q);
-		template<typename T>	inline quaternion<T>	conj(quaternion<T> const & q);
-		
-		template<typename T>	inline quaternion<T>	spherical(T const & rho, T const & theta, T const & phi1, T const & phi2);
-		template<typename T>	inline quaternion<T>	semipolar(T const & rho, T const & alpha, T const & theta1, T const & theta2);
-		template<typename T>	inline quaternion<T>	multipolar(T const & rho1, T const & theta1, T const & rho2, T const & theta2);
-		template<typename T>	inline quaternion<T>	cylindrospherical(T const & t, T const & radius, T const & longitude, T const & latitude);
-		template<typename T>	inline quaternion<T>	cylindrical(T const & r, T const & angle, T const & h1, T const & h2);
-		
-		// transcendentals
-		
-		template<typename T>	inline quaternion<T>	exp(quaternion<T> const & q);
-		template<typename T>	inline quaternion<T>	cos(quaternion<T> const & q);
-		template<typename T>	inline quaternion<T>	sin(quaternion<T> const & q);
-		template<typename T>	inline quaternion<T>	tan(quaternion<T> const & q);
-		template<typename T>	inline quaternion<T>	cosh(quaternion<T> const & q);
-		template<typename T>	inline quaternion<T>	sinh(quaternion<T> const & q);
-		template<typename T>	inline quaternion<T>	tanh(quaternion<T> const & q);
-		
-		template<typename T>	quaternion<T>		pow(quaternion<T> const & q, int n);
-		
-	}
-	
-}
-

Template class quaternion

-
namespace boost
-{
-	namespace math
-	{
-	
-		template<typename T>
-		class quaternion
-		{
-		public:
-			
-			typedef T value_type;
-			
-			explicit		quaternion(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T());
-			explicit		quaternion(::std::complex<T> const & z0, ::std::complex<T> const & z1 = ::std::complex<T>());
-			template<typename X> explicit	quaternion(quaternion<X> const & a_recopier);
-			
-			T			real() const;
-			quaternion<T>		unreal() const;
-			T			R_component_1() const;
-			T			R_component_2() const;
-			T			R_component_3() const;
-			T			R_component_4() const;
-			::std::complex<T>	C_component_1() const;
-			::std::complex<T>	C_component_2() const;
-			
-			quaternion<T> &	operator = (quaternion<T> const  & a_affecter);
-			template<typename X>	quaternion<T> &	operator = (quaternion<X> const  & a_affecter);
-			quaternion<T> &	operator = (T const  & a_affecter);
-			quaternion<T> &	operator = (::std::complex<T> const & a_affecter);
-			
-			quaternion<T> &	operator += (T const & rhs);
-			quaternion<T> &	operator += (::std::complex<T> const & rhs);
-			template<typename X>	quaternion<T> &	operator += (quaternion<X> const & rhs);
-			
-			quaternion<T> &	operator -= (T const & rhs);
-			quaternion<T> &	operator -= (::std::complex<T> const & rhs);
-			template<typename X>	quaternion<T> &	operator -= (quaternion<X> const & rhs);
-			
-			quaternion<T> &	operator *= (T const & rhs);
-			quaternion<T> &	operator *= (::std::complex<T> const & rhs);
-			template<typename X>	quaternion<T> &	operator *= (quaternion<X> const & rhs);
-			
-			quaternion<T> &	operator /= (T const & rhs);
-			quaternion<T> &	operator /= (::std::complex<T> const & rhs);
-			template<typename X>	quaternion<T> &	operator /= (quaternion<X> const & rhs);
-			
-		};
-		
-	}
-
-}
-

-

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);
-			
-		};
-		
-	}
-	
-}
-

-

quaternion typedefs

-

value_type

-
typedef T value_type;
-
-

Template version.

-
-
typedef float value_type;
-
-

Float specialization version.

-
-
typedef double value_type;
-
-

Double specialization version.

-
-
typedef long double value_type;
-
-

Long double specialization version.

-

These provide easy acces to the type the template is built upon.

-
-

quaternion member functions

-

Constructors

-
explicit		quaternion(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T());
-explicit		quaternion(::std::complex<T> const & z0, ::std::complex<T> const & z1 = ::std::complex<T>());
-template<typename X> explicit	quaternion(quaternion<X> const & a_recopier);
-
-

Template version.

-
-
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 specialization version.

-
-
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 specialization version.

-
-
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 specialization version.

-

A default constructor is provided for each form, which initializes each component to the default values for their type (i.e. zero for floating numbers). This constructor can also accept one to four base type arguments. A constructor is also provided to build quaternions from one or two complex numbers sharing the same base type. The unspecialized template also sports a templarized copy constructor, while the specialized forms have copy constructors from the other two specializations, which are explicit when a risk of precision loss exists. For the unspecialized form, the base type's constructors must not throw.

-

Destructors and untemplated copy constructors (from the same type) are provided by the compiler. Converting copy constructors make use of a templated helper function in a "detail" subnamespace.

-
-

Other member functions

-
T			real() const;
-quaternion<T>		unreal() const;
-
-

Like complex number, quaternions do have a meaningful notion of "real part", but unlike them there is no meaningful notion of "imaginary part". Instead there is an "unreal part" which itself is a quaternion, and usually nothing simpler (as opposed to the complex number case). These are returned by the first two functions.

-
-
T			R_component_1() const;
-T			R_component_2() const;
-T			R_component_3() const;
-T			R_component_4() const;
-
-

A quaternion having four real components, these are returned by these four functions. Hence real and R_component_1 return the same value.

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

A quaternion likewise has two complex components, and as we have seen above, for any quaternion we also have . These functions return them. The real part of q.C_component_1() is the same as q.real().

-
-

quaternion member operators

-

Assignment operators

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

These perform the expected assignment, with type modification if necessary (for instance, assigning from a base type will set the real part to that value, and all other components to zero). For the unspecialized form, the base type's assignment operators must not throw.

-
-

Other member operators

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

These perform the mathematical operation (*this)+rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.

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

These perform the mathematical operation (*this)-rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.

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

These perform the mathematical operation (*this)*rhs in this order (order is important as multiplication is not commutative for quaternions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.

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

These perform the mathematical operation (*this)*inverse_of(rhs) in this order (order is important as multiplication is not commutative for quaternions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.

-
-

quaternion non-member operations

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

This unary operator simply returns q.

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

This unary operator returns the opposite of q.

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

These operators return quaternion<T>(lhs) += rhs.

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

These operators return quaternion<T>(lhs) -= rhs.

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

These operators return quaternion<T>(lhs) *= rhs.

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

These operators return quaternion<T>(lhs) /= rhs. It is of course still an error to divide by zero...

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

These return true if and only if the four components of quaternion<T>(lhs) are equal to their counterparts in quaternion<T>(rhs). As with any floating-type entity, this is essentially meaningless.

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

These return true if and only if quaternion<T>(lhs) == quaternion<T>(rhs) is false. As with any floating-type entity, this is essentially meaningless.

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

Extracts a quaternion q of one of the following forms (with a, b, c and d of type T):

-

- a - (a), (a,b), (a,b,c), (a,b,c,d) - (a,(c)), (a,(c,d)), ((a)), ((a),c), ((a),(c)), ((a),(c,d)), ((a,b)), ((a,b),c), ((a,b),(c)), ((a,b),(c,d))

-

The input values must be convertible to T. If bad input is encountered, calls is.setstate(ios::failbit) (which may throw ios::failure (27.4.5.3)).

-

Returns is.

-

The rationale for the list of accepted formats is that either we have a list of up to four reals, or else we have a couple of complex numbers, and in that case if it formated as a proper complex number, then it should be accepted. Thus potential ambiguities are lifted (for instance (a,b) is (a,b,0,0) and not (a,0,b,0), i.e. it is parsed as a list of two real numbers and not two complex numbers which happen to have imaginary parts equal to zero).

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

Inserts the quaternion q onto the stream os as if it were implemented as follows:

-
-
	template<typename T, typename charT, class traits>
-	::std::basic_ostream<charT,traits> &	operator << (	::std::basic_ostream<charT,traits> & os,
-								quaternion<T> const & q)
-	{
-		::std::basic_ostringstream<charT,traits>	s;
-		
-		s.flags(os.flags());
-		s.imbue(os.getloc());
-		s.precision(os.precision());
-		
-		s << '('		<< q.R_component_1() << ','
-					<< q.R_component_2() << ','
-					<< q.R_component_3() << ','
-					<< q.R_component_4() << ')';
-		
-		return os << s.str();
-	}
-

quaternion value operations

-
template<typename T>	inline T		real(quaternion<T> const & q);
-template<typename T>	inline quaternion<T>	unreal(quaternion<T> const & q);
-
-

These return q.real() and q.unreal() respectively.

-
-
template<typename T>	inline quaternion<T>	conj(quaternion<T> const & q);
-
-

This returns the conjugate of the quaternion.

-
-
template<typename T>	inline T	 	sup(quaternion<T> const & q);
-
-

This return the sup norm (the greatest among abs(q.R_component_1())...abs(q.R_component_4())) of the quaternion.

-
-
template<typename T>	inline T	 	l1(quaternion<T> const & q);
-
-

This return the l1 norm (abs(q.R_component_1())+...+abs(q.R_component_4())) of the quaternion.

-
-
template<typename T>	inline T	 	abs(quaternion<T> const & q);
-
-

This return the magnitude (Euclidian norm) of the quaternion.

-
-
template<typename T>	inline T		norm(quaternion<T>const  & q);
-
-

This return the (Cayley) norm of the quaternion. The term "norm" might be confusing, as most people associate it with the Euclidian norm (and quadratic functionals). For this version of (the mathematical objects known as) quaternions, the Euclidian norm (also known as magnitude) is the square root of the Cayley norm.

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

These build quaternions in a way similar to the way polar builds complex numbers, as there is no strict equivalent to polar coordinates for quaternions.

-

spherical is a simple transposition of polar, it takes as inputs a (positive) magnitude and a point on the hypersphere, given by three angles. The first of these, theta has a natural range of -pi to +pi, and the other two have natural ranges of -pi/2 to +pi/2 (as is the case with the usual spherical coordinates in R^3). Due to the many symmetries and periodicities, nothing untoward happens if the magnitude is negative or the angles are outside their natural ranges. The expected degeneracies (a magnitude of zero ignores the angles settings...) do happen however.

-

cylindrical is likewise a simple transposition of the usual cylindrical coordinates in R^3, which in turn is another derivative of planar polar coordinates. The first two inputs are the polar coordinates of the first C component of the quaternion. The third and fourth inputs are placed into the third and fourth R components of the quaternion, respectively.

-

multipolar is yet another simple generalization of polar coordinates. This time, both C components of the quaternion are given in polar coordinates.

-

cylindrospherical is specific to quaternions. It is often interesting to consider H as the cartesian product of R by R^3 (the quaternionic multiplication as then a special form, as given here). This function therefore builds a quaternion from this representation, with the R^3 component given in usual R^3 spherical coordinates.

-

semipolar is another generator which is specific to quaternions. It takes as a first input the magnitude of the quaternion, as a second input an angle in the range 0 to +pi/2 such that magnitudes of the first two C components of the quaternion are the product of the first input and the sine and cosine of this angle, respectively, and finally as third and fourth inputs angles in the range -pi/2 to +pi/2 which represent the arguments of the first and second C components of the quaternion, respectively. As usual, nothing untoward happens if what should be magnitudes are negative numbers or angles are out of their natural ranges, as symmetries and periodicities kick in.

-
-

In this version of our implementation of quaternions, there is no analogue of the complex value operation arg as the situation is somewhat more complicated. Unit quaternions are linked both to rotations in R^3 and in R^4, and the correspondences are not too complicated, but there is currently a lack of standard (de facto or de jure) matrix library with which the conversions could work. This should be remedied in a further revision. In the mean time, an example of how this could be done is presented here for R^3, and here for R^4 (example test file).

-

quaternion transcendentals

-

There is no log or sqrt provided for quaternions in this implementation, and pow is likewise restricted to integral powers of the exponent. There are several reasons to this: on the one hand, the equivalent of analytic continuation for quaternions ("branch cuts") remains to be investigated thoroughly (by me, at any rate...), and we wish to avoid the nonsense introduced in the standard by exponentiations of complexes by complexes (which is well defined, but not in the standard...). Talking of nonsense, saying that pow(0,0) is "implementation defined" is just plain brain-dead...

-

We do, however provide several transcendentals, chief among which is the exponential. This author claims the complete proof of the "closed formula" as his own, as well as its independant invention (there are claims to prior invention of the formula, such as one by Professor Shoemake, and it is possible that the formula had been known a couple of centuries back, but in absence of bibliographical reference, the matter is pending, awaiting further investigation; on the other hand, the definition and existence of the exponential on the quaternions, is of course a fact known for a very long time). Basically, any converging power series with real coefficients which allows for a closed formula in C can be transposed to H. More transcendentals of this type could be added in a further revision upon request. It should be noted that it is these functions which force the dependency upon the boost/math/special_functions/sinc.hpp and the boost/math/special_functions/sinhc.hpp headers.

-

exp

-
template<typename T>	inline quaternion<T>	exp(quaternion<T> const & q);
-
-

Computes the exponential of the quaternion.

-
-

cos

-
template<typename T>	inline quaternion<T>	cos(quaternion<T> const & q);
-
-

Computes the cosine of the quaternion

-
-

sin

-
template<typename T>	inline quaternion<T>	sin(quaternion<T> const & q);
-
-

Computes the sine of the quaternion.

-
-

tan

-
template<typename T>	inline quaternion<T>	tan(quaternion<T> const & q);
-
-

Computes the tangent of the quaternion.

-
-

cosh

-
template<typename T>	inline quaternion<T>	cosh(quaternion<T> const & q);
-
-

Computes the hyperbolic cosine of the quaternion.

-
-

sinh

-
template<typename T>	inline quaternion<T>	sinh(quaternion<T> const & q);
-
-

Computes the hyperbolic sine of the quaternion.

-
-

tanh

-
template<typename T>	inline quaternion<T>	tanh(quaternion<T> const & q);
-
-

Computes the hyperbolic tangent of the quaternion.

-
-

pow

-
template<typename T>	quaternion<T>		pow(quaternion<T> const & q, int n);
-
-

Computes the n-th power of the quaternion q.

-
-

History

- -

To Do

- -
-

Revised 24 Feb 2003

-

© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied  warranty, and with no claim as to its suitability for any purpose.

- - - \ No newline at end of file diff --git a/special_functions/index.html b/special_functions/index.html deleted file mode 100644 index e27ec5a0d..000000000 --- a/special_functions/index.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - -Boost Special Functions library - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
boost.png (6897 bytes)Home Libraries People FAQ More
- - - -

Special Functions library

-

The Special Functions library is a stop-gap collection of numerical functions, some of which are needed for our implementation of quaternions and octonions. -

-
-

Revised 03 Feb 2003 - -

- - - - - diff --git a/special_functions/inverse_hyperbolic.html b/special_functions/inverse_hyperbolic.html deleted file mode 100644 index 396609ecf..000000000 --- a/special_functions/inverse_hyperbolic.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - Inverse Hyperbolic Functions - - - -

boost.png (6897 bytes)Special Functions library

-
-

(inverse hyperbolic functions)

-
-

The exponential funtion is defined, for all object for which this makes sense, as the power series , with (and by definition) being the factorial of . In particular, the exponential function is well defined for real numbers, complex number, quaternions, octonions, and matrices of complex numbers, among others.

-
-

-

Graph of exp on R

-
-

-
-

-

Real and Imaginary parts of exp on C

-
-

-

The hyperbolic functions are defined as power series which can be computed (for reals, complex, quaternions and octonions) as:

-

 

-

Hyperbolic cosine:

-

Hyperbolic sine:

-

Hyperbolic tangent:

-

-
-

 

-

Trigonometric functions on R (cos: purple; sin: red; tan: blue)

-

-

Hyperbolic functions on r (cosh: purple; sinh: red; tanh: blue)

-
-

-

The hyperbolic sine is one to one on the set of real numbers, with range the full set of reals, while the hyperbolic tangent is also one to one on the set of real numbers but with range , and therefore both have inverses. The hyperbolic cosine is one to one from onto (and from onto ); the inverse function we use here is defined on with range .

-

The inverse of the hyperbolic tangent is called the Argument hyperbolic tangent, and can be computed as .

-

The inverse of the hyperbolic sine is called the Argument hyperbolic sine, and can be computed (for ) as .

-

The inverse of the hyperbolic cosine is called the Argument hyperbolic cosine, and can be computed as .

-
-

Revised 03 Feb 2003

-

© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied  warranty, and with no claim as to its suitability for any purpose.

- - - \ No newline at end of file diff --git a/special_functions/sinc_sinhc.html b/special_functions/sinc_sinhc.html deleted file mode 100644 index a7d3f30ae..000000000 --- a/special_functions/sinc_sinhc.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - Sinus Cardinal and Hyperbolic Sinus Cardinal Functions - - - -

boost.png (6897 bytes)Special Functions library

-
-

(Sinus Cardinal and Hyperbolic Sinus Cardinal functions)

-
-

The Sinus Cardinal family of functions (indexed by the family of indices ) is defined by ; it sees heavy use in signal processing tasks.

-

By analogy, the Hyperbolic Sinus Cardinal family of functions (also indexed by the family of indices ) is defined by .

-

These two families of functions are composed of entire functions.

-
-

-

Sinus Cardinal of index pi (purple) and Hyperbolic Sinus Cardinal of index pi (red) on R

-
-

-
-

Revised 18 Aug 2004

-

© Copyright Hubert Holin 2001-2004. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied  warranty, and with no claim as to its suitability for any purpose.

- - - \ No newline at end of file diff --git a/special_functions/special_functions.html b/special_functions/special_functions.html deleted file mode 100644 index 7318cfc4d..000000000 --- a/special_functions/special_functions.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - Special Functions Documentation - - - - - -

boost.png (6897 bytes)Special Functions library

- -

The Special Functions library currently provides five templated special functions, in namespace boost. Two of these (sinc_pi and sinhc_pi) are needed by our implementation of quaternions and octonions.

-

The functions acosh, asinh and atanh are entirely classical, the function sinc_pi sees heavy use in signal processing tasks, and the function sinhc_pi is an ad'hoc function whose naming is modelled on sinc_pi and hyperbolic functions.

-

Acknowledgements

-

The mathematical text has been typeset with Nisus Writer, and the illustrations have been made with Graphing Calculator. Jens Maurer was the Review Manager for this library. More acknowledgements in the History section. Thank you to all who contributed to the discution about this library.

-

Header Files

-

The interface and implementation for each function (or forms of a function) are both supplied by one header file:

- -

Test Program

-

The special_functions_test.cpp test program tests the functions for float, double and long double arguments (sample output, with message output enabled).

-

If you define the symbol BOOST_SPECIAL_FUNCTIONS_TEST_VERBOSE, you will get additional output (verbose output), which may prove useful for tuning on your platform (the library use "reasonable" tolerances, which may prove to be too strict for your platform); this will only be helpfull if you enable message output at the same time, of course (by uncommenting the relevant line in the test or by adding --log_level=messages to your command line,...).

-

Synopsis

-
namespace boost
-{
-	
-	namespace math
-	{
-		
-		template<typename T> inline T																																acosh(const T x);
-		
-		template<typename T> inline T																																asinh(const T x);
-		
-		template<typename T> inline T																																atanh(const T x);
-		
-		template<typename T> inline T																																sinc_pi(const T x);
-		
-		template<typename T, template<typename> class U>	inline U<T>	sinc_pi(const U<T> x);
-		
-		template<typename T> inline T																																sinhc_pi(const T x);
-		
-		template<typename T, template<typename> class U>	inline U<T>	sinhc_pi(const U<T> x);
-		
-
-	}
-
-	
-
-}
-

Functions

-

The functions implemented here can throw standard exceptions, but no exception specification has been made.

-

acosh

-
template<typename T> inline T acosh(const T x);
-
-

Computes the reciprocal of (the restriction to the range of) the hyperbolic cosine function, at x. Values returned are positive. Generalised Taylor series are used near 1 and Laurent series are used near the infinity to ensure accuracy.

-

If x is in the range a quiet NaN is returned (if the system allows, otherwise a domain_error exception is generated).

-
-

asinh

-
template<typename T> inline T asinh(const T x);
-
-

Computes the reciprocal of the hyperbolic sine function. Taylor series are used at the origin and Laurent series are used near the infinity to ensure accuracy.

-
-

atanh

-
template<typename T> inline T atanh(const T x);
-
-

Computes the reciprocal of the hyperbolic tangent function, at x. Taylor series are used at the origin to ensure accuracy.

-

If x is in the range or in the range a quiet NaN is returned (if the system allows, otherwise a domain_error exception is generated).

-

If x is in the range , minus infinity is returned (if the system allows, otherwise an out_of_range exception is generated), with denoting numeric_limits<T>::epsilon().

-

If x is in the range , plus infinity is returned (if the system allows, otherwise an out_of_range exception is generated), with denoting numeric_limits<T>::epsilon().

-
-

sinc_pi

-
template<typename T> inline T 																															sinc_pi(const T x);
-
template<typename T, template<typename> class U> inline U<T> sinc_pi(const U<T> x);
-
-

Computes the Sinus Cardinal of x. The second form is for complexes, quaternions, octonions... Taylor series are used at the origin to ensure accuracy.

-
-

sinhc_pi

-
template<typename T> inline T																								 							sinhc_pi(const T x);
-
template<typename T, template<typename> class U> inline U<T> sinhc_pi(const U<T> x);
-
-

Computes the Hyperbolic Sinus Cardinal of x. The second form is for complexes, quaternions, octonions... Taylor series are used at the origin to ensure accuracy.

-
-

History

- -

To Do

- -
-

Revised 06 Feb 2003

-

© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied  warranty, and with no claim as to its suitability for any purpose.

- - - \ No newline at end of file