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