1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Namespaces</title>
<link rel="stylesheet" href="../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Math Toolkit 4.2.1">
<link rel="up" href="../overview.html" title="Chapter 1. Overview">
<link rel="prev" href="directories.html" title="Directory and File Structure">
<link rel="next" href="standalone.html" title="Standalone Usage">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="directories.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="standalone.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="math_toolkit.namespaces"></a><a class="link" href="namespaces.html" title="Namespaces">Namespaces</a>
</h2></div></div></div>
<p>
All math functions and distributions are in <code class="computeroutput"><span class="keyword">namespace</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span></code>.
</p>
<p>
So, for example, the Students-t distribution template in <code class="computeroutput"><span class="keyword">namespace</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span></code> is
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">></span> <span class="keyword">class</span> <span class="identifier">students_t_distribution</span>
</pre>
<p>
and can be instantiated with the help of the reserved name <code class="computeroutput"><span class="identifier">students_t</span></code>(for
<code class="computeroutput"><span class="identifier">RealType</span> <span class="keyword">double</span></code>)
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">students_t_distribution</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">students_t</span><span class="special">;</span>
<span class="identifier">student_t</span> <span class="identifier">mydist</span><span class="special">(</span><span class="number">10</span><span class="special">);</span>
</pre>
<div class="warning"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../doc/src/images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>
Some distribution names are also used in std random library, so to avoid
the risk of ambiguity it is better to make explicit using declarations, for
example: <code class="computeroutput"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">students_t_distribution</span></code>
</p></td></tr>
</table></div>
<p>
Functions not intended for use by applications are in <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">detail</span></code>.
</p>
<p>
Functions that may have more general use, like <code class="computeroutput"><span class="identifier">digits</span></code>
(significand), <code class="computeroutput"><span class="identifier">max_value</span></code>,
<code class="computeroutput"><span class="identifier">min_value</span></code> and <code class="computeroutput"><span class="identifier">epsilon</span></code> are in <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tools</span></code>.
</p>
<p>
<a class="link" href="../policy.html" title="Chapter 22. Policies: Controlling Precision, Error Handling etc">Policy</a> and configuration information is in <code class="computeroutput"><span class="keyword">namespace</span></code> <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">policies</span></code>.
</p>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
Many code snippets assume implicit namespace(s), for example, <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span></code> or
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span></code>.
</p></td></tr>
</table></div>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
Start your work from a copy of the example source code; links usually provided.
</p></td></tr>
</table></div>
</div>
<div class="copyright-footer">Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland,
Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno
Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde,
Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle
Walker and Xiaogang Zhang<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="directories.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="standalone.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|