1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Octonion Member Functions</title> 5<link rel="stylesheet" href="../math.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../index.html" title="Math Toolkit 2.12.0"> 8<link rel="up" href="../octonions.html" title="Chapter 17. Octonions"> 9<link rel="prev" href="oct_typedefs.html" title="Octonion Member Typedefs"> 10<link rel="next" href="oct_non_mem.html" title="Octonion Non-Member Operators"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="oct_typedefs.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../octonions.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="oct_non_mem.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 27<a name="math_toolkit.oct_mem_fun"></a><a class="link" href="oct_mem_fun.html" title="Octonion Member Functions">Octonion Member Functions</a> 28</h2></div></div></div> 29<h4> 30<a name="math_toolkit.oct_mem_fun.h0"></a> 31 <span class="phrase"><a name="math_toolkit.oct_mem_fun.constructors"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.constructors">Constructors</a> 32 </h4> 33<p> 34 Template version: 35 </p> 36<pre class="programlisting"><span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_a</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(),</span> <span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_b</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(),</span> <span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_c</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(),</span> <span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_d</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(),</span> <span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_e</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(),</span> <span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_f</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(),</span> <span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_g</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">(),</span> <span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_h</span> <span class="special">=</span> <span class="identifier">T</span><span class="special">());</span> 37<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z2</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z3</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">>());</span> 38<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>());</span> 39<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">X</span><span class="special">></span> 40<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_recopier</span><span class="special">);</span> 41</pre> 42<p> 43 Float specialization version: 44 </p> 45<pre class="programlisting"><span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_a</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">,</span> <span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_b</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">,</span> <span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_c</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">,</span> <span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_d</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">,</span> <span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_e</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">,</span> <span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_f</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">,</span> <span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_g</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">,</span> <span class="keyword">float</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_h</span> <span class="special">=</span> <span class="number">0.0f</span><span class="special">);</span> 46<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z2</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z3</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">float</span><span class="special">>());</span> 47<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">float</span><span class="special">>());</span> 48<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_recopier</span><span class="special">);</span> 49<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_recopier</span><span class="special">);</span> 50</pre> 51<p> 52 Double specialization version: 53 </p> 54<pre class="programlisting"><span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_a</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_b</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_c</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_d</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_e</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_f</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_g</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">,</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_h</span> <span class="special">=</span> <span class="number">0.0</span><span class="special">);</span> 55<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z2</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z3</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">double</span><span class="special">>());</span> 56<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">double</span><span class="special">>());</span> 57<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_recopier</span><span class="special">);</span> 58<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_recopier</span><span class="special">);</span> 59</pre> 60<p> 61 Long double specialization version: 62 </p> 63<pre class="programlisting"><span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_a</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">,</span> <span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_b</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">,</span> <span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_c</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">,</span> <span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_d</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">,</span> <span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_e</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">,</span> <span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_f</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">,</span> <span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_g</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">,</span> <span class="keyword">long</span> <span class="keyword">double</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">requested_h</span> <span class="special">=</span> <span class="number">0.0L</span><span class="special">);</span> 64<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z2</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">>(),</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">z3</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">>());</span> 65<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q0</span><span class="special">,</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">q1</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="keyword">long</span> <span class="keyword">double</span><span class="special">>());</span> 66<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_recopier</span><span class="special">);</span> 67<span class="keyword">explicit</span> <span class="identifier">octonion</span><span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_recopier</span><span class="special">);</span> 68</pre> 69<p> 70 A default constructor is provided for each form, which initializes each component 71 to the default values for their type (i.e. zero for floating numbers). This 72 constructor can also accept one to eight base type arguments. A constructor 73 is also provided to build octonions from one to four complex numbers sharing 74 the same base type, and another taking one or two quaternions sharing the same 75 base type. The unspecialized template also sports a templarized copy constructor, 76 while the specialized forms have copy constructors from the other two specializations, 77 which are explicit when a risk of precision loss exists. For the unspecialized 78 form, the base type's constructors must not throw. 79 </p> 80<p> 81 Destructors and untemplated copy constructors (from the same type) are provided 82 by the compiler. Converting copy constructors make use of a templated helper 83 function in a "detail" subnamespace. 84 </p> 85<h4> 86<a name="math_toolkit.oct_mem_fun.h1"></a> 87 <span class="phrase"><a name="math_toolkit.oct_mem_fun.other_member_functions"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.other_member_functions">Other 88 member functions</a> 89 </h4> 90<h5> 91<a name="math_toolkit.oct_mem_fun.h2"></a> 92 <span class="phrase"><a name="math_toolkit.oct_mem_fun.real_and_unreal_parts"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.real_and_unreal_parts">Real 93 and Unreal Parts</a> 94 </h5> 95<pre class="programlisting"><span class="identifier">T</span> <span class="identifier">real</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 96<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">unreal</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 97</pre> 98<p> 99 Like complex number, octonions do have a meaningful notion of "real part", 100 but unlike them there is no meaningful notion of "imaginary part". 101 Instead there is an "unreal part" which itself is a octonion, and 102 usually nothing simpler (as opposed to the complex number case). These are 103 returned by the first two functions. 104 </p> 105<h5> 106<a name="math_toolkit.oct_mem_fun.h3"></a> 107 <span class="phrase"><a name="math_toolkit.oct_mem_fun.individual_real_components"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.individual_real_components">Individual 108 Real Components</a> 109 </h5> 110<pre class="programlisting"><span class="identifier">T</span> <span class="identifier">R_component_1</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 111<span class="identifier">T</span> <span class="identifier">R_component_2</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 112<span class="identifier">T</span> <span class="identifier">R_component_3</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 113<span class="identifier">T</span> <span class="identifier">R_component_4</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 114<span class="identifier">T</span> <span class="identifier">R_component_5</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 115<span class="identifier">T</span> <span class="identifier">R_component_6</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 116<span class="identifier">T</span> <span class="identifier">R_component_7</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 117<span class="identifier">T</span> <span class="identifier">R_component_8</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 118</pre> 119<p> 120 A octonion having eight real components, these are returned by these eight 121 functions. Hence real and R_component_1 return the same value. 122 </p> 123<h5> 124<a name="math_toolkit.oct_mem_fun.h4"></a> 125 <span class="phrase"><a name="math_toolkit.oct_mem_fun.individual_complex_components"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.individual_complex_components">Individual 126 Complex Components</a> 127 </h5> 128<pre class="programlisting"><span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">C_component_1</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 129<span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">C_component_2</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 130<span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">C_component_3</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 131<span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">C_component_4</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 132</pre> 133<p> 134 A octonion likewise has four complex components. Actually, octonions are indeed 135 a (left) vector field over the complexes, but beware, as for any octonion 136 <span class="emphasis"><em><code class="literal">o = α + βi + γj + δk + εe' + ζi' + ηj' + θk'</code></em></span> we also have <span class="emphasis"><em><code class="literal">o 137 = (α + βi) + (γ + δi)j + (ε + ζi)e' + (η - θi)j'</code></em></span> (note the <span class="bold"><strong>minus</strong></span> sign 138 in the last factor). What the C_component_n functions return, however, are 139 the complexes which could be used to build the octonion using the constructor, 140 and <span class="bold"><strong>not</strong></span> the components of the octonion on 141 the basis <span class="emphasis"><em><code class="literal">(1, j, e', j')</code></em></span>. 142 </p> 143<h5> 144<a name="math_toolkit.oct_mem_fun.h5"></a> 145 <span class="phrase"><a name="math_toolkit.oct_mem_fun.individual_quaternion_components"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.individual_quaternion_components">Individual 146 Quaternion Components</a> 147 </h5> 148<pre class="programlisting"><span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">H_component_1</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 149<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="identifier">H_component_2</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> 150</pre> 151<p> 152 Likewise, for any octonion <span class="emphasis"><em><code class="literal">o = α + βi + γj + δk + εe' + ζi' + ηj' + θk'</code></em></span> we 153 also have <span class="emphasis"><em><code class="literal">o = (α + βi + γj + δk) + (ε + ζi + ηj - θj)e'</code></em></span>, though there is no 154 meaningful vector-space-like structure based on the quaternions. What the H_component_n 155 functions return are the quaternions which could be used to build the octonion 156 using the constructor. 157 </p> 158<h4> 159<a name="math_toolkit.oct_mem_fun.h6"></a> 160 <span class="phrase"><a name="math_toolkit.oct_mem_fun.octonion_member_operators"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.octonion_member_operators">Octonion 161 Member Operators</a> 162 </h4> 163<h5> 164<a name="math_toolkit.oct_mem_fun.h7"></a> 165 <span class="phrase"><a name="math_toolkit.oct_mem_fun.assignment_operators"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.assignment_operators">Assignment 166 Operators</a> 167 </h5> 168<pre class="programlisting"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_affecter</span><span class="special">);</span> 169<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">X</span><span class="special">></span> 170<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_affecter</span><span class="special">);</span> 171<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_affecter</span><span class="special">);</span> 172<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_affecter</span><span class="special">);</span> 173<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">=</span> <span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">a_affecter</span><span class="special">);</span> 174</pre> 175<p> 176 These perform the expected assignment, with type modification if necessary 177 (for instance, assigning from a base type will set the real part to that value, 178 and all other components to zero). For the unspecialized form, the base type's 179 assignment operators must not throw. 180 </p> 181<h5> 182<a name="math_toolkit.oct_mem_fun.h8"></a> 183 <span class="phrase"><a name="math_toolkit.oct_mem_fun.other_member_operators"></a></span><a class="link" href="oct_mem_fun.html#math_toolkit.oct_mem_fun.other_member_operators">Other 184 Member Operators</a> 185 </h5> 186<pre class="programlisting"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">)</span> 187<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 188<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 189<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">X</span><span class="special">></span> 190<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">+=</span> <span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 191</pre> 192<p> 193 These perform the mathematical operation <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)+</span><span class="identifier">rhs</span></code> 194 and store the result in <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>. 195 The unspecialized form has exception guards, which the specialized forms do 196 not, so as to insure exception safety. For the unspecialized form, the base 197 type's assignment operators must not throw. 198 </p> 199<pre class="programlisting"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">)</span> 200<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 201<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 202<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">X</span><span class="special">></span> 203<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">-=</span> <span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 204</pre> 205<p> 206 These perform the mathematical operation <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)-</span><span class="identifier">rhs</span></code> 207 and store the result in <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>. 208 The unspecialized form has exception guards, which the specialized forms do 209 not, so as to insure exception safety. For the unspecialized form, the base 210 type's assignment operators must not throw. 211 </p> 212<pre class="programlisting"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">)</span> 213<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 214<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 215<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">X</span><span class="special">></span> 216<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">*=</span> <span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 217</pre> 218<p> 219 These perform the mathematical operation <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)*</span><span class="identifier">rhs</span></code> 220 in this order (order is important as multiplication is not commutative for 221 octonions) and store the result in <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>. The unspecialized form has exception guards, 222 which the specialized forms do not, so as to insure exception safety. For the 223 unspecialized form, the base type's assignment operators must not throw. Also, 224 for clarity's sake, you should always group the factors in a multiplication 225 by groups of two, as the multiplication is not even associative on the octonions 226 (though there are of course cases where this does not matter, it usually does). 227 </p> 228<pre class="programlisting"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">)</span> 229<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 230<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">quaternion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 231<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">X</span><span class="special">></span> 232<span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special">/=</span> <span class="special">(</span><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">X</span><span class="special">></span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">rhs</span><span class="special">);</span> 233</pre> 234<p> 235 These perform the mathematical operation <code class="computeroutput"><span class="special">(*</span><span class="keyword">this</span><span class="special">)*</span><span class="identifier">inverse_of</span><span class="special">(</span><span class="identifier">rhs</span><span class="special">)</span></code> 236 in this order (order is important as multiplication is not commutative for 237 octonions) and store the result in <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>. The unspecialized form has exception guards, 238 which the specialized forms do not, so as to insure exception safety. For the 239 unspecialized form, the base type's assignment operators must not throw. As 240 for the multiplication, remember to group any two factors using parenthesis. 241 </p> 242</div> 243<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 244<td align="left"></td> 245<td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar 246 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, 247 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan 248 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, 249 Daryle Walker and Xiaogang Zhang<p> 250 Distributed under the Boost Software License, Version 1.0. (See accompanying 251 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 252 </p> 253</div></td> 254</tr></table> 255<hr> 256<div class="spirit-nav"> 257<a accesskey="p" href="oct_typedefs.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../octonions.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="oct_non_mem.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 258</div> 259</body> 260</html> 261