mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Removed old docs: the quickbook version now takes over.
[SVN r33559]
This commit is contained in:
@@ -1,263 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost GCD & LCM Library</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white" text="black" link="blue" alink="red" vlink="purple">
|
||||
<h1>
|
||||
<img src="../../../boost.png" alt="boost.png (6897 bytes)"
|
||||
align="left" width="277" height="86">Greatest Common Divisor<br>
|
||||
Least
|
||||
Common Multiple<br>
|
||||
</h1>
|
||||
|
||||
<p>The class and function templates in <cite><a
|
||||
href="../../../boost/math/common_factor.hpp"><boost/math/common_factor.hpp></a>
|
||||
</cite> provide run-time and compile-time evaluation of the greatest
|
||||
common divisor (GCD) or least common multiple (LCM) of two integers.
|
||||
These facilities are useful for many numeric-oriented generic
|
||||
programming problems.</p>
|
||||
|
||||
<h2><a name="contents">Contents</a></h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="#contents">Contents</a></li>
|
||||
<li>Header <cite><a href="#cf_hpp"><boost/math/common_factor.hpp></a></cite>
|
||||
<ul>
|
||||
<li><a href="#synopsis">Synopsis</a></li>
|
||||
</ul></li>
|
||||
<li>Header <cite><a href="#cfrt_hpp"><boost/math/common_factor_rt.hpp></a></cite>
|
||||
<ul>
|
||||
<li><a href="#gcd_obj">GCD Function Object</a></li>
|
||||
<li><a href="#lcm_obj">LCM Function Object</a></li>
|
||||
<li><a href="#run_gcd_lcm">Run-time GCD & LCM Determination</a></li>
|
||||
</ul></li>
|
||||
<li>Header <cite><a href="#cfct_hpp"><boost/math/common_factor_ct.hpp></a></cite></li>
|
||||
<li><a href="#example">Example</a></li>
|
||||
<li><a href="#demo">Demonstration Program</a></li>
|
||||
<li><a href="#rationale">Rationale</a></li>
|
||||
<li><a href="#history">History</a></li>
|
||||
<li><a href="#credits">Credits</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Header <cite><a name="cf_hpp" href="../../../boost/math/common_factor.hpp"><boost/math/common_factor.hpp></a></cite></h2>
|
||||
|
||||
<p>This header simply includes the headers <cite><a
|
||||
href="../../../boost/math/common_factor_ct.hpp"><boost/math/common_factor_ct.hpp></a></cite>
|
||||
and <cite><a
|
||||
href="../../../boost/math/common_factor_rt.hpp"><boost/math/common_factor_rt.hpp></a></cite>.
|
||||
It used to contain the code, but the compile-time and run-time
|
||||
facilities were moved to separate headers (since they were independent),
|
||||
and this header maintains compatibility.</p>
|
||||
|
||||
<h3><a name="synopsis">Synopsis</a></h3>
|
||||
|
||||
<blockquote><pre>namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
|
||||
template < typename IntegerType >
|
||||
class gcd_evaluator;
|
||||
template < typename IntegerType >
|
||||
class lcm_evaluator;
|
||||
|
||||
template < typename IntegerType >
|
||||
IntegerType gcd( IntegerType const &a, IntegerType const &b );
|
||||
template < typename IntegerType >
|
||||
IntegerType lcm( IntegerType const &a, IntegerType const &b );
|
||||
|
||||
template < unsigned long Value1, unsigned long Value2 >
|
||||
struct static_gcd;
|
||||
template < unsigned long Value1, unsigned long Value2 >
|
||||
struct static_lcm;
|
||||
|
||||
}
|
||||
}
|
||||
</pre></blockquote>
|
||||
|
||||
<h2>Header <cite><a name="cfrt_hpp" href="../../../boost/math/common_factor_rt.hpp"><boost/math/common_factor_rt.hpp></a></cite></h2>
|
||||
|
||||
<h3><a name="gcd_obj">GCD Function Object</a></h3>
|
||||
|
||||
<blockquote><pre>template < typename IntegerType >
|
||||
class boost::math::gcd_evaluator
|
||||
{
|
||||
public:
|
||||
// Types
|
||||
typedef IntegerType result_type;
|
||||
typedef IntegerType first_argument_type;
|
||||
typedef IntegerType second_argument_type;
|
||||
|
||||
// Function object interface
|
||||
result_type operator ()( first_argument_type const &a,
|
||||
second_argument_type const &b ) const;
|
||||
};
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The <code>boost::math::gcd_evaluator</code> class template defines a
|
||||
function object class to return the greatest common divisor of two
|
||||
integers. The template is parameterized by a single type, called
|
||||
<code>IntegerType</code> here. This type should be a numeric type that
|
||||
represents integers. The result of the function object is always
|
||||
nonnegative, even if either of the operator arguments is negative.</p>
|
||||
|
||||
<p>This function object class template is used in the corresponding
|
||||
version of the <a href="#run_gcd_lcm">GCD function template</a>. If a
|
||||
numeric type wants to customize evaluations of its greatest common
|
||||
divisors, then the type should specialize on the
|
||||
<code>gcd_evaluator</code> class template.</p>
|
||||
|
||||
<h3><a name="lcm_obj">LCM Function Object</a></h3>
|
||||
|
||||
<blockquote><pre>template < typename IntegerType >
|
||||
class boost::math::lcm_evaluator
|
||||
{
|
||||
public:
|
||||
// Types
|
||||
typedef IntegerType result_type;
|
||||
typedef IntegerType first_argument_type;
|
||||
typedef IntegerType second_argument_type;
|
||||
|
||||
// Function object interface
|
||||
result_type operator ()( first_argument_type const &a,
|
||||
second_argument_type const &b ) const;
|
||||
};
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The <code>boost::math::lcm_evaluator</code> class template defines a
|
||||
function object class to return the least common multiple of two
|
||||
integers. The template is parameterized by a single type, called
|
||||
<code>IntegerType</code> here. This type should be a numeric type that
|
||||
represents integers. The result of the function object is always
|
||||
nonnegative, even if either of the operator arguments is negative. If
|
||||
the least common multiple is beyond the range of the integer type, the
|
||||
results are undefined.</p>
|
||||
|
||||
<p>This function object class template is used in the corresponding
|
||||
version of the <a href="#run_gcd_lcm">LCM function template</a>. If a
|
||||
numeric type wants to customize evaluations of its least common
|
||||
multiples, then the type should specialize on the
|
||||
<code>lcm_evaluator</code> class template.</p>
|
||||
|
||||
<h3><a name="run_gcd_lcm">Run-time GCD & LCM Determination</a></h3>
|
||||
|
||||
<blockquote><pre>template < typename IntegerType >
|
||||
IntegerType boost::math::gcd( IntegerType const &a, IntegerType const &b );
|
||||
|
||||
template < typename IntegerType >
|
||||
IntegerType boost::math::lcm( IntegerType const &a, IntegerType const &b );
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The <code>boost::math::gcd</code> function template returns the
|
||||
greatest common (nonnegative) divisor of the two integers passed to it.
|
||||
The <code>boost::math::lcm</code> function template returns the least
|
||||
common (nonnegative) multiple of the two integers passed to it. The
|
||||
function templates are parameterized on the function arguments'
|
||||
<var>IntegerType</var>, which is also the return type. Internally,
|
||||
these function templates use an object of the corresponding version of
|
||||
the <code><a href="#gcd_obj">gcd_evaluator</a></code> and <code><a
|
||||
href="#lcm_obj">lcm_evaluator</a></code> class templates,
|
||||
respectively.</p>
|
||||
|
||||
<h2>Header <cite><a name="cfct_hpp" href="../../../boost/math/common_factor_ct.hpp"><boost/math/common_factor_ct.hpp></a></cite></h2>
|
||||
|
||||
<blockquote><pre>template < unsigned long Value1, unsigned long Value2 >
|
||||
struct boost::math::static_gcd
|
||||
{
|
||||
static unsigned long const value = <em>implementation_defined</em>;
|
||||
};
|
||||
|
||||
template < unsigned long Value1, unsigned long Value2 >
|
||||
struct boost::math::static_lcm
|
||||
{
|
||||
static unsigned long const value = <em>implementation_defined</em>;
|
||||
};
|
||||
</pre></blockquote>
|
||||
|
||||
<p>The <code>boost::math::static_gcd</code> and
|
||||
<code>boost::math::static_lcm</code> class templates take two
|
||||
value-based template parameters of the <code>unsigned long</code> type
|
||||
and have a single static constant data member, <code>value</code>, of
|
||||
that same type. The value of that member is the greatest common factor
|
||||
or least common multiple, respectively, of the template arguments. A
|
||||
compile-time error will occur if the least common multiple is beyond the
|
||||
range of an <code>unsigned long</code>.</p>
|
||||
|
||||
<h2><a name="example">Example</a></h2>
|
||||
|
||||
<blockquote><pre>#include <boost/math/common_factor.hpp>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
cout << "The GCD and LCM of 6 and 15 are "
|
||||
<< boost::math::gcd(6, 15) << " and "
|
||||
<< boost::math::lcm(6, 15) << ", respectively."
|
||||
<< endl;
|
||||
|
||||
cout << "The GCD and LCM of 8 and 9 are "
|
||||
<< boost::math::static_gcd<8, 9>::value
|
||||
<< " and "
|
||||
<< boost::math::static_lcm<8, 9>::value
|
||||
<< ", respectively." << endl;
|
||||
|
||||
int a[] = { 4, 5, 6 }, b[] = { 7, 8, 9 }, c[3];
|
||||
std::transform( a, a + 3, b, c, boost::math::gcd_evaluator<int>() );
|
||||
std::copy( c, c + 3, std::ostream_iterator<int>(cout, " ") );
|
||||
}
|
||||
</pre></blockquote>
|
||||
|
||||
<h2><a name="demo">Demonstration Program</a></h2>
|
||||
|
||||
<p>The program <a
|
||||
href="../test/common_factor_test.cpp">common_factor_test.cpp</a> is a
|
||||
demonstration of the results from instantiating various examples of the
|
||||
run-time GCD and LCM function templates and the compile-time GCD and
|
||||
LCM class templates. (The run-time GCD and LCM class templates are
|
||||
tested indirectly through the run-time function templates.)</p>
|
||||
|
||||
<h2><a name="rationale">Rationale</a></h2>
|
||||
|
||||
<p>The greatest common divisor and least common multiple functions are
|
||||
greatly used in some numeric contexts, including some of the other Boost
|
||||
libraries. Centralizing these functions to one header improves code
|
||||
factoring and eases maintainence.</p>
|
||||
|
||||
<h2><a name="history">History</a></h2>
|
||||
|
||||
<dl>
|
||||
<dt>2 Jul 2002
|
||||
<dd>Compile-time and run-time items separated to new headers.
|
||||
|
||||
<dt>7 Nov 2001
|
||||
<dd>Initial version
|
||||
</dl>
|
||||
|
||||
<h2><a name="credits">Credits</a></h2>
|
||||
|
||||
<p>The author of the Boost compilation of GCD and LCM computations is <a
|
||||
href="../../../people/daryle_walker.html">Daryle Walker</a>. The code was
|
||||
prompted by existing code hiding in the implementations of <a
|
||||
href="../../../people/paul_moore.htm">Paul Moore</a>'s <a
|
||||
href="../../rational/index.html">rational</a> library and Steve Cleary's <a
|
||||
href="../../pool/doc/index.html">pool</a> library. The code had updates by
|
||||
Helmut Zeisel.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>Revised July 2, 2002</p>
|
||||
|
||||
<p>© Copyright Daryle Walker 2001-2002. Permission to copy, use,
|
||||
modify, sell and distribute this document is granted provided this
|
||||
copyright notice appears in all copies. This document is provided
|
||||
"as is" without express or implied warranty, and with no claim
|
||||
as to its suitability for any purpose.</p>
|
||||
</body>
|
||||
</html>
|
||||
101
doc/index.html
101
doc/index.html
@@ -1,101 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost Math Library</title>
|
||||
</head>
|
||||
<body bgcolor="white" text="black">
|
||||
<table border="1" bgcolor="teal" cellpadding="2">
|
||||
<tr>
|
||||
<td bgcolor="white">
|
||||
<img src="../../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"></td>
|
||||
<td><a href="../../../index.htm"><font face="Arial" color="white"><big>Home</big></font></a></td>
|
||||
<td><a href="../../libraries.htm"><font face="Arial" color="white"><big>Libraries</big></font></a></td>
|
||||
<td><a href="../../../people/people.htm"><font face="Arial" color="white"><big>People</big></font></a></td>
|
||||
<td><a href="../../../more/faq.htm"><font face="Arial" color="white"><big>FAQ</big></font></a></td>
|
||||
<td><a href="../../../more/index.htm"><font face="Arial" color="white"><big>More</big></font></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h1>Boost Math Library</h1>
|
||||
<table border="1" cellpadding="5">
|
||||
<tr>
|
||||
<th>
|
||||
Header / Docs</th>
|
||||
<th>
|
||||
Contents</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<code><a href="../../../boost/math_fwd.hpp"><boost/math_fwd.hpp></a></code>
|
||||
</td>
|
||||
<td valign="top">Forward declaration header.
|
||||
</td>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<code><a href="../../../boost/math/octonion.hpp"><boost/math/octonion.hpp></a></code><br>
|
||||
<br>
|
||||
<a href="../octonion/index.html">documentation</a>
|
||||
</td>
|
||||
<td valign="top">Octonion class templates and octonion algebra function templates.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<code><a href="../../../boost/math/quaternion.hpp"><boost/math/quaternion.hpp></a></code><br>
|
||||
<br>
|
||||
<a href="../quaternion/index.html">documentation</a>
|
||||
</td>
|
||||
<td valign="top">Quaternion class templates and quaternion algebra function
|
||||
templates.
|
||||
</td>
|
||||
</tr>
|
||||
<TR>
|
||||
<TD align="center">
|
||||
<P><A href="../../../boost/math/complex.hpp"><boost/math/complex.html></A></P>
|
||||
<P><A href="../../../doc/html/boost_math_tr1_additions/inverse_complex.html">Documentation</A></P>
|
||||
</TD>
|
||||
<TD vAlign="top">The inverse complex number trig functions required by the C99
|
||||
standard, and the C++ technical Report on Standard Library Extensions.</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD align="center">
|
||||
<P><A href="../../../boost/math/special_functions/log1p.hpp"><boost/math/special_functions/log1p.hpp></A><BR>
|
||||
<A href="../../../boost/math/special_functions/expm1.hpp"><boost/math/special_functions/expm1.hpp></A><BR>
|
||||
<A href="../../../boost/math/special_functions/hypot.hpp"><boost/math/special_functions/hypot.hpp></A></P>
|
||||
<P><A href="../../../doc/html/boost_math_tr1_additions/C99.html">Documentation</A></P>
|
||||
</TD>
|
||||
<TD vAlign="top">Selected special math functions from the C99 standard.</TD>
|
||||
</TR>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<code><a href="../../../boost/math/special_functions/acosh.hpp"><boost/math/special_functions/acosh.hpp></a></code><br>
|
||||
<code><a href="../../../boost/math/special_functions/asinh.hpp"><boost/math/special_functions/asinh.hpp></a></code><br>
|
||||
<code><a href="../../../boost/math/special_functions/atanh.hpp"><boost/math/special_functions/atanh.hpp></a></code><br>
|
||||
<code><a href="../../../boost/math/special_functions/sinc.hpp"><boost/math/special_functions/sinc.hpp></a></code><br>
|
||||
<code><a href="../../../boost/math/special_functions/sinhc.hpp"><boost/math/special_functions/sinhc.hpp></a></code><br>
|
||||
<br>
|
||||
<a href="../special_functions/index.html">documentation</a>
|
||||
</td>
|
||||
<td valign="top">"Special" mathematical function templates.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<code><a href="../../../boost/math/common_factor.hpp"><boost/math/common_factor.hpp></a></code><br>
|
||||
<code><a href="../../../boost/math/common_factor_ct.hpp"><boost/math/common_factor_ct.hpp></a></code><br>
|
||||
<code><a href="../../../boost/math/common_factor_rt.hpp"><boost/math/common_factor_rt.hpp></a></code><br>
|
||||
<br>
|
||||
<a href="common_factor.html">documentation</a>
|
||||
</td>
|
||||
<td valign="top">Compile-time and run-time class and function templates for
|
||||
greatest common divisor and least common multiple.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>Rationale</h2>
|
||||
<p>The math sub-library of Boost helps segregate the large number of Boost
|
||||
headers. This sub-library should contain various math-related items.</p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
|
||||
2 July, 2002<!--webbot bot="Timestamp" i-checksum="39352" endspan --></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,58 +0,0 @@
|
||||
<html>
|
||||
|
||||
|
||||
|
||||
<head>
|
||||
|
||||
<title>Boost class octonion</title>
|
||||
<meta http-equiv="generator" content="Adobe GoLive 5">
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
|
||||
|
||||
|
||||
<table border="1" bgcolor="#007F7F" cellpadding="2">
|
||||
|
||||
<tr>
|
||||
|
||||
<td bgcolor="#FFFFFF"><img src="../../../boost.png" alt="boost.png (6897 bytes)" WIDTH="277" HEIGHT="86"></td>
|
||||
|
||||
<td><a href="../../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home </big></font></a></td>
|
||||
|
||||
<td><a href="../../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries </big></font></a></td>
|
||||
|
||||
<td><a href="../../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People </big></font></a></td>
|
||||
|
||||
<td><a href="../../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ </big></font></a></td>
|
||||
|
||||
<td><a href="../../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More </big></font></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h2>The octonion Class</h2>
|
||||
<p>Class quaternion provides an implementation of the mathematical object of the same name. See the documentation for details.
|
||||
<ul>
|
||||
|
||||
<li><a href="octonion.html">Documentation</a></li>
|
||||
|
||||
<li>Header <a href="../../../boost/math/octonion.hpp">octonion.hpp</a></li>
|
||||
<li>Test program <a href="octonion_test.cpp">octonion_test.cpp</a></li>
|
||||
<li>Submitted by Hubert Holin.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %b %Y" startspan -->18 Sep 2002<!--webbot bot="Timestamp" endspan i-checksum="14992" -->
|
||||
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,731 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Class octonion Documentation</title>
|
||||
|
||||
<meta http-equiv="generator" content="Adobe GoLive 5">
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
<h1><img src="../../../boost.png" alt="c++boost.gif (8819 bytes)" align="center" width="277" height="86">Class octonion</h1>
|
||||
<ul>
|
||||
<li><a href="#Acknowledgements">Acknowledgements</a>
|
||||
<li><a href="#Header File">Header File</a>
|
||||
<li><a href="#Test Program">Test Program</a>
|
||||
<li><a href="#Synopsis">Synopsis</a>
|
||||
<li><a href="#Template class octonion">Template class <code>octonion</code></a>
|
||||
<li><a href="#octonion specializations"><code>octonion</code> specializations</a>
|
||||
<li><a href="#octonion member functions"><code>octonion</code> member functions</a>
|
||||
<li><a href="#octonion member operators"><code>octonion</code> member operators</a>
|
||||
<li><a href="#octonion non-member operations"><code>octonion</code> non-member operations</a>
|
||||
<li><a href="#octonion value operations"><code>octonion</code> value operations</a>
|
||||
<li><a href="#octonion transcendentals"><code>octonion</code> transcendentals</a>
|
||||
<li><a href="#History">History</a>
|
||||
<li><a href="#ToDo">To Do</a>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>Octonions, like <a href="../quaternion/quaternion.html">quaternions</a>, are a relative of complex numbers.</p>
|
||||
<p>Octonions see some use in theoretical physics.</p>
|
||||
<p>In practical terms, an octonion is simply an octuple of real numbers <img src="graphics/octonion_blurb1.jpeg" width="93" height="17" naturalsizeflag="3" align=absmiddle><font color="#000000">, which we can write in the form <img src="graphics/octonion_blurb2.jpeg" width="215" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, where <img src="graphics/octonion_blurb3.jpeg" width="6" height="11" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, <img src="graphics/octonion_blurb4.jpeg" width="8" height="13" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> and <img src="graphics/octonion_blurb5.jpeg" width="9" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> are the same objects as for quaternions, and <img src="graphics/octonion_blurb6.jpeg" width="11" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, <img src="graphics/octonion_blurb7.jpeg" width="10" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> , <img src="graphics/octonion_blurb8.jpeg" width="12" height="14" naturalsizeflag="3" align=absmiddle> and <img src="graphics/octonion_blurb9.jpeg" width="12" height="12" naturalsizeflag="3" align=absmiddle> are distinct objects which play essentially the same kind of role as <img src="graphics/octonion_blurb10.jpeg" width="6" height="11" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> (or <img src="graphics/octonion_blurb11.jpeg" width="8" height="13" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> or <img src="graphics/octonion_blurb12.jpeg" width="9" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000">).</font></p>
|
||||
<p><font color="#000000">An addition and a multiplication is defined on the set of octonions, which generalize their quaternionic counterparts. The main novelty this time is that <strong>the multiplication is not only not commutative, is now not even associative</strong> (<cite>i.e.</cite> there are quaternions <img src="graphics/octonion_blurb13.jpeg" width="9" height="9" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, <img src="graphics/octonion_blurb14.jpeg" width="9" height="11" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> and <img src="graphics/octonion_blurb15.jpeg" width="8" height="8" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> such that <img src="graphics/octonion_blurb16.jpeg" width="72" height="16" naturalsizeflag="3" align=absmiddle></font><font color="#000000">). A way of remembering things is by using the following multiplication table:</font></p>
|
||||
<div align="center">
|
||||
<p><img src="graphics/octonion_blurb17.jpeg" width="243" height="158" naturalsizeflag="3" align=BOTTOM></p>
|
||||
</div>
|
||||
<p><font color="#000000">Octonions (and their kin) are described in far more details in this other <a href="../quaternion/TQE.pdf">document</a> (with <a href="../quaternion/TQE_EA.pdf">errata and addenda</a>).</font></p>
|
||||
<p><font color="#000000">Some traditional constructs, such as the exponential, carry over without too much change into the realms of octonions, but other, such as taking a square root, do not (the fact that the exponential has a closed form is a result of the author, but the fact that the exponential exists at all for octonions is known since quite a long time ago).</font></p>
|
||||
<h2><a name="Acknowledgements"></a>Acknowledgements</h2>
|
||||
<p>The mathematical text has been typeset with <a href="http://www.nisus-soft.com/">Nisus Writer</a>. Jens Maurer has helped with portability and standard adherence, and was the Review Manager for this library. More acknowledgements in the History section. Thank you to all who contributed to the discution about this library.</p>
|
||||
<h2><a name="Header File"></a>Header File</h2>
|
||||
<p>The interface and implementation are both supplied by the header file <a href="../../../boost/math/octonion.hpp">octonion.h</a>.</p>
|
||||
<h2><a name="Test Program"></a>Test Program</h2>
|
||||
<p>The <a href="octonion_test.cpp">octonion_test.cpp</a> test program tests octonions specialisations for float, double and long double (<a href="output.txt">sample output</a>).</p>
|
||||
<p>If you define the symbol BOOST_OCTONION_TEST_VERBOSE, you will get additional output (<a href="output_more.txt">verbose output</a>); this will only be helpfull if you enable message output at the same time, of course (by uncommenting the relevant line in the test or by adding --log_level=messages to your command line,...). In that case, and if you are running interactively, you may in addition define the symbol BOOST_INTERACTIVE_TEST_INPUT_ITERATOR to interactively test the input operator with input of your choice from the standard input (instead of hard-coding it in the test).</p>
|
||||
<h2><a name="Synopsis"></a>Synopsis</h2>
|
||||
<pre><code>namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
|
||||
template<typename T> class <a href="#octonion">octonion</a>;
|
||||
template<> class <a href="#octonion<float>">octonion<float></a>;
|
||||
template<> class <a href="#octonion<double>">octonion<double></a>;
|
||||
template<> class <a href="#octonion<long double>">octonion<long double></a>;
|
||||
|
||||
// operators
|
||||
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (octonion<T> const & lhs, octonion<T> const & rhs);
|
||||
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (octonion<T> const & lhs, octonion<T> const & rhs);
|
||||
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator *</a> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator *</a> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator *</a> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator *</a> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator *</a> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator *</a> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator *</a> (octonion<T> const & lhs, octonion<T> const & rhs);
|
||||
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator /</a> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator /</a> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator /</a> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator /</a> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator /</a> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator /</a> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator /</a> (octonion<T> const & lhs, octonion<T> const & rhs);
|
||||
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator +</a> (octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#octonion non-member operations">operator -</a> (octonion<T> const & o);
|
||||
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator ==</a> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator ==</a> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator ==</a> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator ==</a> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator ==</a> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator ==</a> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator ==</a> (octonion<T> const & lhs, octonion<T> const & rhs);
|
||||
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator !=</a> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator !=</a> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator !=</a> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator !=</a> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator !=</a> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator !=</a> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#octonion non-member operations">operator !=</a> (octonion<T> const & lhs, octonion<T> const & rhs);
|
||||
|
||||
template<typename T, typename charT, class traits>
|
||||
::std::basic_istream<charT,traits> & <a href="#octonion non-member operations">operator >></a> (::std::basic_istream<charT,traits> & is, octonion<T> & o);
|
||||
|
||||
template<typename T, typename charT, class traits>
|
||||
::std::basic_ostream<charT,traits> & <a href="#octonion non-member operations">operator <<</a> (::std::basic_ostream<charT,traits> & os, octonion<T> const & o);
|
||||
|
||||
// values
|
||||
|
||||
template<typename T> inline T <a href="#octonion value operations">real</a>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#octonion value operations">unreal</a>(octonion<T> const & o);
|
||||
|
||||
template<typename T> inline T <a href="#octonion value operations">sup</a>(octonion<T> const & o);
|
||||
template<typename T> inline T <a href="#octonion value operations">l1</a>(octonion<T>const & o);
|
||||
template<typename T> inline T <a href="#octonion value operations">abs</a>(octonion<T> const & o);
|
||||
template<typename T> inline T <a href="#octonion value operations">norm</a>(octonion<T>const & o);
|
||||
template<typename T> inline octonion<T> <a href="#octonion value operations">conj</a>(octonion<T> const & o);
|
||||
|
||||
template<typename T> inline octonion<T> <a href="#octonion value operations">spherical</a>(T const & rho, T const & theta, T const & phi1, T const & phi2, T const & phi3, T const & phi4, T const & phi5, T const & phi6);
|
||||
template<typename T> inline octonion<T> <a href="#octonion value operations">multipolar</a>(T const & rho1, T const & theta1, T const & rho2, T const & theta2, T const & rho3, T const & theta3, T const & rho4, T const & theta4);
|
||||
template<typename T> inline octonion<T> <a href="#octonion value operations">cylindrical</a>(T const & r, T const & angle, T const & h1, T const & h2, T const & h3, T const & h4, T const & h5, T const & h6);
|
||||
|
||||
// transcendentals
|
||||
|
||||
template<typename T> inline octonion<T> <a href="#exp">exp</a>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#cos">cos</a>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#sin">sin</a>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#tan">tan</a>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#cosh">cosh</a>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#sinh">sinh</a>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <a href="#tanh">tanh</a>(octonion<T> const & o);
|
||||
|
||||
template<typename T> octonion<T> <a href="#pow">pow</a>(octonion<T> const & o, int n);
|
||||
|
||||
}
|
||||
}</code></pre>
|
||||
<h2><a name="Template class octonion"></a>Template class <code>octonion</code></h2>
|
||||
<pre><code>namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
|
||||
<a name="octonion"></a> template<typename T>
|
||||
class octonion
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">octonion</a>(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T(), T const & requested_e = T(), T const & requested_f = T(), T const & requested_g = T(), T const & requested_h = T());
|
||||
explicit <a href="#Constructors">octonion</a>(::std::complex<T> const & z0, ::std::complex<T> const & z1 = ::std::complex<T>(), ::std::complex<T> const & z2 = ::std::complex<T>(), ::std::complex<T> const & z3 = ::std::complex<T>());
|
||||
explicit <a href="#Constructors">octonion</a>(::boost::math::quaternion<T> const & q0, ::boost::math::quaternion<T> const & q1 = ::boost::math::quaternion<T>());
|
||||
template<typename X> explicit <a href="#Constructors">octonion</a>(octonion<X> const & a_recopier);
|
||||
|
||||
T <a href="#Other member functions">real</a>() const;
|
||||
octonion<T> <a href="#Other member functions">unreal</a>() const;
|
||||
|
||||
T <a href="#Other member functions">R_component_1</a>() const;
|
||||
T <a href="#Other member functions">R_component_2</a>() const;
|
||||
T <a href="#Other member functions">R_component_3</a>() const;
|
||||
T <a href="#Other member functions">R_component_4</a>() const;
|
||||
T <a href="#Other member functions">R_component_5</a>() const;
|
||||
T <a href="#Other member functions">R_component_6</a>() const;
|
||||
T <a href="#Other member functions">R_component_7</a>() const;
|
||||
T <a href="#Other member functions">R_component_8</a>() const;
|
||||
|
||||
::std::complex<T> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<T> <a href="#Other member functions">C_component_2</a>() const;
|
||||
::std::complex<T> <a href="#Other member functions">C_component_3</a>() const;
|
||||
::std::complex<T> <a href="#Other member functions">C_component_4</a>() const;
|
||||
|
||||
::boost::math::quaternion<T> <a href="#Other member functions">H_component_1</a>() const;
|
||||
::boost::math::quaternion<T> <a href="#Other member functions">H_component_2</a>() const;
|
||||
|
||||
octonion<T> & <a href="#Assignment operators">operator =</a> (octonion<T> const & a_affecter);
|
||||
template<typename X> octonion<T> & <a href="#Assignment operators">operator =</a> (octonion<X> const & a_affecter);
|
||||
octonion<T> & <a href="#Assignment operators">operator =</a> (T const & a_affecter);
|
||||
octonion<T> & <a href="#Assignment operators">operator =</a> (::std::complex<T> const & a_affecter);
|
||||
octonion<T> & <a href="#Assignment operators">operator =</a> (::boost::math::quaternion<T> const & a_affecter);
|
||||
|
||||
octonion<T> & <a href="#Other member operators">operator +=</a> (T const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator +=</a> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator +=</a> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <a href="#Other member operators">operator +=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<T> & <a href="#Other member operators">operator -=</a> (T const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator -=</a> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator -=</a> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <a href="#Other member operators">operator -=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<T> & <a href="#Other member operators">operator *=</a> (T const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator *=</a> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator *=</a> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <a href="#Other member operators">operator *=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<T> & <a href="#Other member operators">operator /=</a> (T const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator /=</a> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <a href="#Other member operators">operator /=</a> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <a href="#Other member operators">operator /=</a> (octonion<X> const & rhs);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}</code></pre>
|
||||
<p></p>
|
||||
<h2><a name="octonion specializations"></a><code>octonion</code> specializations</h2>
|
||||
<pre><code>namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
|
||||
<a name="octonion<float>"></a> template<>
|
||||
class octonion<float>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef float <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">octonion</a>(float const & requested_a = 0.0f, float const & requested_b = 0.0f, float const & requested_c = 0.0f, float const & requested_d = 0.0f, float const & requested_e = 0.0f, float const & requested_f = 0.0f, float const & requested_g = 0.0f, float const & requested_h = 0.0f);
|
||||
explicit <a href="#Constructors">octonion</a>(::std::complex<float> const & z0, ::std::complex<float> const & z1 = ::std::complex<float>(), ::std::complex<float> const & z2 = ::std::complex<float>(), ::std::complex<float> const & z3 = ::std::complex<float>());
|
||||
explicit <a href="#Constructors">octonion</a>(::boost::math::quaternion<float> const & q0, ::boost::math::quaternion<float> const & q1 = ::boost::math::quaternion<float>());
|
||||
explicit <a href="#Constructors">octonion</a>(octonion<double> const & a_recopier);
|
||||
explicit <a href="#Constructors">octonion</a>(octonion<long double> const & a_recopier);
|
||||
|
||||
float <a href="#Other member functions">real</a>() const;
|
||||
octonion<float> <a href="#Other member functions">unreal</a>() const;
|
||||
|
||||
float <a href="#Other member functions">R_component_1</a>() const;
|
||||
float <a href="#Other member functions">R_component_2</a>() const;
|
||||
float <a href="#Other member functions">R_component_3</a>() const;
|
||||
float <a href="#Other member functions">R_component_4</a>() const;
|
||||
float <a href="#Other member functions">R_component_5</a>() const;
|
||||
float <a href="#Other member functions">R_component_6</a>() const;
|
||||
float <a href="#Other member functions">R_component_7</a>() const;
|
||||
float <a href="#Other member functions">R_component_8</a>() const;
|
||||
|
||||
::std::complex<float> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<float> <a href="#Other member functions">C_component_2</a>() const;
|
||||
::std::complex<float> <a href="#Other member functions">C_component_3</a>() const;
|
||||
::std::complex<float> <a href="#Other member functions">C_component_4</a>() const;
|
||||
|
||||
::boost::math::octonion<float> <a href="#Other member functions">H_component_1</a>() const;
|
||||
::boost::math::octonion<float> <a href="#Other member functions">H_component_2</a>() const;
|
||||
|
||||
octonion<float> & <a href="#Assignment operators">operator =</a> (octonion<float> const & a_affecter);
|
||||
template<typename X> octonion<float> & <a href="#Assignment operators">operator =</a> (octonion<X>const & a_affecter);
|
||||
octonion<float> & <a href="#Assignment operators">operator =</a> (float const & a_affecter);
|
||||
octonion<float> & <a href="#Assignment operators">operator =</a> (::std::complex<float> const & a_affecter);
|
||||
octonion<float> & <a href="#Assignment operators">operator =</a> (::boost::math::quaternion<float> const & a_affecter);
|
||||
|
||||
octonion<float> & <a href="#Other member operators">operator +=</a> (float const & rhs);
|
||||
octonion<float> & <a href="#Other member operators">operator +=</a> (::std::complex<float> const & rhs);
|
||||
template<typename X> octonion<float> & <a href="#Other member operators">operator +=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<float> & <a href="#Other member operators">operator -=</a> (float const & rhs);
|
||||
octonion<float> & <a href="#Other member operators">operator -=</a> (::std::complex<float> const & rhs);
|
||||
octonion<float> & <a href="#Other member operators">operator -=</a> (::boost::math::quaternion<float> const & rhs);
|
||||
template<typename X> octonion<float> & <a href="#Other member operators">operator -=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<float> & <a href="#Other member operators">operator *=</a> (float const & rhs);
|
||||
octonion<float> & <a href="#Other member operators">operator *=</a> (::std::complex<float> const & rhs);
|
||||
octonion<float> & <a href="#Other member operators">operator *=</a> (::boost::math::quaternion<float> const & rhs);
|
||||
template<typename X> octonion<float> & <a href="#Other member operators">operator *=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<float> & <a href="#Other member operators">operator /=</a> (float const & rhs);
|
||||
octonion<float> & <a href="#Other member operators">operator /=</a> (::std::complex<float> const & rhs);
|
||||
octonion<float> & <a href="#Other member operators">operator /=</a> (::boost::math::quaternion<float> const & rhs);
|
||||
template<typename X> octonion<float> & <a href="#Other member operators">operator /=</a> (octonion<X> const & rhs);
|
||||
};
|
||||
|
||||
|
||||
<a name="octonion<double>"></a> template<>
|
||||
class octonion<double>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef double <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">octonion</a>(double const & requested_a = 0.0, double const & requested_b = 0.0, double const & requested_c = 0.0, double const & requested_d = 0.0, double const & requested_e = 0.0, double const & requested_f = 0.0, double const & requested_g = 0.0, double const & requested_h = 0.0);
|
||||
explicit <a href="#Constructors">octonion</a>(::std::complex<double> const & z0, ::std::complex<double> const & z1 = ::std::complex<double>(), ::std::complex<double> const & z2 = ::std::complex<double>(), ::std::complex<double> const & z3 = ::std::complex<double>());
|
||||
explicit <a href="#Constructors">octonion</a>(::boost::math::quaternion<double> const & q0, ::boost::math::quaternion<double> const & q1 = ::boost::math::quaternion<double>());
|
||||
explicit <a href="#Constructors">octonion</a>(octonion<float> const & a_recopier);
|
||||
explicit <a href="#Constructors">octonion</a>(octonion<long double> const & a_recopier);
|
||||
|
||||
double <a href="#Other member functions">real</a>() const;
|
||||
octonion<double> <a href="#Other member functions">unreal</a>() const;
|
||||
|
||||
double <a href="#Other member functions">R_component_1</a>() const;
|
||||
double <a href="#Other member functions">R_component_2</a>() const;
|
||||
double <a href="#Other member functions">R_component_3</a>() const;
|
||||
double <a href="#Other member functions">R_component_4</a>() const;
|
||||
double <a href="#Other member functions">R_component_5</a>() const;
|
||||
double <a href="#Other member functions">R_component_6</a>() const;
|
||||
double <a href="#Other member functions">R_component_7</a>() const;
|
||||
double <a href="#Other member functions">R_component_8</a>() const;
|
||||
|
||||
::std::complex<double> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<double> <a href="#Other member functions">C_component_2</a>() const;
|
||||
::std::complex<double> <a href="#Other member functions">C_component_3</a>() const;
|
||||
::std::complex<double> <a href="#Other member functions">C_component_4</a>() const;
|
||||
|
||||
::boost::math::quaternion<double> <a href="#Other member functions">H_component_1</a>() const;
|
||||
::boost::math::quaternion<double> <a href="#Other member functions">H_component_2</a>() const;
|
||||
|
||||
octonion<double> & <a href="#Assignment operators">operator =</a> (octonion<double> const & a_affecter);
|
||||
template<typename X> octonion<double> & <a href="#Assignment operators">operator =</a> (octonion<X> const & a_affecter);
|
||||
octonion<double> & <a href="#Assignment operators">operator =</a> (double const & a_affecter);
|
||||
octonion<double> & <a href="#Assignment operators">operator =</a> (::std::complex<double> const & a_affecter);
|
||||
octonion<double> & <a href="#Assignment operators">operator =</a> (::boost::math::quaternion<double> const & a_affecter);
|
||||
|
||||
octonion<double> & <a href="#Other member operators">operator +=</a> (double const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator +=</a> (::std::complex<double> const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator +=</a> (::boost::math::quaternion<double> const & rhs);
|
||||
template<typename X> octonion<double> & <a href="#Other member operators">operator +=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<double> & <a href="#Other member operators">operator -=</a> (double const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator -=</a> (::std::complex<double> const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator -=</a> (::boost::math::quaternion<double> const & rhs);
|
||||
template<typename X> octonion<double> & <a href="#Other member operators">operator -=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<double> & <a href="#Other member operators">operator *=</a> (double const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator *=</a> (::std::complex<double> const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator *=</a> (::boost::math::quaternion<double> const & rhs);
|
||||
template<typename X> octonion<double> & <a href="#Other member operators">operator *=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<double> & <a href="#Other member operators">operator /=</a> (double const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator /=</a> (::std::complex<double> const & rhs);
|
||||
octonion<double> & <a href="#Other member operators">operator /=</a> (::boost::math::quaternion<double> const & rhs);
|
||||
template<typename X> octonion<double> & <a href="#Other member operators">operator /=</a> (octonion<X> const & rhs);
|
||||
};
|
||||
|
||||
|
||||
<a name="octonion<long double>"></a> template<>
|
||||
class octonion<long double>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef long double <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">octonion</a>(long double const & requested_a = 0.0L, long double const & requested_b = 0.0L, long double const & requested_c = 0.0L, long double const & requested_d = 0.0L, long double const & requested_e = 0.0L, long double const & requested_f = 0.0L, long double const & requested_g = 0.0L, long double const & requested_h = 0.0L);
|
||||
explicit <a href="#Constructors">octonion</a>( ::std::complex<long double> const & z0, ::std::complex<long double> const & z1 = ::std::complex<long double>(), ::std::complex<long double> const & z2 = ::std::complex<long double>(), ::std::complex<long double> const & z3 = ::std::complex<long double>());
|
||||
explicit <a href="#Constructors">octonion</a>( ::boost::math::quaternion<long double> const & q0, ::boost::math::quaternion<long double> const & z1 = ::boost::math::quaternion<long double>());
|
||||
explicit <a href="#Constructors">octonion</a>(octonion<float> const & a_recopier);
|
||||
explicit <a href="#Constructors">octonion</a>(octonion<double> const & a_recopier);
|
||||
|
||||
long double <a href="#Other member functions">real</a>() const;
|
||||
octonion<long double> <a href="#Other member functions">unreal</a>() const;
|
||||
|
||||
long double <a href="#Other member functions">R_component_1</a>() const;
|
||||
long double <a href="#Other member functions">R_component_2</a>() const;
|
||||
long double <a href="#Other member functions">R_component_3</a>() const;
|
||||
long double <a href="#Other member functions">R_component_4</a>() const;
|
||||
long double <a href="#Other member functions">R_component_5</a>() const;
|
||||
long double <a href="#Other member functions">R_component_6</a>() const;
|
||||
long double <a href="#Other member functions">R_component_7</a>() const;
|
||||
long double <a href="#Other member functions">R_component_8</a>() const;
|
||||
|
||||
::std::complex<long double> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<long double> <a href="#Other member functions">C_component_2</a>() const;
|
||||
::std::complex<long double> <a href="#Other member functions">C_component_3</a>() const;
|
||||
::std::complex<long double> <a href="#Other member functions">C_component_4</a>() const;
|
||||
|
||||
::boost::math::quaternion<long double> <a href="#Other member functions">H_component_1</a>() const;
|
||||
::boost::math::quaternion<long double> <a href="#Other member functions">H_component_2</a>() const;
|
||||
|
||||
octonion<long double> & <a href="#Assignment operators">operator =</a> (octonion<long double> const & a_affecter);
|
||||
template<typename X> octonion<long double> & <a href="#Assignment operators">operator =</a> (octonion<X> const & a_affecter);
|
||||
octonion<long double> & <a href="#Assignment operators">operator =</a> (long double const & a_affecter);
|
||||
octonion<long double> & <a href="#Assignment operators">operator =</a> (::std::complex<long double> const & a_affecter);
|
||||
octonion<long double> & <a href="#Assignment operators">operator =</a> (::boost::math::quaternion<long double> const & a_affecter);
|
||||
|
||||
octonion<long double> & <a href="#Other member operators">operator +=</a> (long double const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator +=</a> (::std::complex<long double> const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator +=</a> (::boost::math::quaternion<long double> const & rhs);
|
||||
template<typename X> octonion<long double> & <a href="#Other member operators">operator +=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<long double> & <a href="#Other member operators">operator -=</a> (long double const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator -=</a> (::std::complex<long double> const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator -=</a> (::boost::math::quaternion<long double> const & rhs);
|
||||
template<typename X> octonion<long double> & <a href="#Other member operators">operator -=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<long double> & <a href="#Other member operators">operator *=</a> (long double const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator *=</a> (::std::complex<long double> const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator *=</a> (::boost::math::quaternion<long double> const & rhs);
|
||||
template<typename X> octonion<long double> & <a href="#Other member operators">operator *=</a> (octonion<X> const & rhs);
|
||||
|
||||
octonion<long double> & <a href="#Other member operators">operator /=</a> (long double const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator /=</a> (::std::complex<long double> const & rhs);
|
||||
octonion<long double> & <a href="#Other member operators">operator /=</a> (::boost::math::quaternion<long double> const & rhs);
|
||||
template<typename X> octonion<long double> & <a href="#Other member operators">operator /=</a> (octonion<X> const & rhs);
|
||||
};
|
||||
|
||||
}
|
||||
}</code></pre>
|
||||
<p></p>
|
||||
<h2><a name="octonion typedefs"></a><code>octonion</code> typedefs</h2>
|
||||
<h3><a name="value_type"></a><code>value_type</code></h3>
|
||||
<pre><code>typedef T <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Template version.</p>
|
||||
</blockquote>
|
||||
<pre><code>typedef float <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Float specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>typedef double <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Double specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>typedef long double <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Long double specialization version.</p>
|
||||
<p>These provide easy acces to the type the template is built upon.</p>
|
||||
</blockquote>
|
||||
<h2><a name="octonion member functions"></a><code>octonion</code> member functions</h2>
|
||||
<h3><a name="Constructors"></a>Constructors</h3>
|
||||
<pre><code>explicit <strong>octonion</strong>(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T(), T const & requested_e = T(), T const & requested_f = T(), T const & requested_g = T(), T const & requested_h = T());
|
||||
explicit <strong>octonion</strong>(::std::complex<T> const & z0, ::std::complex<T> const & z1 = ::std::complex<T>(), ::std::complex<T> const & z2 = ::std::complex<T>(), ::std::complex<T> const & z3 = ::std::complex<T>());
|
||||
explicit <strong>octonion</strong>(::boost::math::quaternion<T> const & q0, ::boost::math::quaternion<T> const & q1 = ::boost::math::quaternion<T>());
|
||||
template<typename X> explicit <strong>octonion</strong>(octonion<X> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Template version.</p>
|
||||
</blockquote>
|
||||
<pre><code>explicit <strong>octonion</strong>(float const & requested_a = 0.0f, float const & requested_b = 0.0f, float const & requested_c = 0.0f, float const & requested_d = 0.0f, float const & requested_e = 0.0f, float const & requested_f = 0.0f, float const & requested_g = 0.0f, float const & requested_h = 0.0f);
|
||||
explicit <strong>octonion</strong>(::std::complex<float> const & z0, ::std::complex<float> const & z1 = ::std::complex<float>(), ::std::complex<float> const & z2 = ::std::complex<float>(), ::std::complex<float> const & z3 = ::std::complex<float>());
|
||||
explicit <strong>octonion</strong>(::boost::math::quaternion<float> const & q0, ::boost::math::quaternion<float> const & q1 = ::boost::math::quaternion<float>());
|
||||
explicit <strong>octonion</strong>(octonion<double> const & a_recopier);
|
||||
explicit <strong>octonion</strong>(octonion<long double> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Float specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>explicit <strong>octonion</strong>(double const & requested_a = 0.0, double const & requested_b = 0.0, double const & requested_c = 0.0, double const & requested_d = 0.0, double const & requested_e = 0.0, double const & requested_f = 0.0, double const & requested_g = 0.0, double const & requested_h = 0.0);
|
||||
explicit <strong>octonion</strong>(::std::complex<double> const & z0, ::std::complex<double> const & z1 = ::std::complex<double>(), ::std::complex<double> const & z2 = ::std::complex<double>(), ::std::complex<double> const & z3 = ::std::complex<double>());
|
||||
explicit <strong>octonion</strong>(::boost::math::quaternion<double> const & q0, ::boost::math::quaternion<double> const & q1 = ::boost::math::quaternion<double>());
|
||||
explicit <strong>octonion</strong>(octonion<float> const & a_recopier);
|
||||
explicit <strong>octonion</strong>(octonion<long double> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Double specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>explicit <strong>octonion</strong>(long double const & requested_a = 0.0L, long double const & requested_b = 0.0L, long double const & requested_c = 0.0L, long double const & requested_d = 0.0L, long double const & requested_e = 0.0L, long double const & requested_f = 0.0L, long double const & requested_g = 0.0L, long double const & requested_h = 0.0L);
|
||||
explicit <strong>octonion</strong>( ::std::complex<long double> const & z0, ::std::complex<long double> const & z1 = ::std::complex<long double>(), ::std::complex<long double> const & z2 = ::std::complex<long double>(), ::std::complex<long double> const & z3 = ::std::complex<long double>());
|
||||
explicit <strong>octonion</strong>(::boost::math::quaternion<long double> const & q0, ::boost::math::quaternion<long double> const & q1 = ::boost::math::quaternion<long double>());
|
||||
explicit <strong>octonion</strong>(octonion<float> const & a_recopier);
|
||||
explicit <strong>octonion</strong>(octonion<double> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Long double specialization version.</p>
|
||||
<p>A default constructor is provided for each form, which initializes each component to the default values for their type (<cite>i.e.</cite> zero for floating numbers). This constructor can also accept one to eight base type arguments. A constructor is also provided to build octonions from one to four complex numbers sharing the same base type, and another taking one or two quaternionssharing the same base type. The unspecialized template also sports a templarized copy constructor, while the specialized forms have copy constructors from the other two specializations, which are explicit when a risk of precision loss exists. For the unspecialized form, the base type's constructors must not throw.</p>
|
||||
<p>Destructors and untemplated copy constructors (from the same type) are provided by the compiler. Converting copy constructors make use of a templated helper function in a "detail" subnamespace.</p>
|
||||
</blockquote>
|
||||
<h3><a name="Other member functions"></a>Other member functions</h3>
|
||||
<pre><code>T <strong>real</strong>() const;
|
||||
octonion<T> <strong>unreal</strong>() const;</code></pre>
|
||||
<blockquote>
|
||||
<p>Like complex number, octonions do have a meaningful notion of "real part", but unlike them there is no meaningful notion of "imaginary part". Instead there is an "unreal part" which itself is a octonion, and usually nothing simpler (as opposed to the complex number case). These are returned by the first two functions.</p>
|
||||
</blockquote>
|
||||
<pre><code>T <strong>R_component_1</strong>() const;
|
||||
T <strong>R_component_2</strong>() const;
|
||||
T <strong>R_component_3</strong>() const;
|
||||
T <strong>R_component_4</strong>() const;
|
||||
T <strong>R_component_5</strong>() const;
|
||||
T <strong>R_component_6</strong>() const;
|
||||
T <strong>R_component_7</strong>() const;
|
||||
T <strong>R_component_8</strong>() const;</code></pre>
|
||||
<blockquote>
|
||||
<p>A octonion having eight real components, these are returned by these eight functions. Hence <code>real</code> and <code>R_component_1</code> return the same value.</p>
|
||||
</blockquote>
|
||||
<pre><code>::std::complex<T> <strong>C_component_1</strong>() const;
|
||||
::std::complex<T> <strong>C_component_2</strong>() const;
|
||||
::std::complex<T> <strong>C_component_3</strong>() const;
|
||||
::std::complex<T> <strong>C_component_4</strong>() const;</code></pre>
|
||||
<blockquote>
|
||||
<p>A octonion likewise has four complex components. Actually, <font color="#000000">octonions are indeed a (left) vector field over the complexes</font>, but <em>beware</em>, as <font color="#000000">for any octonion <img src="graphics/octonion_blurb18.jpeg" width="215" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> we also have <img src="graphics/octonion_blurb19.jpeg" width="228" height="17" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> (note the <strong>minus</strong> sign in the last factor)</font><font color="#000000">. What the <code>C_component_n</code> functions return, however, are the complexes which could be used to build the octonion using the constructor, and <strong>not</strong> the components of the octonion on the basis <img src="graphics/octonion_blurb21.jpeg" width="52" height="16" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
</blockquote>
|
||||
<pre><code>::boost::math::quaternion<T> <strong>H_component_1</strong>() const;
|
||||
::boost::math::quaternion<T> <strong>H_component_2</strong>() const;</code></pre>
|
||||
<blockquote>
|
||||
<p>Likewise, for any octonion <img src="graphics/octonion_blurb18.jpeg" width="215" height="15" naturalsizeflag="3" align=absmiddle> we also have<font color="#000000"> <img src="graphics/octonion_blurb20.jpeg" width="219" height="17" naturalsizeflag="3" align=absmiddle>, though there is no meaningful vector-space-like structure based on the quaternions. What the <code>H_component_n</code> functions return are the quaternions which could be used to build the octonion</font><font color="#000000"> using the constructor.</font></p>
|
||||
</blockquote>
|
||||
<h2><a name="octonion member operators"></a><code>octonion</code> member operators</h2>
|
||||
<h3><a name="Assignment operators"></a>Assignment operators</h3>
|
||||
<pre><code>octonion<T> & <strong>operator =</strong> (octonion<T> const & a_affecter);
|
||||
template<typename X> octonion<T> & <strong>operator =</strong> (octonion<X> const & a_affecter);
|
||||
octonion<T> & <strong>operator =</strong> (T const & a_affecter);
|
||||
octonion<T> & <strong>operator =</strong> (::std::complex<T> const & a_affecter);
|
||||
octonion<T> & <strong>operator =</strong> (::boost::math::quaternion<T> const & a_affecter);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the expected assignment, with type modification if necessary (for instance, assigning from a base type will set the real part to that value, and all other components to zero). For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<h3><a name="Other member operators"></a>Other member operators</h3>
|
||||
<pre><code>octonion<T> & <strong>operator +=</strong> (T const & rhs)
|
||||
octonion<T> & <strong>operator +=</strong> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <strong>operator +=</strong> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <strong>operator +=</strong> (octonion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)+rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<pre><code>octonion<T> & <strong>operator -=</strong> (T const & rhs)
|
||||
octonion<T> & <strong>operator -=</strong> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <strong>operator -=</strong> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <strong>operator -=</strong> (octonion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)-rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<pre><code>octonion<T> & <strong>operator *=</strong> (T const & rhs)
|
||||
octonion<T> & <strong>operator *=</strong> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <strong>operator *=</strong> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <strong>operator *=</strong> (octonion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)*rhs <strong>in this order</strong> (order is important as multiplication is not commutative for octonions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw. Also, for clarity's sake, you should <em>always</em> group the factors in a multiplication by groups of two, as the multiplication is not even associative on the octonions (though there are of course cases where this does not matter, it usually does).</p>
|
||||
</blockquote>
|
||||
<pre><code>octonion<T> & <strong>operator /=</strong> (T const & rhs)
|
||||
octonion<T> & <strong>operator /=</strong> (::std::complex<T> const & rhs);
|
||||
octonion<T> & <strong>operator /=</strong> (::boost::math::quaternion<T> const & rhs);
|
||||
template<typename X> octonion<T> & <strong>operator /=</strong> (octonion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)*inverse_of(rhs) <strong>in this order</strong> (order is important as multiplication is not commutative for octonions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw. As for the multiplication, remember to group any two factors using parenthesis.</p>
|
||||
</blockquote>
|
||||
<h2><a name="octonion non-member operations"></a><code>octonion</code> non-member operations</h2>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>operator +</strong> (octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>This unary operator simply returns <code>o</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>operator -</strong> (octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>This unary operator returns the opposite of <code>o</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>operator +</strong> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator +</strong> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator +</strong> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator +</strong> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator +</strong> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator +</strong> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator +</strong> (octonion<T> const & lhs, octonion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>octonion<T>(lhs) += rhs</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>operator -</strong> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator -</strong> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator -</strong> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator -</strong> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator -</strong> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator -</strong> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator -</strong> (octonion<T> const & lhs, octonion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>octonion<T>(lhs) -= rhs</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>operator *</strong> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator *</strong> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator *</strong> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator *</strong> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator *</strong> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator *</strong> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator *</strong> (octonion<T> const & lhs, octonion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>octonion<T>(lhs) *= rhs</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>operator /</strong> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator /</strong> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator /</strong> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator /</strong> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator /</strong> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator /</strong> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline octonion<T> <strong>operator /</strong> (octonion<T> const & lhs, octonion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>octonion<T>(lhs) /= rhs</code>. It is of course still an error to divide by zero...</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline bool <strong>operator ==</strong> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (octonion<T> const & lhs, octonion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These return <code>true</code> if and only if the four components of <code>octonion<T>(lhs)</code> are equal to their counterparts in <code>octonion<T>(rhs)</code>. As with any floating-type entity, this is essentially meaningless.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline bool <strong>operator !=</strong> (T const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (octonion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (::std::complex<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (octonion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (::boost::math::quaternion<T> const & lhs, octonion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (octonion<T> const & lhs, ::boost::math::quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (octonion<T> const & lhs, octonion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These return <code>true</code> if and only if <code>octonion<T>(lhs) == octonion<T>(rhs)</code> is <code>false</code>. As with any floating-type entity, this is essentially meaningless.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T, typename charT, class traits>
|
||||
::std::basic_istream<charT,traits> & <strong>operator >></strong> (::std::basic_istream<charT,traits> & is, octonion<T> & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Extracts an octonion <code>o</code>. We accept any format which seems reasonable. However, since this leads to a great many ambiguities, decisions were made to lift these. In case of doubt, stick to lists of reals.</p>
|
||||
<p>The input values must be convertible to T. If bad input is encountered, calls is.setstate(ios::failbit) (which may throw ios::failure (27.4.5.3)).</p>
|
||||
<p>Returns <code>is</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T, typename charT, class traits>
|
||||
::std::basic_ostream<charT,traits> & <strong>operator <<</strong> (::std::basic_ostream<charT,traits> & os, octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Inserts the octonion <code>o</code> onto the stream <code>os</code> as if it were implemented as follows:</p>
|
||||
</blockquote>
|
||||
<pre><code> template<typename T, typename charT, class traits>
|
||||
::std::basic_ostream<charT,traits> & operator << ( ::std::basic_ostream<charT,traits> & os,
|
||||
octonion<T> const & o)
|
||||
{
|
||||
::std::basic_ostringstream<charT,traits> s;
|
||||
|
||||
s.flags(os.flags());
|
||||
s.imbue(os.getloc());
|
||||
s.precision(os.precision());
|
||||
|
||||
s << '(' << o.R_component_1() << ','
|
||||
<< o.R_component_2() << ','
|
||||
<< o.R_component_3() << ','
|
||||
<< o.R_component_4() << ','
|
||||
<< o.R_component_5() << ','
|
||||
<< o.R_component_6() << ','
|
||||
<< o.R_component_7() << ','
|
||||
<< o.R_component_8() << ')';
|
||||
|
||||
return os << s.str();
|
||||
}</code></pre>
|
||||
<h2><a name="octonion value operations"></a><code>octonion</code> value operations</h2>
|
||||
<pre><code>template<typename T> inline T <strong>real</strong>(octonion<T> const & o);
|
||||
template<typename T> inline octonion<T> <strong>unreal</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>These return <code>o.real()</code> and <code>o.unreal()</code> respectively.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>conj</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>This returns the conjugate of the octonion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>sup</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the sup norm (the greatest among <code>abs(o.R_component_1())</code>...<code>abs(o.R_component_8())</code>) of the octonion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>l1</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the l1 norm (<code>abs(o.R_component_1())+...+abs(o.R_component_8())</code>) of the octonion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>abs</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the magnitude (Euclidian norm) of the octonion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>norm</strong>(octonion<T>const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the (Cayley) norm of the octonion. The term "norm" might be confusing, as most people associate it with the Euclidian norm (and quadratic functionals). For this version of (the mathematical objects known as) octonions, the Euclidian norm (also known as magnitude) is the square root of the Cayley norm.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>spherical</strong>(T const & rho, T const & theta, T const & phi1, T const & phi2, T const & phi3, T const & phi4, T const & phi5, T const & phi6);
|
||||
template<typename T> inline octonion<T> <strong>multipolar</strong>(T const & rho1, T const & theta1, T const & rho2, T const & theta2, T const & rho3, T const & theta3, T const & rho4, T const & theta4);
|
||||
template<typename T> inline octonion<T> <strong>cylindrical</strong>(T const & r, T const & angle, T const & h1, T const & h2, T const & h3, T const & h4, T const & h5, T const & h6);</code></pre>
|
||||
<blockquote>
|
||||
<p>These build octonions in a way similar to the way <code>polar</code> builds complex numbers, as there is no strict equivalent to polar coordinates for octonions.</p>
|
||||
<p><code>spherical</code> is a simple transposition of <code>polar</code>, it takes as inputs a (positive) magnitude and a point on the hypersphere, given by three angles. The first of these, <code>theta</code> has a natural range of -pi to +pi, and the other two have natural ranges of -pi/2 to +pi/2 (as is the case with the usual spherical coordinates in R^3). Due to the many symmetries and periodicities, nothing untoward happens if the magnitude is negative or the angles are outside their natural ranges. The expected degeneracies (a magnitude of zero ignores the angles settings...) do happen however.</p>
|
||||
<p><code>cylindrical</code> is likewise a simple transposition of the usual cylindrical coordinates in R^3, which in turn is another derivative of planar polar coordinates. The first two inputs are the polar coordinates of the first C component of the octonion. The third and fourth inputs are placed into the third and fourth R components of the octonion, respectively.</p>
|
||||
<p><code>multipolar</code> is yet another simple generalization of polar coordinates. This time, both C components of the octonion are given in polar coordinates.</p>
|
||||
</blockquote>
|
||||
<p>In this version of our implementation of octonions, there is no analogue of the complex value operation <code>arg</code> as the situation is somewhat more complicated.</p>
|
||||
<h2><a name="octonion transcendentals"></a><code>octonion</code> transcendentals</h2>
|
||||
<p>There is no <code>log</code> or <code>sqrt</code> provided for octonions in this implementation, and <code>pow</code> is likewise restricted to integral powers of the exponent. There are several reasons to this: on the one hand, the equivalent of analytic continuation for octonions ("branch cuts") remains to be investigated thoroughly (by me, at any rate...), and we wish to avoid the nonsense introduced in the standard by exponentiations of complexes by complexes (which is well defined, but not in the standard...). Talking of nonsense, saying that <code>pow(0,0)</code> is "implementation defined" is just plain brain-dead...</p>
|
||||
<p>We do, however provide several transcendentals, chief among which is the exponential. That it allows for a "closed formula" is a result of the author (the existence and definition of the exponential, on the octonions among others, on the other hand, is a few centuries old). Basically, any converging power series with real coefficients which allows for a closed formula in C can be transposed to O. More transcendentals of this type could be added in a further revision upon request. It should be noted that it is these functions which force the dependency upon the <a href="../../../boost/math/special_functions/sinc.hpp">boost/math/<code>special_functions/sinc.hpp</code></a> and the <a href="../../../boost/math/special_functions/sinhc.hpp">boost/math/<code>special_functions/sinhc.hpp</code></a> headers.</p>
|
||||
<h3><a name="exp"></a>exp</h3>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>exp</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the exponential of the octonion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="cos"></a>cos</h3>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>cos</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the cosine of the octonion</p>
|
||||
</blockquote>
|
||||
<h3><a name="sin"></a>sin</h3>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>sin</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the sine of the octonion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="tan"></a>tan</h3>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>tan</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the tangent of the octonion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="cosh"></a>cosh</h3>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>cosh</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the hyperbolic cosine of the octonion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="sinh"></a>sinh</h3>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>sinh</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the hyperbolic sine of the octonion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="tanh"></a>tanh</h3>
|
||||
<pre><code>template<typename T> inline octonion<T> <strong>tanh</strong>(octonion<T> const & o);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the hyperbolic tangent of the octonion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="pow"></a>pow</h3>
|
||||
<pre><code>template<typename T> octonion<T> <strong>pow</strong>(octonion<T> const & o, int n);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the <code>n</code>-th power of the octonion <code>q</code>.</p>
|
||||
</blockquote>
|
||||
<h2><a name="History"></a>History</h2>
|
||||
<ul>
|
||||
<li>1.5.7 - 25/02/2003: transitionned to the unit test framework; <boost/config.hpp> now included by the library header (rather than the test files), via <boost/math/quaternion.hpp>.
|
||||
<li>1.5.6 - 15/10/2002: Gcc2.95.x and stlport on linux compatibility by Alkis Evlogimenos (alkis@routescience.com).
|
||||
<li>1.5.5 - 27/09/2002: Microsoft VCPP 7 compatibility, by Michael Stevens (michael@acfr.usyd.edu.au); requires the /Za compiler option.
|
||||
<li>1.5.4 - 19/09/2002: fixed problem with multiple inclusion (in different translation units); attempt at an improved compatibility with Microsoft compilers, by Michael Stevens (michael@acfr.usyd.edu.au) and Fredrik Blomqvist; other compatibility fixes.
|
||||
<li>1.5.3 - 01/02/2002: bugfix and Gcc 2.95.3 compatibility by Douglas Gregor (gregod@cs.rpi.edu).
|
||||
<li>1.5.2 - 07/07/2001: introduced <code>namespace math</code>.
|
||||
<li>1.5.1 - 07/06/2001: (end of Boost review) now includes <code><boost/math/special_functions/sinc.hpp></code> and <code><boost/math/special_functions/sinhc.hpp></code> instead of <code><boost/special_functions.hpp></code>; corrected bug in <code>sin</code> (Daryle Walker); removed check for self-assignment (Gary Powel); made converting functions <code>explicit</code> (Gary Powel); added overflow guards for division operators and <code>abs</code> (Peter Schmitteckert); added <code>sup</code> and <code>l1</code>; used Vesa Karvonen's CPP metaprograming technique to simplify code.
|
||||
<li>1.5.0 - 23/03/2001: boostification, inlining of all operators except input, output and <code>pow</code>, fixed exception safety of some members (template version).
|
||||
<li>1.4.0 - 09/01/2001: added <code>tan</code> and <code>tanh</code>. <li>1.3.1 - 08/01/2001: cosmetic fixes.
|
||||
<li>1.3.0 - 12/07/2000: <code>pow</code> now uses Maarten Hilferink's (mhilferink@tip.nl) algorithm. <li>1.2.0 - 25/05/2000: fixed the division operators and output; changed many signatures. <li>1.1.0 - 23/05/2000: changed <code>sinc</code> into <code>sinc_pi</code>; added <code>sin</code>, <code>cos</code>, <code>sinh</code>, <code>cosh</code>.
|
||||
<li>1.0.0 - 10/08/1999: first public version.
|
||||
</ul>
|
||||
<h2><a name="ToDo"></a>To Do</h2>
|
||||
<ul>
|
||||
<li>Improve testing.
|
||||
<li>Rewrite input operatore using Spirit (creates a dependency).
|
||||
<li>Put in place an Expression Template mechanism (perhaps borrowing from uBlas).
|
||||
</ul>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->25 Feb 2003<!--webbot bot="Timestamp" endspan i-checksum="18778" --></p>
|
||||
<p>© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,58 +0,0 @@
|
||||
<html>
|
||||
|
||||
|
||||
|
||||
<head>
|
||||
|
||||
<title>Boost class quaternion</title>
|
||||
<meta http-equiv="generator" content="Adobe GoLive 5">
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
|
||||
|
||||
|
||||
<table border="1" bgcolor="#007F7F" cellpadding="2">
|
||||
|
||||
<tr>
|
||||
|
||||
<td bgcolor="#FFFFFF"><img src="../../../boost.png" alt="boost.png (6897 bytes)" WIDTH="277" HEIGHT="86"></td>
|
||||
|
||||
<td><a href="../../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home </big></font></a></td>
|
||||
|
||||
<td><a href="../../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries </big></font></a></td>
|
||||
|
||||
<td><a href="../../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People </big></font></a></td>
|
||||
|
||||
<td><a href="../../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ </big></font></a></td>
|
||||
|
||||
<td><a href="../../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More </big></font></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h2>The quaternion Class</h2>
|
||||
<p>Class quaternion provides an implementation of the mathematical object of the same name. See the documentation for details.
|
||||
<ul>
|
||||
|
||||
<li><a href="quaternion.html">Documentation</a></li>
|
||||
|
||||
<li>Header <a href="../../../boost/math/quaternion.hpp">quaternion.hpp</a></li>
|
||||
<li>Test program <a href="quaternion_test.cpp">quaternion_test.cpp</a> (and <a href="quaternion_mult_incl_test.cpp">another one</a> to test multiple inclusions)</li>
|
||||
<li>Submitted by Hubert Holin.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %b %Y" startspan -->24 Feb 2003<!--webbot bot="Timestamp" endspan i-checksum="14992" -->
|
||||
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,634 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Class quaternion Documentation</title>
|
||||
<meta http-equiv="generator" content="Adobe GoLive 5">
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
<h1><img src="../../../boost.png" alt="c++boost.gif (8819 bytes)" align="center" width="277" height="86">Class quaternion</h1>
|
||||
<ul>
|
||||
<li><a href="#Acknowledgements">Acknowledgements</a>
|
||||
<li><a href="#Header File">Header File</a>
|
||||
<li><a href="#Test Program">Test Program</a>
|
||||
<li><a href="#Synopsis">Synopsis</a>
|
||||
<li><a href="#Template class quaternion">Template class <code>quaternion</code></a>
|
||||
<li><a href="#quaternion specializations"><code>quaternion</code> specializations</a>
|
||||
<li><a href="#quaternion typedefs"><code>quaternion</code> typedefs</a>
|
||||
<li><a href="#quaternion member functions"><code>quaternion</code> member functions</a>
|
||||
<li><a href="#quaternion member operators"><code>quaternion</code> member operators</a>
|
||||
<li><a href="#quaternion non-member operations"><code>quaternion</code> non-member operations</a>
|
||||
<li><a href="#Other member functions"><code>quaternion</code> value operations</a>
|
||||
<li><a href="#quaternion transcendentals"><code>quaternion</code> transcendentals</a>
|
||||
<li><a href="#History">History</a>
|
||||
<li><a href="#ToDo">To Do</a>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>Quaternions are a relative of complex numbers.</p>
|
||||
<p>Quaternions are in fact part of a small hierarchy of structures built upon the real numbers, which comprise only the set of real numbers (traditionally named <img src="graphics/quaternion_blurb1.jpeg" width="12" height="11" naturalsizeflag="3" align=absmiddle>), the set of complex numbers (traditionally named <img src="graphics/quaternion_blurb2.jpeg" width="11" height="12" naturalsizeflag="3" align=absmiddle><font color="#000000">), the set of quaternions (traditionally named <img src="graphics/quaternion_blurb3.jpeg" width="12" height="11" naturalsizeflag="3" align=absmiddle>) and the set of <a href="../octonion/octonion.html">octonions</a> (traditionally named <img src="graphics/quaternion_blurb4.jpeg" width="12" height="12" naturalsizeflag="3" align=absmiddle>), which possess interesting mathematical properties (chief among which is the fact that they are <cite>division algebras</cite>, <cite>i.e.</cite> where the following property is true: if <img src="graphics/quaternion_blurb5.jpeg" width="9" height="11" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> is an element of that algebra and is <strong>not equal to zero</strong>, then <img src="graphics/quaternion_blurb6.jpeg" width="46" height="14" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, where <img src="graphics/quaternion_blurb7.jpeg" width="9" height="9" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> and <img src="graphics/quaternion_blurb8.jpeg" width="13" height="12" naturalsizeflag="3" align=absmiddle> denote elements of that algebra, implies that <img src="graphics/quaternion_blurb9.jpeg" width="32" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000">). Each member of the hierarchy is a super-set of the former.</font></p>
|
||||
<p><font color="#000000">One of the most important aspects of quaternions is that they provide an efficient way to parameterize rotations in <img src="graphics/quaternion_blurb10.jpeg" width="15" height="13" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> (the usual three-dimensional space) and <img src="graphics/quaternion_blurb11.jpeg" width="16" height="13" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
<p><font color="#000000">In practical terms, a quaternion is simply a quadruple of real numbers <img src="graphics/quaternion_blurb12.jpeg" width="52" height="16" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, which we can write in the form <img src="graphics/quaternion_blurb13.jpeg" width="104" height="14" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, where <img src="graphics/quaternion_blurb14.jpeg" width="6" height="11" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> is the same object as for complex numbers, and <img src="graphics/quaternion_blurb15.jpeg" width="8" height="13" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> and <img src="graphics/quaternion_blurb16.jpeg" width="9" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> are distinct objects which play essentially the same kind of role as <img src="graphics/quaternion_blurb17.jpeg" width="6" height="11" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
<p><font color="#000000">An addition and a multiplication is defined on the set of quaternions, which generalize their real and complex counterparts. The main novelty here is that <strong>the multiplication is not commutative</strong> (<cite>i.e.</cite> there are quaternions <img src="graphics/quaternion_blurb18.jpeg" width="9" height="9" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> and <img src="graphics/quaternion_blurb19.jpeg" width="9" height="11" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> such that <img src="graphics/quaternion_blurb20.jpeg" width="43" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000">). A good mnemotechnical way of remembering things is by using the formula <img src="graphics/quaternion_blurb21.jpeg" width="111" height="14" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
<p><font color="#000000">Quaternions (and their kin) are described in far more details in this other <a href="TQE.pdf">document</a> (with <a href="TQE_EA.pdf">errata and addenda</a>).</font></p>
|
||||
<p><font color="#000000">Some traditional constructs, such as the exponential, carry over without too much change into the realms of quaternions, but other, such as taking a square root, do not.</font></p>
|
||||
<h2><a name="Acknowledgements"></a>Acknowledgements</h2>
|
||||
<p>The mathematical text has been typeset with <a href="http://www.nisus-soft.com/">Nisus Writer</a>. Jens Maurer has helped with portability and standard adherence, and was the Review Manager for this library. More acknowledgements in the History section. Thank you to all who contributed to the discution about this library.</p>
|
||||
<h2><a name="Header File"></a>Header File</h2>
|
||||
<p>The interface and implementation are both supplied by the header file <a href="../../../boost/math/quaternion.hpp">quaternion.h</a>.</p>
|
||||
<h2><a name="Test Program"></a>Test Program</h2>
|
||||
<p>The <a href="quaternion_test.cpp">quaternion_test.cpp</a> test program tests quaternions specializations for float, double and long double (<a href="output.txt">sample output</a>, with message output enabled).</p>
|
||||
<p>If you define the symbol BOOST_QUATERNION_TEST_VERBOSE, you will get additional output (<a href="output_more.txt">verbose output</a>); this will only be helpfull if you enable message output at the same time, of course (by uncommenting the relevant line in the test or by adding --log_level=messages to your command line,...). In that case, and if you are running interactively, you may in addition define the symbol BOOST_INTERACTIVE_TEST_INPUT_ITERATOR to interactively test the input operator with input of your choice from the standard input (instead of hard-coding it in the test).</p>
|
||||
<h2><a name="Synopsis"></a>Synopsis</h2>
|
||||
<pre><code>namespace boost
|
||||
{
|
||||
|
||||
namespace math
|
||||
{
|
||||
|
||||
template<typename T> class <a href="#quaternion">quaternion</a>;
|
||||
template<> class <a href="#quaternion<float>">quaternion<float></a>;
|
||||
template<> class <a href="#quaternion<double>">quaternion<double></a>;
|
||||
template<> class <a href="#quaternion<long double>">quaternion<long double></a>;
|
||||
|
||||
// operators
|
||||
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator +</a> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator +</a> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator +</a> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator +</a> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator +</a> (quaternion<T> const & lhs, quaternion<T> const & rhs);
|
||||
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator -</a> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator -</a> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator -</a> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator -</a> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator -</a> (quaternion<T> const & lhs, quaternion<T> const & rhs);
|
||||
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator *</a> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator *</a> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator *</a> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator *</a> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator *</a> (quaternion<T> const & lhs, quaternion<T> const & rhs);
|
||||
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator /</a> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator /</a> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator /</a> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator /</a> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator /</a> (quaternion<T> const & lhs, quaternion<T> const & rhs);
|
||||
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator +</a> (quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion non-member operations">operator -</a> (quaternion<T> const & q);
|
||||
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator ==</a> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator ==</a> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator ==</a> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator ==</a> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator ==</a> (quaternion<T> const & lhs, quaternion<T> const & rhs);
|
||||
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator !=</a> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator !=</a> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator !=</a> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator !=</a> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <a href="#quaternion non-member operations">operator !=</a> (quaternion<T> const & lhs, quaternion<T> const & rhs);
|
||||
|
||||
template<typename T, typename charT, class traits>
|
||||
::std::basic_istream<charT,traits> & <a href="#quaternion non-member operations">operator >></a> (::std::basic_istream<charT,traits> & is, quaternion<T> & q);
|
||||
|
||||
template<typename T, typename charT, class traits>
|
||||
::std::basic_ostream<charT,traits> & <a href="#quaternion non-member operations">operator <<</a> (::std::basic_ostream<charT,traits> & os, quaternion<T> const & q);
|
||||
|
||||
// values
|
||||
|
||||
template<typename T> inline T <a href="#quaternion value operations">real</a>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion value operations">unreal</a>(quaternion<T> const & q);
|
||||
|
||||
template<typename T> inline T <a href="#quaternion value operations">sup</a>(quaternion<T> const & q);
|
||||
template<typename T> inline T <a href="#quaternion value operations">l1</a>(quaternion<T> const & q);
|
||||
template<typename T> inline T <a href="#quaternion value operations">abs</a>(quaternion<T> const & q);
|
||||
template<typename T> inline T <a href="#quaternion value operations">norm</a>(quaternion<T>const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion value operations">conj</a>(quaternion<T> const & q);
|
||||
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion value operations">spherical</a>(T const & rho, T const & theta, T const & phi1, T const & phi2);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion value operations">semipolar</a>(T const & rho, T const & alpha, T const & theta1, T const & theta2);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion value operations">multipolar</a>(T const & rho1, T const & theta1, T const & rho2, T const & theta2);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion value operations">cylindrospherical</a>(T const & t, T const & radius, T const & longitude, T const & latitude);
|
||||
template<typename T> inline quaternion<T> <a href="#quaternion value operations">cylindrical</a>(T const & r, T const & angle, T const & h1, T const & h2);
|
||||
|
||||
// transcendentals
|
||||
|
||||
template<typename T> inline quaternion<T> <a href="#exp">exp</a>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#cos">cos</a>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#sin">sin</a>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#tan">tan</a>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#cosh">cosh</a>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#sinh">sinh</a>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <a href="#tanh">tanh</a>(quaternion<T> const & q);
|
||||
|
||||
template<typename T> quaternion<T> <a href="#pow">pow</a>(quaternion<T> const & q, int n);
|
||||
|
||||
}
|
||||
|
||||
}</code></pre>
|
||||
<h2><a name="Template class quaternion"></a>Template class <code>quaternion</code></h2>
|
||||
<pre><code>namespace boost
|
||||
{
|
||||
namespace math
|
||||
{
|
||||
|
||||
<a name="quaternion"></a> template<typename T>
|
||||
class quaternion
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">quaternion</a>(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T());
|
||||
explicit <a href="#Constructors">quaternion</a>(::std::complex<T> const & z0, ::std::complex<T> const & z1 = ::std::complex<T>());
|
||||
template<typename X> explicit <a href="#Constructors">quaternion</a>(quaternion<X> const & a_recopier);
|
||||
|
||||
T <a href="#Other member functions">real</a>() const;
|
||||
quaternion<T> <a href="#Other member functions">unreal</a>() const;
|
||||
T <a href="#Other member functions">R_component_1</a>() const;
|
||||
T <a href="#Other member functions">R_component_2</a>() const;
|
||||
T <a href="#Other member functions">R_component_3</a>() const;
|
||||
T <a href="#Other member functions">R_component_4</a>() const;
|
||||
::std::complex<T> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<T> <a href="#Other member functions">C_component_2</a>() const;
|
||||
|
||||
quaternion<T> & <a href="#Assignment operators">operator =</a> (quaternion<T> const & a_affecter);
|
||||
template<typename X> quaternion<T> & <a href="#Assignment operators">operator =</a> (quaternion<X> const & a_affecter);
|
||||
quaternion<T> & <a href="#Assignment operators">operator =</a> (T const & a_affecter);
|
||||
quaternion<T> & <a href="#Assignment operators">operator =</a> (::std::complex<T> const & a_affecter);
|
||||
|
||||
quaternion<T> & <a href="#Other member operators">operator +=</a> (T const & rhs);
|
||||
quaternion<T> & <a href="#Other member operators">operator +=</a> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <a href="#Other member operators">operator +=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<T> & <a href="#Other member operators">operator -=</a> (T const & rhs);
|
||||
quaternion<T> & <a href="#Other member operators">operator -=</a> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <a href="#Other member operators">operator -=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<T> & <a href="#Other member operators">operator *=</a> (T const & rhs);
|
||||
quaternion<T> & <a href="#Other member operators">operator *=</a> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <a href="#Other member operators">operator *=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<T> & <a href="#Other member operators">operator /=</a> (T const & rhs);
|
||||
quaternion<T> & <a href="#Other member operators">operator /=</a> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <a href="#Other member operators">operator /=</a> (quaternion<X> const & rhs);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}</code></pre>
|
||||
<p></p>
|
||||
<h2><a name="quaternion specializations"></a><code>quaternion</code> specializations</h2>
|
||||
<pre><code>namespace boost
|
||||
{
|
||||
|
||||
namespace math
|
||||
{
|
||||
|
||||
<a name="quaternion<float>"></a> template<>
|
||||
class quaternion<float>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef float <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">quaternion</a>(float const & requested_a = 0.0f, float const & requested_b = 0.0f, float const & requested_c = 0.0f, float const & requested_d = 0.0f);
|
||||
explicit <a href="#Constructors">quaternion</a>(::std::complex<float> const & z0, ::std::complex<float> const & z1 = ::std::complex<float>());
|
||||
explicit <a href="#Constructors">quaternion</a>(quaternion<double> const & a_recopier);
|
||||
explicit <a href="#Constructors">quaternion</a>(quaternion<long double> const & a_recopier);
|
||||
|
||||
float <a href="#Other member functions">real</a>() const;
|
||||
quaternion<float> <a href="#Other member functions">unreal</a>() const;
|
||||
float <a href="#Other member functions">R_component_1</a>() const;
|
||||
float <a href="#Other member functions">R_component_2</a>() const;
|
||||
float <a href="#Other member functions">R_component_3</a>() const;
|
||||
float <a href="#Other member functions">R_component_4</a>() const;
|
||||
::std::complex<float> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<float> <a href="#Other member functions">C_component_2</a>() const;
|
||||
|
||||
quaternion<float> & <a href="#Assignment operators">operator =</a> (quaternion<float> const & a_affecter);
|
||||
template<typename X> quaternion<float> & <a href="#Assignment operators">operator =</a> (quaternion<X>const & a_affecter);
|
||||
quaternion<float> & <a href="#Assignment operators">operator =</a> (float const & a_affecter);
|
||||
quaternion<float> & <a href="#Assignment operators">operator =</a> (::std::complex<float> const & a_affecter);
|
||||
|
||||
quaternion<float> & <a href="#Other member operators">operator +=</a> (float const & rhs);
|
||||
quaternion<float> & <a href="#Other member operators">operator +=</a> (::std::complex<float> const & rhs);
|
||||
template<typename X> quaternion<float> & <a href="#Other member operators">operator +=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<float> & <a href="#Other member operators">operator -=</a> (float const & rhs);
|
||||
quaternion<float> & <a href="#Other member operators">operator -=</a> (::std::complex<float> const & rhs);
|
||||
template<typename X> quaternion<float> & <a href="#Other member operators">operator -=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<float> & <a href="#Other member operators">operator *=</a> (float const & rhs);
|
||||
quaternion<float> & <a href="#Other member operators">operator *=</a> (::std::complex<float> const & rhs);
|
||||
template<typename X> quaternion<float> & <a href="#Other member operators">operator *=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<float> & <a href="#Other member operators">operator /=</a> (float const & rhs);
|
||||
quaternion<float> & <a href="#Other member operators">operator /=</a> (::std::complex<float> const & rhs);
|
||||
template<typename X> quaternion<float> & <a href="#Other member operators">operator /=</a> (quaternion<X> const & rhs);
|
||||
|
||||
};
|
||||
|
||||
|
||||
<a name="quaternion<double>"></a> template<>
|
||||
class quaternion<double>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef double <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">quaternion</a>(double const & requested_a = 0.0, double const & requested_b = 0.0, double const & requested_c = 0.0, double const & requested_d = 0.0);
|
||||
explicit <a href="#Constructors">quaternion</a>(::std::complex<double> const & z0, ::std::complex<double> const & z1 = ::std::complex<double>());
|
||||
explicit <a href="#Constructors">quaternion</a>(quaternion<float> const & a_recopier);
|
||||
explicit <a href="#Constructors">quaternion</a>(quaternion<long double> const & a_recopier);
|
||||
|
||||
double <a href="#Other member functions">real</a>() const;
|
||||
quaternion<double> <a href="#Other member functions">unreal</a>() const;
|
||||
double <a href="#Other member functions">R_component_1</a>() const;
|
||||
double <a href="#Other member functions">R_component_2</a>() const;
|
||||
double <a href="#Other member functions">R_component_3</a>() const;
|
||||
double <a href="#Other member functions">R_component_4</a>() const;
|
||||
::std::complex<double> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<double> <a href="#Other member functions">C_component_2</a>() const;
|
||||
|
||||
quaternion<double> & <a href="#Assignment operators">operator =</a> (quaternion<double> const & a_affecter);
|
||||
template<typename X> quaternion<double> & <a href="#Assignment operators">operator =</a> (quaternion<X> const & a_affecter);
|
||||
quaternion<double> & <a href="#Assignment operators">operator =</a> (double const & a_affecter);
|
||||
quaternion<double> & <a href="#Assignment operators">operator =</a> (::std::complex<double> const & a_affecter);
|
||||
|
||||
quaternion<double> & <a href="#Other member operators">operator +=</a> (double const & rhs);
|
||||
quaternion<double> & <a href="#Other member operators">operator +=</a> (::std::complex<double> const & rhs);
|
||||
template<typename X> quaternion<double> & <a href="#Other member operators">operator +=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<double> & <a href="#Other member operators">operator -=</a> (double const & rhs);
|
||||
quaternion<double> & <a href="#Other member operators">operator -=</a> (::std::complex<double> const & rhs);
|
||||
template<typename X> quaternion<double> & <a href="#Other member operators">operator -=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<double> & <a href="#Other member operators">operator *=</a> (double const & rhs);
|
||||
quaternion<double> & <a href="#Other member operators">operator *=</a> (::std::complex<double> const & rhs);
|
||||
template<typename X> quaternion<double> & <a href="#Other member operators">operator *=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<double> & <a href="#Other member operators">operator /=</a> (double const & rhs);
|
||||
quaternion<double> & <a href="#Other member operators">operator /=</a> (::std::complex<double> const & rhs);
|
||||
template<typename X> quaternion<double> & <a href="#Other member operators">operator /=</a> (quaternion<X> const & rhs);
|
||||
|
||||
};
|
||||
|
||||
|
||||
<a name="quaternion<long double>"></a> template<>
|
||||
class quaternion<long double>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef long double <a href="#value_type">value_type</a>;
|
||||
|
||||
explicit <a href="#Constructors">quaternion</a>(long double const & requested_a = 0.0L, long double const & requested_b = 0.0L, long double const & requested_c = 0.0L, long double const & requested_d = 0.0L);
|
||||
explicit <a href="#Constructors">quaternion</a>( ::std::complex<long double> const & z0, ::std::complex<long double> const & z1 = ::std::complex<long double>());
|
||||
explicit <a href="#Constructors">quaternion</a>(quaternion<float> const & a_recopier);
|
||||
explicit <a href="#Constructors">quaternion</a>(quaternion<double> const & a_recopier);
|
||||
|
||||
long double <a href="#Other member functions">real</a>() const;
|
||||
quaternion<long double> <a href="#Other member functions">unreal</a>() const;
|
||||
long double <a href="#Other member functions">R_component_1</a>() const;
|
||||
long double <a href="#Other member functions">R_component_2</a>() const;
|
||||
long double <a href="#Other member functions">R_component_3</a>() const;
|
||||
long double <a href="#Other member functions">R_component_4</a>() const;
|
||||
::std::complex<long double> <a href="#Other member functions">C_component_1</a>() const;
|
||||
::std::complex<long double> <a href="#Other member functions">C_component_2</a>() const;
|
||||
|
||||
quaternion<long double> & <a href="#Assignment operators">operator =</a> (quaternion<long double> const & a_affecter);
|
||||
template<typename X> quaternion<long double> & <a href="#Assignment operators">operator =</a> (quaternion<X> const & a_affecter);
|
||||
quaternion<long double> & <a href="#Assignment operators">operator =</a> (long double const & a_affecter);
|
||||
quaternion<long double> & <a href="#Assignment operators">operator =</a> (::std::complex<long double> const & a_affecter);
|
||||
|
||||
quaternion<long double> & <a href="#Other member operators">operator +=</a> (long double const & rhs);
|
||||
quaternion<long double> & <a href="#Other member operators">operator +=</a> (::std::complex<long double> const & rhs);
|
||||
template<typename X> quaternion<long double> & <a href="#Other member operators">operator +=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<long double> & <a href="#Other member operators">operator -=</a> (long double const & rhs);
|
||||
quaternion<long double> & <a href="#Other member operators">operator -=</a> (::std::complex<long double> const & rhs);
|
||||
template<typename X> quaternion<long double> & <a href="#Other member operators">operator -=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<long double> & <a href="#Other member operators">operator *=</a> (long double const & rhs);
|
||||
quaternion<long double> & <a href="#Other member operators">operator *=</a> (::std::complex<long double> const & rhs);
|
||||
template<typename X> quaternion<long double> & <a href="#Other member operators">operator *=</a> (quaternion<X> const & rhs);
|
||||
|
||||
quaternion<long double> & <a href="#Other member operators">operator /=</a> (long double const & rhs);
|
||||
quaternion<long double> & <a href="#Other member operators">operator /=</a> (::std::complex<long double> const & rhs);
|
||||
template<typename X> quaternion<long double> & <a href="#Other member operators">operator /=</a> (quaternion<X> const & rhs);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}</code></pre>
|
||||
<p></p>
|
||||
<h2><a name="quaternion typedefs"></a><code>quaternion</code> typedefs</h2>
|
||||
<h3><a name="value_type"></a><code>value_type</code></h3>
|
||||
<pre><code>typedef T <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Template version.</p>
|
||||
</blockquote>
|
||||
<pre><code>typedef float <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Float specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>typedef double <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Double specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>typedef long double <strong>value_type</strong>;</code></pre>
|
||||
<blockquote>
|
||||
<p>Long double specialization version.</p>
|
||||
<p>These provide easy acces to the type the template is built upon.</p>
|
||||
</blockquote>
|
||||
<h2><a name="quaternion member functions"></a><code>quaternion</code> member functions</h2>
|
||||
<h3><a name="Constructors"></a>Constructors</h3>
|
||||
<pre><code>explicit <strong>quaternion</strong>(T const & requested_a = T(), T const & requested_b = T(), T const & requested_c = T(), T const & requested_d = T());
|
||||
explicit <strong>quaternion</strong>(::std::complex<T> const & z0, ::std::complex<T> const & z1 = ::std::complex<T>());
|
||||
template<typename X> explicit <strong>quaternion</strong>(quaternion<X> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Template version.</p>
|
||||
</blockquote>
|
||||
<pre><code>explicit <strong>quaternion</strong>(float const & requested_a = 0.0f, float const & requested_b = 0.0f, float const & requested_c = 0.0f, float const & requested_d = 0.0f);
|
||||
explicit <strong>quaternion</strong>(::std::complex<float> const & z0,::std::complex<float> const & z1 = ::std::complex<float>());
|
||||
explicit <strong>quaternion</strong>(quaternion<double> const & a_recopier);
|
||||
explicit <strong>quaternion</strong>(quaternion<long double> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Float specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>explicit <strong>quaternion</strong>(double const & requested_a = 0.0, double const & requested_b = 0.0, double const & requested_c = 0.0, double const & requested_d = 0.0);
|
||||
explicit <strong>quaternion</strong>(::std::complex<double> const & z0, ::std::complex<double> const & z1 = ::std::complex<double>());
|
||||
explicit <strong>quaternion</strong>(quaternion<float> const & a_recopier);
|
||||
explicit <strong>quaternion</strong>(quaternion<long double> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Double specialization version.</p>
|
||||
</blockquote>
|
||||
<pre><code>explicit <strong>quaternion</strong>(long double const & requested_a = 0.0L, long double const & requested_b = 0.0L, long double const & requested_c = 0.0L, long double const & requested_d = 0.0L);
|
||||
explicit <strong>quaternion</strong>( ::std::complex<long double> const & z0, ::std::complex<long double> const & z1 = ::std::complex<long double>());
|
||||
explicit <strong>quaternion</strong>(quaternion<float> const & a_recopier);
|
||||
explicit <strong>quaternion</strong>(quaternion<double> const & a_recopier);</code></pre>
|
||||
<blockquote>
|
||||
<p>Long double specialization version.</p>
|
||||
<p>A default constructor is provided for each form, which initializes each component to the default values for their type (<cite>i.e.</cite> zero for floating numbers). This constructor can also accept one to four base type arguments. A constructor is also provided to build quaternions from one or two complex numbers sharing the same base type. The unspecialized template also sports a templarized copy constructor, while the specialized forms have copy constructors from the other two specializations, which are explicit when a risk of precision loss exists. For the unspecialized form, the base type's constructors must not throw.</p>
|
||||
<p>Destructors and untemplated copy constructors (from the same type) are provided by the compiler. Converting copy constructors make use of a templated helper function in a "detail" subnamespace.</p>
|
||||
</blockquote>
|
||||
<h3><a name="Other member functions"></a>Other member functions</h3>
|
||||
<pre><code>T <strong>real</strong>() const;
|
||||
quaternion<T> <strong>unreal</strong>() const;</code></pre>
|
||||
<blockquote>
|
||||
<p>Like complex number, quaternions do have a meaningful notion of "real part", but unlike them there is no meaningful notion of "imaginary part". Instead there is an "unreal part" which itself is a quaternion, and usually nothing simpler (as opposed to the complex number case). These are returned by the first two functions.</p>
|
||||
</blockquote>
|
||||
<pre><code>T <strong>R_component_1</strong>() const;
|
||||
T <strong>R_component_2</strong>() const;
|
||||
T <strong>R_component_3</strong>() const;
|
||||
T <strong>R_component_4</strong>() const;</code></pre>
|
||||
<blockquote>
|
||||
<p>A quaternion having four real components, these are returned by these four functions. Hence <code>real</code> and <code>R_component_1</code> return the same value.</p>
|
||||
</blockquote>
|
||||
<pre><code>::std::complex<T> <strong>C_component_1</strong>() const;
|
||||
::std::complex<T> <strong>C_component_2</strong>() const;</code></pre>
|
||||
<blockquote>
|
||||
<p>A quaternion likewise has two complex components, and as we have seen above, <font color="#000000">for any quaternion <img src="graphics/quaternion_blurb22.jpeg" width="107" height="14" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> we also have <img src="graphics/quaternion_blurb23.jpeg" width="115" height="16" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font> These functions return them. The real part of <code>q.C_component_1()</code> is the same as <code>q.real()</code>.</p>
|
||||
</blockquote>
|
||||
<h2><a name="quaternion member operators"></a><code>quaternion</code> member operators</h2>
|
||||
<h3><a name="Assignment operators"></a>Assignment operators</h3>
|
||||
<pre><code>quaternion<T> & <strong>operator =</strong> (quaternion<T> const & a_affecter);
|
||||
template<typename X> quaternion<T> & <strong>operator =</strong> (quaternion<X> const & a_affecter);
|
||||
quaternion<T> & <strong>operator =</strong> (T const & a_affecter);
|
||||
quaternion<T> & <strong>operator =</strong> (::std::complex<T> const & a_affecter);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the expected assignment, with type modification if necessary (for instance, assigning from a base type will set the real part to that value, and all other components to zero). For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<h3><a name="Other member operators"></a>Other member operators</h3>
|
||||
<pre><code>quaternion<T> & <strong>operator +=</strong> (T const & rhs)
|
||||
quaternion<T> & <strong>operator +=</strong> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <strong>operator +=</strong> (quaternion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)+rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<pre><code>quaternion<T> & <strong>operator -=</strong> (T const & rhs)
|
||||
quaternion<T> & <strong>operator -=</strong> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <strong>operator -=</strong> (quaternion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)-rhs and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<pre><code>quaternion<T> & <strong>operator *=</strong> (T const & rhs)
|
||||
quaternion<T> & <strong>operator *=</strong> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <strong>operator *=</strong> (quaternion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)*rhs <strong>in this order</strong> (order is important as multiplication is not commutative for quaternions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<pre><code>quaternion<T> & <strong>operator /=</strong> (T const & rhs)
|
||||
quaternion<T> & <strong>operator /=</strong> (::std::complex<T> const & rhs);
|
||||
template<typename X> quaternion<T> & <strong>operator /=</strong> (quaternion<X> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These perform the mathematical operation (*this)*inverse_of(rhs) <strong>in this order</strong> (order is important as multiplication is not commutative for quaternions) and store the result in *this. The unspecialized form has exception guards, which the specialized forms do not, so as to insure exception safety. For the unspecialized form, the base type's assignment operators must not throw.</p>
|
||||
</blockquote>
|
||||
<h2><a name="quaternion non-member operations"></a><code>quaternion</code> non-member operations</h2>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>operator +</strong> (quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>This unary operator simply returns <code>q</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>operator -</strong> (quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>This unary operator returns the opposite of <code>q</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>operator +</strong> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator +</strong> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator +</strong> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator +</strong> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator +</strong> (quaternion<T> const & lhs, quaternion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>quaternion<T>(lhs) += rhs</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>operator -</strong> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator -</strong> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator -</strong> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator -</strong> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator -</strong> (quaternion<T> const & lhs, quaternion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>quaternion<T>(lhs) -= rhs</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>operator *</strong> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator *</strong> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator *</strong> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator *</strong> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator *</strong> (quaternion<T> const & lhs, quaternion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>quaternion<T>(lhs) *= rhs</code>.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>operator /</strong> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator /</strong> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator /</strong> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator /</strong> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline quaternion<T> <strong>operator /</strong> (quaternion<T> const & lhs, quaternion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These operators return <code>quaternion<T>(lhs) /= rhs</code>. It is of course still an error to divide by zero...</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline bool <strong>operator ==</strong> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator ==</strong> (quaternion<T> const & lhs, quaternion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These return <code>true</code> if and only if the four components of <code>quaternion<T>(lhs)</code> are equal to their counterparts in <code>quaternion<T>(rhs)</code>. As with any floating-type entity, this is essentially meaningless.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline bool <strong>operator !=</strong> (T const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (quaternion<T> const & lhs, T const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (::std::complex<T> const & lhs, quaternion<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (quaternion<T> const & lhs, ::std::complex<T> const & rhs);
|
||||
template<typename T> inline bool <strong>operator !=</strong> (quaternion<T> const & lhs, quaternion<T> const & rhs);</code></pre>
|
||||
<blockquote>
|
||||
<p>These return <code>true</code> if and only if <code>quaternion<T>(lhs) == quaternion<T>(rhs)</code> is <code>false</code>. As with any floating-type entity, this is essentially meaningless.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T, typename charT, class traits>
|
||||
::std::basic_istream<charT,traits> & <strong>operator >></strong> (::std::basic_istream<charT,traits> & is, quaternion<T> & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Extracts a quaternion <code>q</code> of one of the following forms (with a, b, c and d of type <code>T</code>):</p>
|
||||
<p>
|
||||
a
|
||||
(a), (a,b), (a,b,c), (a,b,c,d)
|
||||
(a,(c)), (a,(c,d)), ((a)), ((a),c), ((a),(c)), ((a),(c,d)), ((a,b)), ((a,b),c), ((a,b),(c)), ((a,b),(c,d))</p>
|
||||
<p>The input values must be convertible to T. If bad input is encountered, calls is.setstate(ios::failbit) (which may throw ios::failure (27.4.5.3)).</p>
|
||||
<p>Returns <code>is</code>.</p>
|
||||
<p>The rationale for the list of accepted formats is that either we have a list of up to four reals, or else we have a couple of complex numbers, and in that case if it formated as a proper complex number, then it should be accepted. Thus potential ambiguities are lifted (for instance (a,b) is (a,b,0,0) and not (a,0,b,0), <cite>i.e.</cite> it is parsed as a list of two real numbers and not two complex numbers which happen to have imaginary parts equal to zero).</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T, typename charT, class traits>
|
||||
::std::basic_ostream<charT,traits> & <strong>operator <<</strong> (::std::basic_ostream<charT,traits> & os, quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Inserts the quaternion <code>q</code> onto the stream <code>os</code> as if it were implemented as follows:</p>
|
||||
</blockquote>
|
||||
<pre><code> template<typename T, typename charT, class traits>
|
||||
::std::basic_ostream<charT,traits> & operator << ( ::std::basic_ostream<charT,traits> & os,
|
||||
quaternion<T> const & q)
|
||||
{
|
||||
::std::basic_ostringstream<charT,traits> s;
|
||||
|
||||
s.flags(os.flags());
|
||||
s.imbue(os.getloc());
|
||||
s.precision(os.precision());
|
||||
|
||||
s << '(' << q.R_component_1() << ','
|
||||
<< q.R_component_2() << ','
|
||||
<< q.R_component_3() << ','
|
||||
<< q.R_component_4() << ')';
|
||||
|
||||
return os << s.str();
|
||||
}</code></pre>
|
||||
<h2><a name="quaternion value operations"></a><code>quaternion</code> value operations</h2>
|
||||
<pre><code>template<typename T> inline T <strong>real</strong>(quaternion<T> const & q);
|
||||
template<typename T> inline quaternion<T> <strong>unreal</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>These return <code>q.real()</code> and <code>q.unreal()</code> respectively.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>conj</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>This returns the conjugate of the quaternion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>sup</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the sup norm (the greatest among <code>abs(q.R_component_1())</code>...<code>abs(q.R_component_4())</code>) of the quaternion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>l1</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the l1 norm (<code>abs(q.R_component_1())+...+abs(q.R_component_4())</code>) of the quaternion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>abs</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the magnitude (Euclidian norm) of the quaternion.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline T <strong>norm</strong>(quaternion<T>const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>This return the (Cayley) norm of the quaternion. The term "norm" might be confusing, as most people associate it with the Euclidian norm (and quadratic functionals). For this version of (the mathematical objects known as) quaternions, the Euclidian norm (also known as magnitude) is the square root of the Cayley norm.</p>
|
||||
</blockquote>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>spherical</strong>(T const & rho, T const & theta, T const & phi1, T const & phi2);
|
||||
template<typename T> inline quaternion<T> <strong>semipolar</strong>(T const & rho, T const & alpha, T const & theta1, T const & theta2);
|
||||
template<typename T> inline quaternion<T> <strong>multipolar</strong>(T const & rho1, T const & theta1, T const & rho2, T const & theta2);
|
||||
template<typename T> inline quaternion<T> <strong>cylindrospherical</strong>(T const & t, T const & radius, T const & longitude, T const & latitude);
|
||||
template<typename T> inline quaternion<T> <strong>cylindrical</strong>(T const & r, T const & angle, T const & h1, T const & h2);</code></pre>
|
||||
<blockquote>
|
||||
<p>These build quaternions in a way similar to the way <code>polar</code> builds complex numbers, as there is no strict equivalent to polar coordinates for quaternions.</p>
|
||||
<p><code>spherical</code> is a simple transposition of <code>polar</code>, it takes as inputs a (positive) magnitude and a point on the hypersphere, given by three angles. The first of these, <code>theta</code> has a natural range of -pi to +pi, and the other two have natural ranges of -pi/2 to +pi/2 (as is the case with the usual spherical coordinates in R^3). Due to the many symmetries and periodicities, nothing untoward happens if the magnitude is negative or the angles are outside their natural ranges. The expected degeneracies (a magnitude of zero ignores the angles settings...) do happen however.</p>
|
||||
<p><code>cylindrical</code> is likewise a simple transposition of the usual cylindrical coordinates in R^3, which in turn is another derivative of planar polar coordinates. The first two inputs are the polar coordinates of the first C component of the quaternion. The third and fourth inputs are placed into the third and fourth R components of the quaternion, respectively.</p>
|
||||
<p><code>multipolar</code> is yet another simple generalization of polar coordinates. This time, both C components of the quaternion are given in polar coordinates.</p>
|
||||
<p><code>cylindrospherical</code> is specific to quaternions. It is often interesting to consider H as the cartesian product of R by R^3 (the quaternionic multiplication as then a special form, as given here). This function therefore builds a quaternion from this representation, with the R^3 component given in usual R^3 spherical coordinates.</p>
|
||||
<p><code>semipolar</code> is another generator which is specific to quaternions. It takes as a first input the magnitude of the quaternion, as a second input an angle in the range 0 to +pi/2 such that magnitudes of the first two C components of the quaternion are the product of the first input and the sine and cosine of this angle, respectively, and finally as third and fourth inputs angles in the range -pi/2 to +pi/2 which represent the arguments of the first and second C components of the quaternion, respectively. As usual, nothing untoward happens if what should be magnitudes are negative numbers or angles are out of their natural ranges, as symmetries and periodicities kick in.</p>
|
||||
</blockquote>
|
||||
<p>In this version of our implementation of quaternions, there is no analogue of the complex value operation <code>arg</code> as the situation is somewhat more complicated. Unit quaternions are linked both to rotations in R^3 and in R^4, and the correspondences are not too complicated, but there is currently a lack of standard (<cite>de facto</cite> or <cite>de jure</cite>) matrix library with which the conversions could work. This should be remedied in a further revision. In the mean time, an example of how this could be done is presented here <a href="HSO3.hpp">for R^3</a>, and here <a href="HSO4.hpp">for R^4</a> (<a href="HSO3SO4.cpp">example</a> test file).</p>
|
||||
<h2><a name="quaternion transcendentals"></a><code>quaternion</code> transcendentals</h2>
|
||||
<p>There is no <code>log</code> or <code>sqrt</code> provided for quaternions in this implementation, and <code>pow</code> is likewise restricted to integral powers of the exponent. There are several reasons to this: on the one hand, the equivalent of analytic continuation for quaternions ("branch cuts") remains to be investigated thoroughly (by me, at any rate...), and we wish to avoid the nonsense introduced in the standard by exponentiations of complexes by complexes (which is well defined, but not in the standard...). Talking of nonsense, saying that <code>pow(0,0)</code> is "implementation defined" is just plain brain-dead...</p>
|
||||
<p>We do, however provide several transcendentals, chief among which is the exponential. This author claims the complete proof of the "closed formula" as his own, as well as its independant invention (there are claims to prior invention of the formula, such as one by Professor Shoemake, and it is possible that the formula had been known a couple of centuries back, but in absence of bibliographical reference, the matter is pending, awaiting further investigation; on the other hand, the definition and existence of the exponential on the quaternions, is of course a fact known for a very long time). Basically, any converging power series with real coefficients which allows for a closed formula in C can be transposed to H. More transcendentals of this type could be added in a further revision upon request. It should be noted that it is these functions which force the dependency upon the <a href="../../../boost/math/special_functions/sinc.hpp">boost/math/<code>special_functions/sinc.hpp</code></a> and the <a href="../../../boost/math/special_functions/sinhc.hpp">boost/math/<code>special_functions/sinhc.hpp</code></a> headers.</p>
|
||||
<h3><a name="exp"></a>exp</h3>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>exp</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the exponential of the quaternion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="cos"></a>cos</h3>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>cos</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the cosine of the quaternion</p>
|
||||
</blockquote>
|
||||
<h3><a name="sin"></a>sin</h3>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>sin</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the sine of the quaternion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="tan"></a>tan</h3>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>tan</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the tangent of the quaternion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="cosh"></a>cosh</h3>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>cosh</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the hyperbolic cosine of the quaternion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="sinh"></a>sinh</h3>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>sinh</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the hyperbolic sine of the quaternion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="tanh"></a>tanh</h3>
|
||||
<pre><code>template<typename T> inline quaternion<T> <strong>tanh</strong>(quaternion<T> const & q);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the hyperbolic tangent of the quaternion.</p>
|
||||
</blockquote>
|
||||
<h3><a name="pow"></a>pow</h3>
|
||||
<pre><code>template<typename T> quaternion<T> <strong>pow</strong>(quaternion<T> const & q, int n);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the <code>n</code>-th power of the quaternion <code>q</code>.</p>
|
||||
</blockquote>
|
||||
<h2><a name="History"></a>History</h2>
|
||||
<ul>
|
||||
<li>1.5.7 - 24/02/2003: transitionned to the unit test framework; <boost/config.hpp> now included by the library header (rather than the test files).
|
||||
<li>1.5.6 - 15/10/2002: Gcc2.95.x and stlport on linux compatibility by Alkis Evlogimenos (alkis@routescience.com).
|
||||
<li>1.5.5 - 27/09/2002: Microsoft VCPP 7 compatibility, by Michael Stevens (michael@acfr.usyd.edu.au); requires the /Za compiler option.
|
||||
<li>1.5.4 - 19/09/2002: fixed problem with multiple inclusion (in different translation units); attempt at an improved compatibility with Microsoft compilers, by Michael Stevens (michael@acfr.usyd.edu.au) and Fredrik Blomqvist; other compatibility fixes.
|
||||
<li>1.5.3 - 01/02/2002: bugfix and Gcc 2.95.3 compatibility by Douglas Gregor (gregod@cs.rpi.edu).
|
||||
<li>1.5.2 - 07/07/2001: introduced <code>namespace math</code>.
|
||||
<li>1.5.1 - 07/06/2001: (end of Boost review) now includes <code><boost/math/special_functions/sinc.hpp></code> and <code><boost/math/special_functions/sinhc.hpp></code> instead of <code><boost/special_functions.hpp></code>; corrected bug in <code>sin</code> (Daryle Walker); removed check for self-assignment (Gary Powel); made converting functions <code>explicit</code> (Gary Powel); added overflow guards for division operators and <code>abs</code> (Peter Schmitteckert); added <code>sup</code> and <code>l1</code>; used Vesa Karvonen's CPP metaprograming technique to simplify code.
|
||||
<li>1.5.0 - 26/03/2001: boostification, inlining of all operators except input, output and <code>pow</code>, fixed exception safety of some members (template version) and output operator, added <code>spherical</code>, <code>semipolar</code>, <code>multipolar</code>, <code>cylindrospherical</code> and <code>cylindrical</code>.
|
||||
<li>1.4.0 - 09/01/2001: added <code>tan</code> and <code>tanh</code>. <li>1.3.1 - 08/01/2001: cosmetic fixes.
|
||||
<li>1.3.0 - 12/07/2000: <code>pow</code> now uses Maarten Hilferink's (mhilferink@tip.nl) algorithm. <li>1.2.0 - 25/05/2000: fixed the division operators and output; changed many signatures.
|
||||
<li>1.1.0 - 23/05/2000: changed <code>sinc</code> into <code>sinc_pi</code>; added <code>sin</code>, <code>cos</code>, <code>sinh</code>, <code>cosh</code>.
|
||||
<li>1.0.0 - 10/08/1999: first public version.
|
||||
</ul>
|
||||
<h2><a name="ToDo"></a>To Do</h2>
|
||||
<ul>
|
||||
<li>Improve testing.
|
||||
<li>Rewrite input operatore using Spirit (creates a dependency).
|
||||
<li>Put in place an Expression Template mechanism (perhaps borrowing from uBlas).
|
||||
<li>Use uBlas for the link with rotations (and move from the <a href="HSO3SO4.cpp">example</a> implementation to an efficient one).
|
||||
</ul>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->24 Feb 2003<!--webbot bot="Timestamp" endspan i-checksum="18778" --></p>
|
||||
<p>© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,60 +0,0 @@
|
||||
<html>
|
||||
|
||||
|
||||
|
||||
<head>
|
||||
|
||||
<title>Boost Special Functions library</title>
|
||||
<meta http-equiv="generator" content="Adobe GoLive 5">
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
|
||||
|
||||
|
||||
<table border="1" bgcolor="#007F7F" cellpadding="2">
|
||||
|
||||
<tr>
|
||||
|
||||
<td bgcolor="#FFFFFF"><img src="../../../boost.png" alt="boost.png (6897 bytes)" WIDTH="277" HEIGHT="86"></td>
|
||||
|
||||
<td><a href="../../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home </big></font></a></td>
|
||||
|
||||
<td><a href="../../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries </big></font></a></td>
|
||||
|
||||
<td><a href="../../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People </big></font></a></td>
|
||||
|
||||
<td><a href="../../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ </big></font></a></td>
|
||||
|
||||
<td><a href="../../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More </big></font></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h2>Special Functions library</h2>
|
||||
<p>The Special Functions library is a stop-gap collection of numerical functions, some of which are needed for our implementation of <a href="../quaternion/index.html">quaternions</a> and <a href="../octonion/index.html">octonions</a>.
|
||||
<ul>
|
||||
<li><a href="special_functions.html">Documentation</a></li>
|
||||
<li>Header <a href="../../../boost/math/special_functions/acosh.hpp">acosh.hpp</a>
|
||||
<li>Header <a href="../../../boost/math/special_functions/asinh.hpp">asinh.hpp</a>
|
||||
<li>Header <a href="../../../boost/math/special_functions/atanh.hpp">atanh.hpp</a>
|
||||
<li>Header <a href="../../../boost/math/special_functions/sinc.hpp">sinc.hpp</a>
|
||||
<li>Header <a href="../../../boost/math/special_functions/sinhc.hpp">sinhc.hpp</a>
|
||||
<li>Test program <a href="special_functions_test.cpp">special_functions_test.cpp</a></li>
|
||||
<li>Submitted by Hubert Holin and Eric Ford.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %b %Y" startspan -->03 Feb 2003<!--webbot bot="Timestamp" endspan i-checksum="14992" -->
|
||||
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
<meta name="generator" content="Adobe GoLive 6">
|
||||
<title>Inverse Hyperbolic Functions</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)" align="center" width="277" height="86">Special Functions library</h1>
|
||||
<div align="center">
|
||||
<h2>(inverse hyperbolic functions)</h2>
|
||||
</div>
|
||||
<p>The exponential funtion is defined, for all object for which this makes sense, as the power series <img src="graphics/special_functions_blurb1.jpeg" width="75" height="32" naturalsizeflag="3" align=absmiddle><font color="#000000">, with <img src="graphics/special_functions_blurb2.jpeg" width="83" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> (and <img src="graphics/special_functions_blurb3.jpeg" width="26" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> by definition) being the factorial of <img src="graphics/special_functions_blurb4.jpeg" width="9" height="9" naturalsizeflag="3" align=absmiddle></font><font color="#000000">. In particular, the exponential function is well defined for real numbers, complex number, quaternions, octonions, and matrices of complex numbers, among others.</font></p>
|
||||
<div align="center">
|
||||
<p><img src="graphics/exp_on_R.png" width="502" height="330" border="0"></p>
|
||||
<p><samp>Graph of exp on R</samp></p>
|
||||
</div>
|
||||
<p></p>
|
||||
<div align="center">
|
||||
<p><img src="graphics/Re_exp_on_C.png" width="374" height="249" border="0"><img src="graphics/Im_exp_on_C.png" width="374" height="249" border="0"></p>
|
||||
<p><samp>Real and Imaginary parts of exp on C</samp></p>
|
||||
</div>
|
||||
<p></p>
|
||||
<p><font color="#000000">The hyperbolic functions are defined as power series which can be computed (for reals, complex, quaternions and octonions) as:</font></p>
|
||||
<p><font color="#000000"> </font></p>
|
||||
<p><font color="#000000">Hyperbolic cosine: <img src="graphics/special_functions_blurb5.jpeg" width="144" height="29" naturalsizeflag="3" align=absmiddle></font></p>
|
||||
<p><font color="#000000">Hyperbolic sine: <img src="graphics/special_functions_blurb6.jpeg" width="142" height="29" naturalsizeflag="3" align=absmiddle></font></p>
|
||||
<p><font color="#000000">Hyperbolic tangent: <img src="graphics/special_functions_blurb7.jpeg" width="90" height="32" naturalsizeflag="3" align=absmiddle></font></p>
|
||||
<p></p>
|
||||
<div align="center">
|
||||
<p><font color="#000000"> <img src="graphics/trigonometric.png" width="502" height="330" border="0"></font></p>
|
||||
<p><samp>Trigonometric functions on R (cos: purple; sin: red; tan: blue)</samp></p>
|
||||
<p><img src="graphics/hyperbolic.png" width="502" height="330" border="0"></p>
|
||||
<p><samp>Hyperbolic functions on r (cosh: purple; sinh: red; tanh: blue)</samp></p>
|
||||
</div>
|
||||
<p></p>
|
||||
<p><font color="#000000">The hyperbolic sine is one to one on the set of real numbers, with range the full set of reals, while the hyperbolic tangent is also one to one on the set of real numbers but with range <img src="graphics/special_functions_blurb8.jpeg" width="46" height="16" naturalsizeflag="3" align=absmiddle></font><font color="#000000">, and therefore both have inverses. The hyperbolic cosine is one to one from <img src="graphics/special_functions_blurb9.jpeg" width="35" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> onto <img src="graphics/special_functions_blurb10.jpeg" width="41" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> (and from <img src="graphics/special_functions_blurb11.jpeg" width="35" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> onto <img src="graphics/special_functions_blurb12.jpeg" width="41" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000">); the inverse function we use here is defined on <img src="graphics/special_functions_blurb13.jpeg" width="41" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000"> with range <img src="graphics/special_functions_blurb14.jpeg" width="35" height="15" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
<p><font color="#000000">The inverse of the hyperbolic tangent is called the Argument hyperbolic tangent, and can be computed as <img src="graphics/special_functions_blurb15.jpeg" width="109" height="44" naturalsizeflag="3" align=absbottom></font><font color="#000000">.</font></p>
|
||||
<p><font color="#000000">The inverse of the hyperbolic sine is called the Argument hyperbolic sine, and can be computed (for <img src="graphics/special_functions_blurb16.jpeg" width="28" height="12" naturalsizeflag="3" align=absmiddle></font><font color="#000000">) as <img src="graphics/special_functions_blurb17.jpeg" width="133" height="24" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
<p><font color="#000000">The inverse of the hyperbolic cosine is called the Argument hyperbolic cosine, and can be computed as <img src="graphics/special_functions_blurb18.jpeg" width="133" height="24" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->03 Feb 2003<!--webbot bot="Timestamp" endspan i-checksum="18765" --></p>
|
||||
<p>© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,29 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
<meta name="generator" content="Adobe GoLive 6">
|
||||
<title>Sinus Cardinal and Hyperbolic Sinus Cardinal Functions</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)" align="center" width="277" height="86">Special Functions library</h1>
|
||||
<div align="center">
|
||||
<h2>(Sinus Cardinal and Hyperbolic Sinus Cardinal functions)</h2>
|
||||
</div>
|
||||
<p>The Sinus Cardinal <font color="#000000">family of functions (indexed by the family of indices <img src="graphics/special_functions_blurb19.jpeg" width="27" height="12" naturalsizeflag="3" align=absmiddle>) is defined by <img src="graphics/special_functions_blurb20.jpeg" width="99" height="58" naturalsizeflag="3" align=absmiddle>; it </font>sees heavy use in signal processing tasks.</p>
|
||||
<p><font color="#000000">By analogy, the Hyperbolic Sinus Cardinal family of functions (also indexed by the family of indices <img src="graphics/special_functions_blurb19.jpeg" width="27" height="12" naturalsizeflag="3" align=absmiddle>) is defined </font><font color="#000000">by <img src="graphics/special_functions_blurb22.jpeg" width="111" height="58" naturalsizeflag="3" align=absmiddle></font><font color="#000000">.</font></p>
|
||||
<p><font color="#000000">These two families of functions are composed of entire functions.</font></p>
|
||||
<div align="center">
|
||||
<p><img src="graphics/sinc_pi_and_sinhc_pi_on_R.png" width="502" height="330" border="0"></p>
|
||||
<p><samp>Sinus Cardinal of index pi (purple) and Hyperbolic Sinus Cardinal of index pi (red) on R</samp></p>
|
||||
</div>
|
||||
<p></p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->18 Aug 2004<!--webbot bot="Timestamp" endspan i-checksum="18765" --></p>
|
||||
<p>© Copyright Hubert Holin 2001-2004. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,118 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Special Functions Documentation</title>
|
||||
<meta http-equiv="generator" content="Adobe GoLive 5">
|
||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)" align="center" width="277" height="86">Special Functions library</h1>
|
||||
<ul>
|
||||
<li><a href="#Acknowledgements">Acknowledgements</a>
|
||||
<li><a href="#Header File">Header Files</a>
|
||||
<li><a href="#Test Program">Test Program</a>
|
||||
<li><a href="#Synopsis">Synopsis</a>
|
||||
<li><a href="#Functions">Functions</a>
|
||||
<li><a href="#History">History</a>
|
||||
<li><a href="#ToDo">To Do</a>
|
||||
</ul>
|
||||
<p>The Special Functions library currently provides five templated special functions, in namespace boost. Two of these (<a href="sinc_sinhc.html"><code>sinc_pi</code> and <code>sinhc_pi</code></a>) are needed by our implementation of quaternions and octonions.</p>
|
||||
<p>The functions <a href="inverse_hyperbolic.html"><code>acosh</code>, <code>asinh</code> and <code>atanh</code></a> are entirely classical, the function <code>sinc_pi</code> sees heavy use in signal processing tasks, and the function <code>sinhc_pi</code> is an <cite>ad'hoc</cite> function whose naming is modelled on <code>sinc_pi</code> and hyperbolic functions.</p>
|
||||
<h2><a name="Acknowledgements"></a>Acknowledgements</h2>
|
||||
<p>The mathematical text has been typeset with <a href="http://www.nisus-soft.com/">Nisus Writer</a>, and the illustrations have been made with <a href="http://www.pacifict.com/">Graphing Calculator</a>. Jens Maurer was the Review Manager for this library. More acknowledgements in the History section. Thank you to all who contributed to the discution about this library.</p>
|
||||
<h2><a name="Header File"></a>Header Files</h2>
|
||||
<p>The interface and implementation for each function (or forms of a function) are both supplied by one header file:</p>
|
||||
<ul>
|
||||
<li type="disc"><a href="../../../boost/math/special_functions/acosh.hpp">acosh.hpp</a>
|
||||
<li type="disc"><a href="../../../boost/math/special_functions/asinh.hpp">asinh.hpp</a>
|
||||
<li type="disc"><a href="../../../boost/math/special_functions/atanh.hpp">atahn.hpp</a>
|
||||
<li type="disc"><a href="../../../boost/math/special_functions/sinc.hpp">sinc.hpp</a>
|
||||
<li type="disc"><a href="../../../boost/math/special_functions/sinhc.hpp">sinhc.hpp</a>
|
||||
</ul>
|
||||
<h2><a name="Test Program"></a>Test Program</h2>
|
||||
<p>The <a href="special_functions_test.cpp">special_functions_test.cpp</a> test program tests the functions for float, double and long double arguments (<a href="output.txt">sample output</a>, with message output enabled).</p>
|
||||
<p>If you define the symbol BOOST_SPECIAL_FUNCTIONS_TEST_VERBOSE, you will get additional output (<a href="output_more.txt">verbose output</a>), which may prove useful for tuning on your platform (the library use "reasonable" tolerances, which may prove to be too strict for your platform); this will only be helpfull if you enable message output at the same time, of course (by uncommenting the relevant line in the test or by adding --log_level=messages to your command line,...).</p>
|
||||
<h2><a name="Synopsis"></a>Synopsis</h2>
|
||||
<pre><code>namespace boost
|
||||
{
|
||||
|
||||
namespace math
|
||||
{
|
||||
|
||||
template<typename T> inline T <a href="#acosh">acosh</a>(const T x);
|
||||
|
||||
template<typename T> inline T <a href="#asinh">asinh</a>(const T x);
|
||||
|
||||
template<typename T> inline T <a href="#atanh">atanh</a>(const T x);
|
||||
|
||||
template<typename T> inline T <a href="#sinc_pi">sinc_pi</a>(const T x);
|
||||
|
||||
template<typename T, template<typename> class U> inline U<T> <a href="#sinc_pi">sinc_pi</a>(const U<T> x);
|
||||
|
||||
template<typename T> inline T <a href="#sinhc_pi">sinhc_pi</a>(const T x);
|
||||
|
||||
template<typename T, template<typename> class U> inline U<T> <a href="#sinhc_pi">sinhc_pi</a>(const U<T> x);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}</code></pre>
|
||||
<h2><a name="Functions"></a>Functions</h2>
|
||||
<p>The functions implemented here can throw standard exceptions, but no exception specification has been made.</p>
|
||||
<h3><a name="acosh"></a>acosh</h3>
|
||||
<pre><code>template<typename T> inline T <strong>acosh</strong>(const T x);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the reciprocal of (the restriction to the range <IMG SRC="graphics/special_functions_blurb29.jpeg" WIDTH="35" HEIGHT="15" NATURALSIZEFLAG="3" ALIGN=absmiddle> of) the hyperbolic cosine function, at <code>x</code>. Values returned are positive. Generalised Taylor series are used near 1 and Laurent series are used near the infinity to ensure accuracy.</p>
|
||||
<p>If <code>x</code> is in the range <IMG SRC="graphics/special_functions_blurb27.jpeg" WIDTH="41" HEIGHT="15" NATURALSIZEFLAG="3" ALIGN=absmiddle> a quiet NaN is returned (if the system allows, otherwise a <code>domain_error</code> exception is generated).</p>
|
||||
</blockquote>
|
||||
<h3><a name="asinh"></a>asinh</h3>
|
||||
<pre><code>template<typename T> inline T <strong>asinh</strong>(const T x);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the reciprocal of the hyperbolic sine function. Taylor series are used at the origin and Laurent series are used near the infinity to ensure accuracy.</p>
|
||||
</blockquote>
|
||||
<h3><a name="atanh"></a>atanh</h3>
|
||||
<pre><code>template<typename T> inline T <strong>atanh</strong>(const T x);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the reciprocal of the hyperbolic tangent function, at <code>x</code>. Taylor series are used at the origin to ensure accuracy.</p>
|
||||
<p>If <code>x</code> is in the range <IMG SRC="graphics/special_functions_blurb25.jpeg" WIDTH="41" HEIGHT="15" NATURALSIZEFLAG="3" ALIGN=absmiddle> or in the range <IMG SRC="graphics/special_functions_blurb26.jpeg" WIDTH="41" HEIGHT="15" NATURALSIZEFLAG="3" ALIGN=absmiddle> a quiet NaN is returned (if the system allows, otherwise a <code>domain_error</code> exception is generated).</p>
|
||||
<p>If <code>x</code> is in the range <IMG SRC="graphics/special_functions_blurb23.jpeg" WIDTH="55" HEIGHT="15" NATURALSIZEFLAG="3" ALIGN=absmiddle> , minus infinity is returned (if the system allows, otherwise an <code>out_of_range</code> exception is generated), with <img src="graphics/special_functions_blurb28.jpeg" width="9" height="9" naturalsizeflag="3" align=absmiddle> denoting <code>numeric_limits<T>::epsilon()</code>.</p>
|
||||
<p>If <code>x</code> is in the range <IMG SRC="graphics/special_functions_blurb24.jpeg" WIDTH="55" HEIGHT="15" NATURALSIZEFLAG="3" ALIGN=absmiddle> , plus infinity is returned (if the system allows, otherwise an <code>out_of_range</code> exception is generated), with <img src="graphics/special_functions_blurb28.jpeg" width="9" height="9" naturalsizeflag="3" align=absmiddle> denoting <code>numeric_limits<T>::epsilon()</code>.</p>
|
||||
</blockquote>
|
||||
<h3><a name="sinc_pi"></a>sinc_pi</h3>
|
||||
<pre><code>template<typename T> inline T <strong>sinc_pi</strong>(const T x);</code></pre>
|
||||
<pre><code>template<typename T, template<typename> class U> inline U<T> <strong>sinc_pi</strong>(const U<T> x);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the Sinus Cardinal of <code>x</code>. The second form is for complexes, quaternions, octonions... Taylor series are used at the origin to ensure accuracy.</p>
|
||||
</blockquote>
|
||||
<h3><a name="sinhc_pi"></a>sinhc_pi</h3>
|
||||
<pre><code>template<typename T> inline T <strong>sinhc_pi</strong>(const T x);</code></pre>
|
||||
<pre><code>template<typename T, template<typename> class U> inline U<T> <strong>sinhc_pi</strong>(const U<T> x);</code></pre>
|
||||
<blockquote>
|
||||
<p>Computes the Hyperbolic Sinus Cardinal of <code>x</code>. The second form is for complexes, quaternions, octonions... Taylor series are used at the origin to ensure accuracy.</p>
|
||||
</blockquote>
|
||||
<h2><a name="History"></a>History</h2>
|
||||
<ul>
|
||||
<li>1.4.2 - 03/02/2003: transitionned to the unit test framework; <boost/config.hpp> now included by the library headers (rather than the test files).
|
||||
<li>1.4.1 - 18/09/2002: improved compatibility with Microsoft compilers.
|
||||
<li>1.4.0 - 14/09/2001: added (after rewrite) <code>acosh</code> and <code>asinh</code>, which were submited by Eric Ford; applied changes for Gcc 2.9.x suggested by John Maddock; improved accuracy; sanity check for test file, related to accuracy.
|
||||
<li>1.3.2 - 07/07/2001: introduced <code>namespace math</code>.
|
||||
<li>1.3.1 - 07/06/2001:(end of Boost review) split <code>special_functions.hpp</code> into <code>atanh.hpp</code>, <code>sinc.hpp</code> and <code>sinhc.hpp</code>; improved efficiency of <code>atanh</code> with compile-time technique (Daryle Walker); improved accuracy of all functions near zero (Peter Schmitteckert).
|
||||
<li>1.3.0 - 26/03/2001: support for complexes & all, for cardinal functions.
|
||||
<li>1.2.0 - 31/01/2001: minor modifications for Koenig lookup.
|
||||
<li>1.1.0 - 23/01/2001: boostification.
|
||||
<li>1.0.0 - 10/08/1999: first public version.
|
||||
</ul>
|
||||
<h2><a name="ToDo"></a>To Do</h2>
|
||||
<ul>
|
||||
<li>Add more functions.
|
||||
<li>Improve test of each function.
|
||||
</ul>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->06 Feb 2003<!--webbot bot="Timestamp" endspan i-checksum="18765" --></p>
|
||||
<p>© Copyright Hubert Holin 2001-2003. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user