1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Octonion Non-Member Operators</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_mem_fun.html" title="Octonion Member Functions"> 10<link rel="next" href="oct_value_ops.html" title="Octonion Value Operations"> 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_mem_fun.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_value_ops.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_non_mem"></a><a class="link" href="oct_non_mem.html" title="Octonion Non-Member Operators">Octonion Non-Member Operators</a> 28</h2></div></div></div> 29<h5> 30<a name="math_toolkit.oct_non_mem.h0"></a> 31 <span class="phrase"><a name="math_toolkit.oct_non_mem.unary_plus_and_minus_operators"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.unary_plus_and_minus_operators">Unary Plus 32 and Minus Operators</a> 33 </h5> 34<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">o</span><span class="special">);</span> 35</pre> 36<p> 37 This unary operator simply returns o. 38 </p> 39<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">o</span><span class="special">);</span> 40</pre> 41<p> 42 This unary operator returns the opposite of o. 43 </p> 44<h5> 45<a name="math_toolkit.oct_non_mem.h1"></a> 46 <span class="phrase"><a name="math_toolkit.oct_non_mem.binary_addition_operators"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.binary_addition_operators">Binary 47 Addition Operators</a> 48 </h5> 49<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 50<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 51<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 52<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 53<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 54<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 55<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 56</pre> 57<p> 58 These operators return <code class="computeroutput"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">+=</span> 59 <span class="identifier">rhs</span></code>. 60 </p> 61<h5> 62<a name="math_toolkit.oct_non_mem.h2"></a> 63 <span class="phrase"><a name="math_toolkit.oct_non_mem.binary_subtraction_operators"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.binary_subtraction_operators">Binary 64 Subtraction Operators</a> 65 </h5> 66<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 67<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 68<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 69<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 70<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 71<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 72<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 73</pre> 74<p> 75 These operators return <code class="computeroutput"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">-=</span> 76 <span class="identifier">rhs</span></code>. 77 </p> 78<h5> 79<a name="math_toolkit.oct_non_mem.h3"></a> 80 <span class="phrase"><a name="math_toolkit.oct_non_mem.binary_multiplication_operators"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.binary_multiplication_operators">Binary Multiplication 81 Operators</a> 82 </h5> 83<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 84<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 85<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 86<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 87<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 88<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 89<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 90</pre> 91<p> 92 These operators return <code class="computeroutput"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">*=</span> 93 <span class="identifier">rhs</span></code>. 94 </p> 95<h5> 96<a name="math_toolkit.oct_non_mem.h4"></a> 97 <span class="phrase"><a name="math_toolkit.oct_non_mem.binary_division_operators"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.binary_division_operators">Binary 98 Division Operators</a> 99 </h5> 100<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 101<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 102<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 103<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 104<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 105<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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> 106<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</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">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">lhs</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">rhs</span><span class="special">);</span> 107</pre> 108<p> 109 These operators return <code class="computeroutput"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">/=</span> 110 <span class="identifier">rhs</span></code>. It is of course still an error 111 to divide by zero... 112 </p> 113<h5> 114<a name="math_toolkit.oct_non_mem.h5"></a> 115 <span class="phrase"><a name="math_toolkit.oct_non_mem.binary_equality_operators"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.binary_equality_operators">Binary 116 Equality Operators</a> 117 </h5> 118<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 119<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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> 120<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 121<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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> 122<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 123<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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> 124<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 125</pre> 126<p> 127 These return true if and only if the four components of <code class="computeroutput"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">lhs</span><span class="special">)</span></code> are 128 equal to their counterparts in <code class="computeroutput"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">rhs</span><span class="special">)</span></code>. As 129 with any floating-type entity, this is essentially meaningless. 130 </p> 131<h5> 132<a name="math_toolkit.oct_non_mem.h6"></a> 133 <span class="phrase"><a name="math_toolkit.oct_non_mem.binary_inequality_operators"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.binary_inequality_operators">Binary 134 Inequality Operators</a> 135 </h5> 136<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 137<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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> 138<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 139<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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> 140<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 141<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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> 142<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</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">lhs</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">rhs</span><span class="special">);</span> 143</pre> 144<p> 145 These return true if and only if <code class="computeroutput"><span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">lhs</span><span class="special">)</span> <span class="special">==</span> 146 <span class="identifier">octonion</span><span class="special"><</span><span class="identifier">T</span><span class="special">>(</span><span class="identifier">rhs</span><span class="special">)</span></code> is false. As with any floating-type entity, 147 this is essentially meaningless. 148 </p> 149<h5> 150<a name="math_toolkit.oct_non_mem.h7"></a> 151 <span class="phrase"><a name="math_toolkit.oct_non_mem.stream_extractor"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.stream_extractor">Stream 152 Extractor</a> 153 </h5> 154<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span> 155<span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_istream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</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">basic_istream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">></span> <span class="special">&</span> <span class="identifier">is</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="special">&</span> <span class="identifier">o</span><span class="special">);</span> 156</pre> 157<p> 158 Extracts an octonion <code class="computeroutput"><span class="identifier">o</span></code>. We 159 accept any format which seems reasonable. However, since this leads to a great 160 many ambiguities, decisions were made to lift these. In case of doubt, stick 161 to lists of reals. 162 </p> 163<p> 164 The input values must be convertible to T. If bad input is encountered, calls 165 <code class="computeroutput"><span class="identifier">is</span><span class="special">.</span><span class="identifier">setstate</span><span class="special">(</span><span class="identifier">ios</span><span class="special">::</span><span class="identifier">failbit</span><span class="special">)</span></code> (which may throw <code class="computeroutput"><span class="identifier">ios</span><span class="special">::</span><span class="identifier">failure</span></code> 166 (27.4.5.3)). 167 </p> 168<p> 169 Returns <code class="computeroutput"><span class="identifier">is</span></code>. 170 </p> 171<h5> 172<a name="math_toolkit.oct_non_mem.h8"></a> 173 <span class="phrase"><a name="math_toolkit.oct_non_mem.stream_inserter"></a></span><a class="link" href="oct_non_mem.html#math_toolkit.oct_non_mem.stream_inserter">Stream 174 Inserter</a> 175 </h5> 176<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span> 177<span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</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">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">></span> <span class="special">&</span> <span class="identifier">os</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">o</span><span class="special">);</span> 178</pre> 179<p> 180 Inserts the octonion <code class="computeroutput"><span class="identifier">o</span></code> onto 181 the stream <code class="computeroutput"><span class="identifier">os</span></code> as if it were 182 implemented as follows: 183 </p> 184<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">charT</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">traits</span><span class="special">></span> 185<span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">></span> <span class="special">&</span> <span class="keyword">operator</span> <span class="special"><<</span> <span class="special">(</span> <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">></span> <span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> 186<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">o</span><span class="special">)</span> 187<span class="special">{</span> 188 <span class="special">::</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_ostringstream</span><span class="special"><</span><span class="identifier">charT</span><span class="special">,</span><span class="identifier">traits</span><span class="special">></span> <span class="identifier">s</span><span class="special">;</span> 189 190 <span class="identifier">s</span><span class="special">.</span><span class="identifier">flags</span><span class="special">(</span><span class="identifier">os</span><span class="special">.</span><span class="identifier">flags</span><span class="special">());</span> 191 <span class="identifier">s</span><span class="special">.</span><span class="identifier">imbue</span><span class="special">(</span><span class="identifier">os</span><span class="special">.</span><span class="identifier">getloc</span><span class="special">());</span> 192 <span class="identifier">s</span><span class="special">.</span><span class="identifier">precision</span><span class="special">(</span><span class="identifier">os</span><span class="special">.</span><span class="identifier">precision</span><span class="special">());</span> 193 194 <span class="identifier">s</span> <span class="special"><<</span> <span class="char">'('</span> <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_1</span><span class="special">()</span> <span class="special"><<</span> <span class="char">','</span> 195 <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_2</span><span class="special">()</span> <span class="special"><<</span> <span class="char">','</span> 196 <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_3</span><span class="special">()</span> <span class="special"><<</span> <span class="char">','</span> 197 <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_4</span><span class="special">()</span> <span class="special"><<</span> <span class="char">','</span> 198 <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_5</span><span class="special">()</span> <span class="special"><<</span> <span class="char">','</span> 199 <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_6</span><span class="special">()</span> <span class="special"><<</span> <span class="char">','</span> 200 <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_7</span><span class="special">()</span> <span class="special"><<</span> <span class="char">','</span> 201 <span class="special"><<</span> <span class="identifier">o</span><span class="special">.</span><span class="identifier">R_component_8</span><span class="special">()</span> <span class="special"><<</span> <span class="char">')'</span><span class="special">;</span> 202 203 <span class="keyword">return</span> <span class="identifier">os</span> <span class="special"><<</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">str</span><span class="special">();</span> 204<span class="special">}</span> 205</pre> 206</div> 207<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 208<td align="left"></td> 209<td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar 210 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, 211 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan 212 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, 213 Daryle Walker and Xiaogang Zhang<p> 214 Distributed under the Boost Software License, Version 1.0. (See accompanying 215 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>) 216 </p> 217</div></td> 218</tr></table> 219<hr> 220<div class="spirit-nav"> 221<a accesskey="p" href="oct_mem_fun.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_value_ops.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 222</div> 223</body> 224</html> 225