Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/math/doc/math-octonion.qbk @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 67.0 KB
Line 
1
2[def __R ['[*R]]]
3[def __C ['[*C]]]
4[def __H ['[*H]]]
5[def __O ['[*O]]]
6[def __R3 ['[*'''R<superscript>3</superscript>''']]]
7[def __R4 ['[*'''R<superscript>4</superscript>''']]]
8[def __octulple ('''&#x03B1;,&#x03B2;,&#x03B3;,&#x03B4;,&#x03B5;,&#x03B6;,&#x03B7;,&#x03B8;''')]
9[def __oct_formula ['[^o = '''&#x03B1; + &#x03B2;i + &#x03B3;j + &#x03B4;k + &#x03B5;e' + &#x03B6;i' + &#x03B7;j' + &#x03B8;k' ''']]]
10[def __oct_complex_formula ['[^o = ('''&#x03B1; + &#x03B2;i) + (&#x03B3; + &#x03B4;i)j + (&#x03B5; + &#x03B6;i)e' + (&#x03B7; - &#x03B8;i)j' ''']]]
11[def __oct_quat_formula ['[^o = ('''&#x03B1; + &#x03B2;i + &#x03B3;j + &#x03B4;k) + (&#x03B5; + &#x03B6;i + &#x03B7;j - &#x03B8;j)e' ''']]]
12[def __oct_not_equal ['[^x(yz) '''&#x2260;''' (xy)z]]]
13
14
15[section Octonions]
16
17[section Overview]
18
19Octonions, like [link boost_math.quaternions quaternions], are a relative of complex numbers.
20
21Octonions see some use in theoretical physics.
22
23In practical terms, an octonion is simply an octuple of real numbers __octulple,
24which we can write in the form __oct_formula, where ['[^i]], ['[^j]] and ['[^k]]
25are the same objects as for quaternions, and ['[^e']], ['[^i']], ['[^j']] and ['[^k']]
26are distinct objects which play essentially the same kind of role as ['[^i]] (or ['[^j]] or ['[^k]]).
27
28Addition and a multiplication is defined on the set of octonions,
29which generalize their quaternionic counterparts. The main novelty this time
30is that [*the multiplication is not only not commutative, is now not even
31associative] (i.e. there are quaternions ['[^x]], ['[^y]] and ['[^z]] such that __oct_not_equal).
32A way of remembering things is by using the following multiplication table:
33
34[$../../libs/math/octonion/graphics/octonion_blurb17.jpeg]
35
36Octonions (and their kin) are described in far more details in this other
37[@../../libs/math/quaternion/TQE.pdf document]
38(with [@../../libs/math/quaternion/TQE_EA.pdf errata and addenda]).
39
40Some traditional constructs, such as the exponential, carry over without too
41much change into the realms of octonions, but other, such as taking a square root,
42do not (the fact that the exponential has a closed form is a result of the
43author, but the fact that the exponential exists at all for octonions is known
44since quite a long time ago).
45
46[endsect]
47
48[section Header File]
49
50The interface and implementation are both supplied by the header file
51[@../../boost/math/octonion.hpp octonion.hpp].
52
53[endsect]
54
55[section Synopsis]
56
57   namespace boost{ namespace math{
58
59   template<typename T> class ``[link boost_math.octonions.template_class_octonion octonion]``;
60   template<>           class ``[link boost_math.octonions.octonion_specializations octonion<float>]``;
61   template<>           class ``[link boost_math.octonion_double octonion<double>]``;
62   template<>           class ``[link boost_math.octonion_long_double octonion<long double>]``;
63
64   // operators
65
66   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_addition_operators operator +]`` (T const & lhs, octonion<T> const & rhs);
67   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_addition_operators operator +]`` (octonion<T> const & lhs, T const & rhs);
68   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_addition_operators operator +]`` (::std::complex<T> const & lhs, octonion<T> const & rhs);
69   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_addition_operators operator +]`` (octonion<T> const & lhs, ::std::complex<T> const & rhs);
70   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_addition_operators operator +]`` (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
71   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_addition_operators operator +]`` (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
72   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_addition_operators operator +]`` (octonion<T> const & lhs, octonion<T> const & rhs);
73
74   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_subtraction_operators operator -]`` (T const & lhs, octonion<T> const & rhs);
75   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_subtraction_operators operator -]`` (octonion<T> const & lhs, T const & rhs);
76   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_subtraction_operators operator -]`` (::std::complex<T> const & lhs, octonion<T> const & rhs);
77   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_subtraction_operators operator -]`` (octonion<T> const & lhs, ::std::complex<T> const & rhs);
78   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_subtraction_operators operator -]`` (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
79   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_subtraction_operators operator -]`` (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
80   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_subtraction_operators operator -]`` (octonion<T> const & lhs, octonion<T> const & rhs);
81
82   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_multiplication_operators operator *]`` (T const & lhs, octonion<T> const & rhs);
83   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_multiplication_operators operator *]`` (octonion<T> const & lhs, T const & rhs);
84   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_multiplication_operators operator *]`` (::std::complex<T> const & lhs, octonion<T> const & rhs);
85   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_multiplication_operators operator *]`` (octonion<T> const & lhs, ::std::complex<T> const & rhs);
86   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_multiplication_operators operator *]`` (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
87   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_multiplication_operators operator *]`` (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
88   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_multiplication_operators operator *]`` (octonion<T> const & lhs, octonion<T> const & rhs);
89
90   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_division_operators operator /]`` (T const & lhs, octonion<T> const & rhs);
91   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_division_operators operator /]`` (octonion<T> const & lhs, T const & rhs);
92   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_division_operators operator /]`` (::std::complex<T> const & lhs, octonion<T> const & rhs);
93   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_division_operators operator /]`` (octonion<T> const & lhs, ::std::complex<T> const & rhs);
94   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_division_operators operator /]`` (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
95   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_division_operators operator /]`` (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
96   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.binary_division_operators operator /]`` (octonion<T> const & lhs, octonion<T> const & rhs);
97
98   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.unary_plus_and_minus_operators operator +]`` (octonion<T> const & o);
99   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_non_member_operators.unary_plus_and_minus_operators operator -]`` (octonion<T> const & o);
100
101   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_equality_operators operator ==]`` (T const & lhs, octonion<T> const & rhs);
102   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_equality_operators operator ==]`` (octonion<T> const & lhs, T const & rhs);
103   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_equality_operators operator ==]`` (::std::complex<T> const & lhs, octonion<T> const & rhs);
104   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_equality_operators operator ==]`` (octonion<T> const & lhs, ::std::complex<T> const & rhs);
105   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_equality_operators operator ==]`` (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
106   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_equality_operators operator ==]`` (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
107   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_equality_operators operator ==]`` (octonion<T> const & lhs, octonion<T> const & rhs);
108
109   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_inequality_operators operator !=]`` (T const & lhs, octonion<T> const & rhs);
110   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_inequality_operators operator !=]`` (octonion<T> const & lhs, T const & rhs);
111   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_inequality_operators operator !=]`` (::std::complex<T> const & lhs, octonion<T> const & rhs);
112   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_inequality_operators operator !=]`` (octonion<T> const & lhs, ::std::complex<T> const & rhs);
113   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_inequality_operators operator !=]`` (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
114   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_inequality_operators operator !=]`` (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
115   template<typename T> bool ``[link boost_math.octonions.octonion_non_member_operators.binary_inequality_operators operator !=]`` (octonion<T> const & lhs, octonion<T> const & rhs);
116
117   template<typename T, typename charT, class traits>
118   ::std::basic_istream<charT,traits> & ``[link boost_math.octonions.octonion_non_member_operators.stream_extractor operator >>]`` (::std::basic_istream<charT,traits> & is, octonion<T> & o);
119
120   template<typename T, typename charT, class traits>
121   ::std::basic_ostream<charT,traits> & ``[link boost_math.octonions.octonion_non_member_operators.stream_inserter operator <<]`` (::std::basic_ostream<charT,traits> & os, octonion<T> const & o);
122
123   // values
124
125   template<typename T> T           ``[link boost_math.octonions.octonion_value_operations.real_and_unreal real]``(octonion<T> const & o);
126   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_value_operations.real_and_unreal unreal]``(octonion<T> const & o);
127
128   template<typename T> T           ``[link boost_math.octonions.octonion_value_operations.sup sup]``(octonion<T> const & o);
129   template<typename T> T           ``[link boost_math.octonions.octonion_value_operations.l1 l1]``(octonion<T>const & o);
130   template<typename T> T           ``[link boost_math.octonions.octonion_value_operations.abs abs]``(octonion<T> const & o);
131   template<typename T> T           ``[link boost_math.octonions.octonion_value_operations.norm norm]``(octonion<T>const  & o);
132   template<typename T> octonion<T> ``[link boost_math.octonions.octonion_value_operations.conj conj]``(octonion<T> const & o);
133
134   template<typename T> octonion<T> ``[link boost_math.octonions.quaternion_creation_functions 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);
135   template<typename T> octonion<T> ``[link boost_math.octonions.quaternion_creation_functions 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);
136   template<typename T> octonion<T> ``[link boost_math.octonions.quaternion_creation_functions 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);
137
138   // transcendentals
139
140   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.exp exp]``(octonion<T> const & o);
141   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.cos cos]``(octonion<T> const & o);
142   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.sin sin]``(octonion<T> const & o);
143   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.tan tan]``(octonion<T> const & o);
144   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.cosh cosh]``(octonion<T> const & o);
145   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.sinh sinh]``(octonion<T> const & o);
146   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.tanh tanh]``(octonion<T> const & o);
147
148   template<typename T> octonion<T> ``[link boost_math.octonions.octonions_transcendentals.pow pow]``(octonion<T> const & o, int n);
149
150   }  } // namespaces
151   
152[endsect]
153
154[section Template Class octonion]
155
156   namespace boost{ namespace math {
157 
158   template<typename T>
159   class octonion
160   {
161   public:
162      typedef T value_type;
163
164      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors 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());
165      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors 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>());
166      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(::boost::math::quaternion<T> const & q0, ::boost::math::quaternion<T> const & q1 = ::boost::math::quaternion<T>());
167      template<typename X>
168      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(octonion<X> const & a_recopier);
169
170      T                             ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts real]``() const;
171      octonion<T>                   ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts unreal]``() const;
172
173      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_1]``() const;
174      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_2]``() const;
175      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_3]``() const;
176      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_4]``() const;
177      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_5]``() const;
178      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_6]``() const;
179      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_7]``() const;
180      T                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_8]``() const;
181
182      ::std::complex<T>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_1]``() const;
183      ::std::complex<T>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_2]``() const;
184      ::std::complex<T>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_3]``() const;
185      ::std::complex<T>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_4]``() const;
186
187      ::boost::math::quaternion<T>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_1]``() const;
188      ::boost::math::quaternion<T>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_2]``() const;
189
190      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<T> const  & a_affecter);
191      template<typename X>
192      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<X> const  & a_affecter);
193      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (T const  & a_affecter);
194      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::std::complex<T> const & a_affecter);
195      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::boost::math::quaternion<T> const & a_affecter);
196
197      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (T const & rhs);
198      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::std::complex<T> const & rhs);
199      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::boost::math::quaternion<T> const & rhs);
200      template<typename X>
201      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (octonion<X> const & rhs);
202
203      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (T const & rhs);
204      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::std::complex<T> const & rhs);
205      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::boost::math::quaternion<T> const & rhs);
206      template<typename X>
207      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (octonion<X> const & rhs);
208
209      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (T const & rhs);
210      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::std::complex<T> const & rhs);
211      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::boost::math::quaternion<T> const & rhs);
212      template<typename X>
213      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (octonion<X> const & rhs);
214
215      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (T const & rhs);
216      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::std::complex<T> const & rhs);
217      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::boost::math::quaternion<T> const & rhs);
218      template<typename X>
219      octonion<T> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (octonion<X> const & rhs);
220   };
221
222   } } // namespaces
223   
224[endsect]
225
226[section Octonion Specializations]
227
228   namespace boost{ namespace math{
229   
230   template<>
231   class octonion<float>
232   {
233   public:
234      typedef float value_type;
235
236      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors 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);
237      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors 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>());
238      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(::boost::math::quaternion<float> const & q0, ::boost::math::quaternion<float> const & q1 = ::boost::math::quaternion<float>());
239      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(octonion<double> const & a_recopier);
240      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(octonion<long double> const & a_recopier);
241
242      float                             ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts real]``() const;
243      octonion<float>                   ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts unreal]``() const;
244
245      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_1]``() const;
246      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_2]``() const;
247      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_3]``() const;
248      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_4]``() const;
249      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_5]``() const;
250      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_6]``() const;
251      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_7]``() const;
252      float                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_8]``() const;
253
254      ::std::complex<float>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_1]``() const;
255      ::std::complex<float>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_2]``() const;
256      ::std::complex<float>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_3]``() const;
257      ::std::complex<float>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_4]``() const;
258
259      ::boost::math::quaternion<float>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_1]``() const;
260      ::boost::math::quaternion<float>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_2]``() const;
261
262      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<float> const  & a_affecter);
263      template<typename X>
264      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<X> const  & a_affecter);
265      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (float const  & a_affecter);
266      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::std::complex<float> const & a_affecter);
267      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::boost::math::quaternion<float> const & a_affecter);
268
269      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (float const & rhs);
270      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::std::complex<float> const & rhs);
271      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::boost::math::quaternion<float> const & rhs);
272      template<typename X>
273      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (octonion<X> const & rhs);
274
275      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (float const & rhs);
276      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::std::complex<float> const & rhs);
277      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::boost::math::quaternion<float> const & rhs);
278      template<typename X>
279      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (octonion<X> const & rhs);
280
281      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (float const & rhs);
282      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::std::complex<float> const & rhs);
283      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::boost::math::quaternion<float> const & rhs);
284      template<typename X>
285      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (octonion<X> const & rhs);
286
287      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (float const & rhs);
288      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::std::complex<float> const & rhs);
289      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::boost::math::quaternion<float> const & rhs);
290      template<typename X>
291      octonion<float> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (octonion<X> const & rhs);
292   };
293
294[#boost_math.octonion_double]
295
296   template<>
297   class octonion<double>
298   {
299   public:
300      typedef double value_type;
301
302      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors 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);
303      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors 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>());
304      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(::boost::math::quaternion<double> const & q0, ::boost::math::quaternion<double> const & q1 = ::boost::math::quaternion<double>());
305      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(octonion<float> const & a_recopier);
306      explicit  ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(octonion<long double> const & a_recopier);
307
308      double                             ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts real]``() const;
309      octonion<double>                   ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts unreal]``() const;
310
311      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_1]``() const;
312      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_2]``() const;
313      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_3]``() const;
314      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_4]``() const;
315      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_5]``() const;
316      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_6]``() const;
317      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_7]``() const;
318      double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_8]``() const;
319
320      ::std::complex<double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_1]``() const;
321      ::std::complex<double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_2]``() const;
322      ::std::complex<double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_3]``() const;
323      ::std::complex<double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_4]``() const;
324
325      ::boost::math::quaternion<double>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_1]``() const;
326      ::boost::math::quaternion<double>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_2]``() const;
327
328      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<double> const  & a_affecter);
329      template<typename X>
330      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<X> const  & a_affecter);
331      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (double const  & a_affecter);
332      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::std::complex<double> const & a_affecter);
333      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::boost::math::quaternion<double> const & a_affecter);
334
335      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (double const & rhs);
336      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::std::complex<double> const & rhs);
337      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::boost::math::quaternion<double> const & rhs);
338      template<typename X>
339      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (octonion<X> const & rhs);
340
341      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (double const & rhs);
342      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::std::complex<double> const & rhs);
343      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::boost::math::quaternion<double> const & rhs);
344      template<typename X>
345      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (octonion<X> const & rhs);
346
347      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (double const & rhs);
348      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::std::complex<double> const & rhs);
349      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::boost::math::quaternion<double> const & rhs);
350      template<typename X>
351      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (octonion<X> const & rhs);
352
353      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (double const & rhs);
354      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::std::complex<double> const & rhs);
355      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::boost::math::quaternion<double> const & rhs);
356      template<typename X>
357      octonion<double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (octonion<X> const & rhs);
358   };
359
360[#boost_math.octonion_long_double]
361
362   template<>
363   class octonion<long double>
364   {
365   public:
366      typedef long double value_type;
367
368      explicit   ``[link boost_math.octonions.octonion_member_functions.constructors 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);
369      explicit   ``[link boost_math.octonions.octonion_member_functions.constructors 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>());
370      explicit   ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``( ::boost::math::quaternion<long double> const & q0, ::boost::math::quaternion<long double> const & z1 = ::boost::math::quaternion<long double>());
371      explicit   ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(octonion<float> const & a_recopier);
372      explicit   ``[link boost_math.octonions.octonion_member_functions.constructors octonion]``(octonion<double> const & a_recopier);
373
374      long double                             ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts real]``() const;
375      octonion<long double>                   ``[link boost_math.octonions.octonion_member_functions.real_and_unreal_parts unreal]``() const;
376
377      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_1]``() const;
378      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_2]``() const;
379      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_3]``() const;
380      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_4]``() const;
381      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_5]``() const;
382      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_6]``() const;
383      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_7]``() const;
384      long double                             ``[link boost_math.octonions.octonion_member_functions.individual_real_components R_component_8]``() const;
385
386      ::std::complex<long double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_1]``() const;
387      ::std::complex<long double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_2]``() const;
388      ::std::complex<long double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_3]``() const;
389      ::std::complex<long double>             ``[link boost_math.octonions.octonion_member_functions.individual_complex_components C_component_4]``() const;
390
391      ::boost::math::quaternion<long double>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_1]``() const;
392      ::boost::math::quaternion<long double>  ``[link boost_math.octonions.octonion_member_functions.individual_quaternion_components H_component_2]``() const;
393
394      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<long double> const  & a_affecter);
395      template<typename X>
396      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (octonion<X> const  & a_affecter);
397      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (long double const  & a_affecter);
398      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::std::complex<long double> const & a_affecter);
399      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.assignment_operators operator =]`` (::boost::math::quaternion<long double> const & a_affecter);
400
401      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (long double const & rhs);
402      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::std::complex<long double> const & rhs);
403      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (::boost::math::quaternion<long double> const & rhs);
404      template<typename X>
405      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator +=]`` (octonion<X> const & rhs);
406
407      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (long double const & rhs);
408      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::std::complex<long double> const & rhs);
409      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (::boost::math::quaternion<long double> const & rhs);
410      template<typename X>
411      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator -=]`` (octonion<X> const & rhs);
412
413      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (long double const & rhs);
414      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::std::complex<long double> const & rhs);
415      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (::boost::math::quaternion<long double> const & rhs);
416      template<typename X>
417      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator *=]`` (octonion<X> const & rhs);
418
419      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (long double const & rhs);
420      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::std::complex<long double> const & rhs);
421      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (::boost::math::quaternion<long double> const & rhs);
422      template<typename X>
423      octonion<long double> & ``[link boost_math.octonions.octonion_member_functions.other_member_operators operator /=]`` (octonion<X> const & rhs);
424   };
425
426   } } // namespaces
427   
428[endsect]
429
430[section Octonion Member Typedefs]
431
432[*value_type]
433
434Template version:
435
436   typedef T value_type;
437
438Float specialization version:
439
440   typedef float value_type;
441   
442Double specialization version:
443
444   typedef double value_type;
445
446Long double specialization version:
447
448   typedef long double value_type;
449
450These provide easy acces to the type the template is built upon.
451
452[endsect]
453
454[section Octonion Member Functions]
455
456[h3 Constructors]
457
458Template version:
459
460   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());
461   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>());
462   explicit  octonion(::boost::math::quaternion<T> const & q0, ::boost::math::quaternion<T> const & q1 = ::boost::math::quaternion<T>());
463   template<typename X>
464   explicit octonion(octonion<X> const & a_recopier);
465
466Float specialization version:
467
468   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);
469   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>());
470   explicit  octonion(::boost::math::quaternion<float> const & q0, ::boost::math::quaternion<float> const & q1 = ::boost::math::quaternion<float>());
471   explicit  octonion(octonion<double> const & a_recopier);
472   explicit  octonion(octonion<long double> const & a_recopier);
473
474Double specialization version:
475
476   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);
477   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>());
478   explicit  octonion(::boost::math::quaternion<double> const & q0, ::boost::math::quaternion<double> const & q1 = ::boost::math::quaternion<double>());
479   explicit  octonion(octonion<float> const & a_recopier);
480   explicit  octonion(octonion<long double> const & a_recopier);
481
482Long double specialization version:
483
484   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);
485   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>());
486   explicit  octonion(::boost::math::quaternion<long double> const & q0, ::boost::math::quaternion<long double> const & q1 = ::boost::math::quaternion<long double>());
487   explicit  octonion(octonion<float> const & a_recopier);
488   explicit  octonion(octonion<double> const & a_recopier);
489
490A default constructor is provided for each form, which initializes each component
491to the default values for their type (i.e. zero for floating numbers).
492This constructor can also accept one to eight base type arguments.
493A constructor is also provided to build octonions from one to four complex numbers
494sharing the same base type, and another taking one or two quaternions
495sharing the same base type. The unspecialized template also sports a
496templarized copy constructor, while the specialized forms have copy
497constructors from the other two specializations, which are explicit
498when a risk of precision loss exists. For the unspecialized form,
499the base type's constructors must not throw.
500
501Destructors and untemplated copy constructors (from the same type)
502are provided by the compiler. Converting copy constructors make use
503of a templated helper function in a "detail" subnamespace.
504
505[h3 Other member functions]
506
507[h4 Real and Unreal Parts]
508
509   T            real()   const;
510   octonion<T>  unreal() const;
511
512Like complex number, octonions do have a meaningful notion of "real part",
513but unlike them there is no meaningful notion of "imaginary part".
514Instead there is an "unreal part" which itself is a octonion,
515and usually nothing simpler (as opposed to the complex number case).
516These are returned by the first two functions.
517
518[h4 Individual Real Components]
519
520   T   R_component_1() const;
521   T   R_component_2() const;
522   T   R_component_3() const;
523   T   R_component_4() const;
524   T   R_component_5() const;
525   T   R_component_6() const;
526   T   R_component_7() const;
527   T   R_component_8() const;
528
529A octonion having eight real components, these are returned by
530these eight functions. Hence real and R_component_1 return the same value.
531
532[h4 Individual Complex Components]
533
534   ::std::complex<T> C_component_1() const;
535   ::std::complex<T> C_component_2() const;
536   ::std::complex<T> C_component_3() const;
537   ::std::complex<T> C_component_4() const;
538
539A octonion likewise has four complex components. Actually, octonions
540are indeed a (left) vector field over the complexes, but beware, as
541for any octonion __oct_formula we also have __oct_complex_formula
542(note the [*minus] sign in the last factor).
543What the C_component_n functions return, however, are the complexes
544which could be used to build the octonion using the constructor, and
545[*not] the components of the octonion on the basis ['[^(1, j, e', j')]].
546
547[h4 Individual Quaternion Components]
548
549   ::boost::math::quaternion<T> H_component_1() const;
550   ::boost::math::quaternion<T> H_component_2() const;
551
552Likewise, for any octonion __oct_formula we also have __oct_quat_formula, though there
553is no meaningful vector-space-like structure based on the quaternions.
554What the H_component_n functions return are the quaternions which
555could be used to build the octonion using the constructor.
556
557[h3 Octonion Member Operators]
558[h4 Assignment Operators]
559
560   octonion<T> & operator = (octonion<T> const & a_affecter);
561   template<typename X>
562   octonion<T> & operator = (octonion<X> const & a_affecter);
563   octonion<T> & operator = (T const & a_affecter);
564   octonion<T> & operator = (::std::complex<T> const & a_affecter);
565   octonion<T> & operator = (::boost::math::quaternion<T> const & a_affecter);
566
567These perform the expected assignment, with type modification if
568necessary (for instance, assigning from a base type will set the
569real part to that value, and all other components to zero).
570For the unspecialized form, the base type's assignment operators must not throw.
571
572[h4 Other Member Operators]
573
574   octonion<T> & operator += (T const & rhs)
575   octonion<T> & operator += (::std::complex<T> const & rhs);
576   octonion<T> & operator += (::boost::math::quaternion<T> const & rhs);
577   template<typename X>
578   octonion<T> & operator += (octonion<X> const & rhs);
579
580These perform the mathematical operation `(*this)+rhs` and store the result in
581`*this`. The unspecialized form has exception guards, which the specialized
582forms do not, so as to insure exception safety. For the unspecialized form,
583the base type's assignment operators must not throw.
584
585   octonion<T> & operator -= (T const & rhs)
586   octonion<T> & operator -= (::std::complex<T> const & rhs);
587   octonion<T> & operator -= (::boost::math::quaternion<T> const & rhs);
588   template<typename X>
589   octonion<T> & operator -= (octonion<X> const & rhs);
590
591These perform the mathematical operation `(*this)-rhs` and store the result
592in `*this`. The unspecialized form has exception guards, which the
593specialized forms do not, so as to insure exception safety.
594For the unspecialized form, the base type's assignment operators must not throw.
595
596   octonion<T> & operator *= (T const & rhs)
597   octonion<T> & operator *= (::std::complex<T> const & rhs);
598   octonion<T> & operator *= (::boost::math::quaternion<T> const & rhs);
599   template<typename X>
600   octonion<T> & operator *= (octonion<X> const & rhs);
601
602These perform the mathematical operation `(*this)*rhs` in this order
603(order is important as multiplication is not commutative for octonions)
604and store the result in `*this`. The unspecialized form has exception guards,
605which the specialized forms do not, so as to insure exception safety.
606For the unspecialized form, the base type's assignment operators must
607not throw. Also, for clarity's sake, you should always group the
608factors in a multiplication by groups of two, as the multiplication is
609not even associative on the octonions (though there are of course cases
610where this does not matter, it usually does).
611
612   octonion<T> & operator /= (T const & rhs)
613   octonion<T> & operator /= (::std::complex<T> const & rhs);
614   octonion<T> & operator /= (::boost::math::quaternion<T> const & rhs);
615   template<typename X>
616   octonion<T> & operator /= (octonion<X> const & rhs);
617
618These perform the mathematical operation `(*this)*inverse_of(rhs)`
619in this order (order is important as multiplication is not commutative
620for octonions) and store the result in `*this`. The unspecialized form
621has exception guards, which the specialized forms do not, so as to
622insure exception safety. For the unspecialized form, the base
623type's assignment operators must not throw. As for the multiplication,
624remember to group any two factors using parenthesis.
625
626[endsect]
627
628[section Octonion Non-Member Operators]
629
630[h4 Unary Plus and Minus Operators]
631
632   template<typename T> octonion<T> operator + (octonion<T> const & o);
633
634This unary operator simply returns o.
635
636   template<typename T> octonion<T> operator - (octonion<T> const & o);
637
638This unary operator returns the opposite of o.
639
640[h4 Binary Addition Operators]
641
642   template<typename T> octonion<T> operator + (T const & lhs, octonion<T> const & rhs);
643   template<typename T> octonion<T> operator + (octonion<T> const & lhs, T const & rhs);
644   template<typename T> octonion<T> operator + (::std::complex<T> const & lhs, octonion<T> const & rhs);
645   template<typename T> octonion<T> operator + (octonion<T> const & lhs, ::std::complex<T> const & rhs);
646   template<typename T> octonion<T> operator + (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
647   template<typename T> octonion<T> operator + (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
648   template<typename T> octonion<T> operator + (octonion<T> const & lhs, octonion<T> const & rhs);
649
650These operators return `octonion<T>(lhs) += rhs`.
651
652[h4 Binary Subtraction Operators]
653
654   template<typename T> octonion<T> operator - (T const & lhs, octonion<T> const & rhs);
655   template<typename T> octonion<T> operator - (octonion<T> const & lhs, T const & rhs);
656   template<typename T> octonion<T> operator - (::std::complex<T> const & lhs, octonion<T> const & rhs);
657   template<typename T> octonion<T> operator - (octonion<T> const & lhs, ::std::complex<T> const & rhs);
658   template<typename T> octonion<T> operator - (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
659   template<typename T> octonion<T> operator - (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
660   template<typename T> octonion<T> operator - (octonion<T> const & lhs, octonion<T> const & rhs);
661
662These operators return `octonion<T>(lhs) -= rhs`.
663
664[h4 Binary Multiplication Operators]
665
666   template<typename T> octonion<T> operator * (T const & lhs, octonion<T> const & rhs);
667   template<typename T> octonion<T> operator * (octonion<T> const & lhs, T const & rhs);
668   template<typename T> octonion<T> operator * (::std::complex<T> const & lhs, octonion<T> const & rhs);
669   template<typename T> octonion<T> operator * (octonion<T> const & lhs, ::std::complex<T> const & rhs);
670   template<typename T> octonion<T> operator * (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
671   template<typename T> octonion<T> operator * (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
672   template<typename T> octonion<T> operator * (octonion<T> const & lhs, octonion<T> const & rhs);
673
674These operators return `octonion<T>(lhs) *= rhs`.
675
676[h4 Binary Division Operators]
677
678   template<typename T> octonion<T> operator / (T const & lhs, octonion<T> const & rhs);
679   template<typename T> octonion<T> operator / (octonion<T> const & lhs, T const & rhs);
680   template<typename T> octonion<T> operator / (::std::complex<T> const & lhs, octonion<T> const & rhs);
681   template<typename T> octonion<T> operator / (octonion<T> const & lhs, ::std::complex<T> const & rhs);
682   template<typename T> octonion<T> operator / (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
683   template<typename T> octonion<T> operator / (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
684   template<typename T> octonion<T> operator / (octonion<T> const & lhs, octonion<T> const & rhs);
685
686These operators return `octonion<T>(lhs) /= rhs`. It is of course still an
687error to divide by zero...
688
689[h4 Binary Equality Operators]
690
691   template<typename T> bool operator == (T const & lhs, octonion<T> const & rhs);
692   template<typename T> bool operator == (octonion<T> const & lhs, T const & rhs);
693   template<typename T> bool operator == (::std::complex<T> const & lhs, octonion<T> const & rhs);
694   template<typename T> bool operator == (octonion<T> const & lhs, ::std::complex<T> const & rhs);
695   template<typename T> bool operator == (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
696   template<typename T> bool operator == (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
697   template<typename T> bool operator == (octonion<T> const & lhs, octonion<T> const & rhs);
698
699These return true if and only if the four components of `octonion<T>(lhs)`
700are equal to their counterparts in `octonion<T>(rhs)`. As with any
701floating-type entity, this is essentially meaningless.
702
703[h4 Binary Inequality Operators]
704
705   template<typename T> bool operator != (T const & lhs, octonion<T> const & rhs);
706   template<typename T> bool operator != (octonion<T> const & lhs, T const & rhs);
707   template<typename T> bool operator != (::std::complex<T> const & lhs, octonion<T> const & rhs);
708   template<typename T> bool operator != (octonion<T> const & lhs, ::std::complex<T> const & rhs);
709   template<typename T> bool operator != (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
710   template<typename T> bool operator != (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
711   template<typename T> bool operator != (octonion<T> const & lhs, octonion<T> const & rhs);
712
713These return true if and only if `octonion<T>(lhs) == octonion<T>(rhs)`
714is false. As with any floating-type entity, this is essentially meaningless.
715
716[h4 Stream Extractor]
717
718   template<typename T, typename charT, class traits>
719   ::std::basic_istream<charT,traits> & operator >> (::std::basic_istream<charT,traits> & is, octonion<T> & o);
720
721Extracts an octonion `o`. We accept any format which seems reasonable.
722However, since this leads to a great many ambiguities, decisions were made
723to lift these. In case of doubt, stick to lists of reals.
724
725The input values must be convertible to T. If bad input is encountered,
726calls `is.setstate(ios::failbit)` (which may throw `ios::failure` (27.4.5.3)).
727
728Returns `is`.
729
730[h4 Stream Inserter]
731
732   template<typename T, typename charT, class traits>
733   ::std::basic_ostream<charT,traits> & operator << (::std::basic_ostream<charT,traits> & os, octonion<T> const & o);
734
735Inserts the octonion `o` onto the stream `os` as if it were implemented as follows:
736
737   template<typename T, typename charT, class traits>
738   ::std::basic_ostream<charT,traits> & operator << ( ::std::basic_ostream<charT,traits> & os,
739   octonion<T> const & o)
740   {
741      ::std::basic_ostringstream<charT,traits> s;
742
743      s.flags(os.flags());
744      s.imbue(os.getloc());
745      s.precision(os.precision());
746
747      s << '(' << o.R_component_1() << ','
748         << o.R_component_2() << ','
749         << o.R_component_3() << ','
750         << o.R_component_4() << ','
751         << o.R_component_5() << ','
752         << o.R_component_6() << ','
753         << o.R_component_7() << ','
754         << o.R_component_8() << ')';
755
756      return os << s.str();
757   }
758   
759[endsect]
760
761[section Octonion Value Operations]
762
763[h4 Real and Unreal]
764
765   template<typename T> T  real(octonion<T> const & o);
766   template<typename T> octonion<T> unreal(octonion<T> const & o);
767
768These return `o.real()` and `o.unreal()` respectively.
769
770[h4 conj]
771
772   template<typename T> octonion<T> conj(octonion<T> const & o);
773
774This returns the conjugate of the octonion.
775
776[h4 sup]
777
778   template<typename T> T   sup(octonion<T> const & o);
779
780This return the sup norm (the greatest among
781`abs(o.R_component_1())...abs(o.R_component_8()))` of the octonion.
782
783[h4 l1]
784
785   template<typename T> T   l1(octonion<T> const & o);
786
787This return the l1 norm (`abs(o.R_component_1())+...+abs(o.R_component_8())`)
788of the octonion.
789
790[h4 abs]
791
792   template<typename T> T   abs(octonion<T> const & o);
793
794This return the magnitude (Euclidian norm) of the octonion.
795
796[h4 norm]
797
798   template<typename T> T  norm(octonion<T>const  & o);
799
800This return the (Cayley) norm of the octonion. The term "norm" might
801be confusing, as most people associate it with the Euclidian norm
802(and quadratic functionals). For this version of (the mathematical
803objects known as) octonions, the Euclidian norm (also known as
804magnitude) is the square root of the Cayley norm.
805
806[endsect]
807
808[section Quaternion Creation Functions]
809
810   template<typename T> 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);
811   template<typename T> 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);
812   template<typename T> 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);
813
814These build octonions in a way similar to the way polar builds
815complex numbers, as there is no strict equivalent to
816polar coordinates for octonions.
817
818`spherical` is a simple transposition of `polar`, it takes as inputs a
819(positive) magnitude and a point on the hypersphere, given
820by three angles. The first of these, ['theta] has a natural range of
821-pi to +pi, and the other two have natural ranges of
822-pi/2 to +pi/2 (as is the case with the usual spherical
823coordinates in __R3). Due to the many symmetries and periodicities,
824nothing untoward happens if the magnitude is negative or the angles are
825outside their natural ranges. The expected degeneracies (a magnitude of
826zero ignores the angles settings...) do happen however.
827
828`cylindrical` is likewise a simple transposition of the usual
829cylindrical coordinates in __R3, which in turn is another derivative of
830planar polar coordinates. The first two inputs are the polar
831coordinates of the first __C component of the octonion. The third and
832fourth inputs are placed into the third and fourth __R components of the
833octonion, respectively.
834
835`multipolar` is yet another simple generalization of polar coordinates.
836This time, both __C components of the octonion are given in polar coordinates.
837
838In this version of our implementation of octonions, there is no
839analogue of the complex value operation arg as the situation is
840somewhat more complicated.
841
842[endsect]
843
844[section Octonions Transcendentals]
845
846There is no `log` or `sqrt` provided for octonions in this implementation,
847and `pow` is likewise restricted to integral powers of the exponent.
848There are several reasons to this: on the one hand, the equivalent of
849analytic continuation for octonions ("branch cuts") remains to be
850investigated thoroughly (by me, at any rate...), and we wish to avoid
851the nonsense introduced in the standard by exponentiations of
852complexes by complexes (which is well defined, but not in the standard...).
853Talking of nonsense, saying that `pow(0,0)` is "implementation defined" is
854just plain brain-dead...
855
856We do, however provide several transcendentals, chief among which is
857the exponential. That it allows for a "closed formula" is a result
858of the author (the existence and definition of the exponential, on the
859octonions among others, on the other hand, is a few centuries old).
860Basically, any converging power series with real coefficients which
861allows for a closed formula in __C can be transposed to __O. More
862transcendentals of this type could be added in a further revision upon
863request. It should be noted that it is these functions which force the
864dependency upon the
865[@../../boost/math/special_functions/sinc.hpp boost/math/special_functions/sinc.hpp]
866and the
867[@../../boost/math/special_functions/sinhc.hpp boost/math/special_functions/sinhc.hpp]
868headers.
869
870[h4 exp]
871
872   template<typename T>
873   octonion<T> exp(octonion<T> const & o);
874
875Computes the exponential of the octonion.
876
877[h4 cos]
878
879   template<typename T>
880   octonion<T> cos(octonion<T> const & o);
881
882Computes the cosine of the octonion
883
884[h4 sin]
885
886   template<typename T>
887   octonion<T> sin(octonion<T> const & o);
888
889Computes the sine of the octonion.
890
891[h4 tan]
892
893   template<typename T>
894   octonion<T> tan(octonion<T> const & o);
895
896Computes the tangent of the octonion.
897
898[h4 cosh]
899
900   template<typename T>
901   octonion<T> cosh(octonion<T> const & o);
902
903Computes the hyperbolic cosine of the octonion.
904
905[h4 sinh]
906
907   template<typename T>
908   octonion<T> sinh(octonion<T> const & o);
909
910Computes the hyperbolic sine of the octonion.
911
912[h4 tanh]
913
914   template<typename T>
915   octonion<T> tanh(octonion<T> const & o);
916
917Computes the hyperbolic tangent of the octonion.
918
919[h4 pow]
920
921   template<typename T>
922   octonion<T>  pow(octonion<T> const & o, int n);
923
924Computes the n-th power of the octonion q.
925
926[endsect]
927
928[section Test Program]
929
930The [@../../libs/math/octonion/octonion_test.cpp octonion_test.cpp]
931test program tests octonions specialisations for float, double and long double
932([@../../libs/math/octonion/output.txt sample output]).
933
934If you define the symbol BOOST_OCTONION_TEST_VERBOSE, you will get additional
935output ([@../../libs/math/octonion/output_more.txt verbose output]); this will
936only be helpfull if you enable message output at the same time, of course
937(by uncommenting the relevant line in the test or by adding --log_level=messages
938to your command line,...). In that case, and if you are running interactively,
939you may in addition define the symbol BOOST_INTERACTIVE_TEST_INPUT_ITERATOR to
940interactively test the input operator with input of your choice from the
941standard input (instead of hard-coding it in the test).
942
943[endsect]
944
945[section Acknowledgements]
946
947The mathematical text has been typeset with
948[@http://www.nisus-soft.com/ Nisus Writer].
949Jens Maurer has helped with portability and standard adherence, and was the
950Review Manager for this library. More acknowledgements in the
951History section. Thank you to all who contributed to the discussion about this library.
952
953[endsect]
954
955[section History]
956
957* 1.5.8 - 17/12/2005: Converted documentation to Quickbook Format.
958* 1.5.7 - 25/02/2003: transitionned to the unit test framework; <boost/config.hpp> now included by the library header (rather than the test files), via <boost/math/quaternion.hpp>.
959* 1.5.6 - 15/10/2002: Gcc2.95.x and stlport on linux compatibility by Alkis Evlogimenos (alkis@routescience.com).
960* 1.5.5 - 27/09/2002: Microsoft VCPP 7 compatibility, by Michael Stevens (michael@acfr.usyd.edu.au); requires the /Za compiler option.
961* 1.5.4 - 19/09/2002: fixed problem with multiple inclusion (in different translation units); attempt at an improved compatibility with Microsoft compilers, by Michael Stevens (michael@acfr.usyd.edu.au) and Fredrik Blomqvist; other compatibility fixes.
962* 1.5.3 - 01/02/2002: bugfix and Gcc 2.95.3 compatibility by Douglas Gregor (gregod@cs.rpi.edu).
963* 1.5.2 - 07/07/2001: introduced namespace math.
964* 1.5.1 - 07/06/2001: (end of Boost review) now includes <boost/math/special_functions/sinc.hpp> and <boost/math/special_functions/sinhc.hpp> instead of <boost/special_functions.hpp>; corrected bug in sin (Daryle Walker); removed check for self-assignment (Gary Powel); made converting functions explicit (Gary Powel); added overflow guards for division operators and abs (Peter Schmitteckert); added sup and l1; used Vesa Karvonen's CPP metaprograming technique to simplify code.
965* 1.5.0 - 23/03/2001: boostification, inlining of all operators except input, output and pow, fixed exception safety of some members (template version).
966* 1.4.0 - 09/01/2001: added tan and tanh.
967* 1.3.1 - 08/01/2001: cosmetic fixes.
968* 1.3.0 - 12/07/2000: pow now uses Maarten Hilferink's (mhilferink@tip.nl) algorithm.
969* 1.2.0 - 25/05/2000: fixed the division operators and output; changed many signatures.
970* 1.1.0 - 23/05/2000: changed sinc into sinc_pi; added sin, cos, sinh, cosh.
971* 1.0.0 - 10/08/1999: first public version.
972
973[endsect]
974
975[section To Do]
976
977* Improve testing.
978* Rewrite input operatore using Spirit (creates a dependency).
979* Put in place an Expression Template mechanism (perhaps borrowing from uBlas).
980
981[endsect]
982
983[endsect]
Note: See TracBrowser for help on using the repository browser.