8a165db0c0
2008-02-10 Benjamin Kosnik <bkoz@redhat.com> Convert documentation to DocBook. * doc/Makefile.am (doc-doxygen-html): Changed to doc-html-doxygen. (doc-doxygen-man): Changed to doc-man-doxygen. (doc-performance): Changed to doc-html-performance. (doc-xml-doxygen): New. (doc-xml-single): New. (doc-xml-validate): New. (doc-html): New. (doc-html-single): New. (doc-fo): New. (doc-pdf): New. (doc-pdf-fop-xml): New. (doc-pdf-fop-fo): New. (doc-pdf-xmlto): New. (doc-pdf-xmlroff): New. (doc-pdf-prince): New. * doc/xml: New directory. * doc/xml/authors.xml: New. * doc/xml/images: New directory. * doc/xml/images/confdeps.png: Add. * doc/xml/images/confdeps.dot: Add. * doc/xml/faq.xml: New. * doc/xml/api.xml: New. * doc/xml/gnu: New directory. * doc/xml/gnu/gpl-3.0.xml: New. * doc/xml/gnu/fdl-1.2.xml: New. * doc/xml/gnu/gpl-2.0.xml: New. * doc/xml/manual: New directory. * doc/xml/manual/mt_allocator.xml: New. * doc/xml/manual/allocator.xml: New. * doc/xml/manual/ctype.xml: New. * doc/xml/manual/numerics.xml: New. * doc/xml/manual/codecvt.xml: New. * doc/xml/manual/concurrency.xml: New. * doc/xml/manual/backwards_compatibility.xml: New. * doc/xml/manual/intro.xml: New. * doc/xml/manual/shared_ptr.xml: New. * doc/xml/manual/abi.xml: New. * doc/xml/manual/status_cxxtr1.xml: New. * doc/xml/manual/auto_ptr.xml: New. * doc/xml/manual/build.xml: New. * doc/xml/manual/internals.xml: New. * doc/xml/manual/parallel_mode.xml: New. * doc/xml/manual/status_cxx1998.xml: New. * doc/xml/manual/containers.xml: New. * doc/xml/manual/io.xml: New. * doc/xml/manual/appendix_porting.xml: New. * doc/xml/manual/utilities.xml: New. * doc/xml/manual/bitmap_allocator.xml: New. * doc/xml/manual/support.xml: New. * doc/xml/manual/configure.xml: New. * doc/xml/manual/build_hacking.xml: New. * doc/xml/manual/evolution.xml: New. * doc/xml/manual/using.xml: New. * doc/xml/manual/debug.xml: New. * doc/xml/manual/localization.xml: New. * doc/xml/manual/strings.xml: New. * doc/xml/manual/debug_mode.xml: New. * doc/xml/manual/locale.xml: New. * doc/xml/manual/extensions.xml: New. * doc/xml/manual/appendix_contributing.xml: New. * doc/xml/manual/messages.xml: New. * doc/xml/manual/diagnostics.xml: New. * doc/xml/manual/appendix_free.xml: New. * doc/xml/manual/algorithms.xml: New. * doc/xml/manual/iterators.xml: New. * doc/xml/manual/spine.xml: New. * doc/xml/manual/test.xml: New. * doc/xml/manual/status_cxx200x.xml: New. * doc/xml/spine.xml: New. * doc/xml/book.txml: New. Template file. * doc/xml/chapter.txml: Same. * doc/xml/class.txml: Same. * doc/doxygen/guide.html: Removed, integrated into other docs. * doc/doxygen/user.cfg.in: Clean up XML generation. * doc/doxygen/run_doxygen: Move to.. * scripts/run_doxygen: ...here. * configure: Regenerate. * Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * doc/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * libmath/Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * libsupc++/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * aclocal.m4: Regenerate. From-SVN: r132226
144 lines
5.7 KiB
XML
144 lines
5.7 KiB
XML
<?xml version='1.0'?>
|
|
<!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
|
|
[ ]>
|
|
|
|
<part id="manual.numerics" xreflabel="Numerics">
|
|
<?dbhtml filename="numerics.html"?>
|
|
|
|
<partinfo>
|
|
<keywordset>
|
|
<keyword>
|
|
ISO C++
|
|
</keyword>
|
|
<keyword>
|
|
library
|
|
</keyword>
|
|
</keywordset>
|
|
</partinfo>
|
|
|
|
<title>Numerics</title>
|
|
|
|
<!-- Chapter 01 : Complex -->
|
|
<chapter id="manual.numerics.complex" xreflabel="complex">
|
|
<title>Complex</title>
|
|
<para>
|
|
</para>
|
|
<sect1 id="numerics.complex.processing" xreflabel="complex Processing">
|
|
<title>complex Processing</title>
|
|
<para>
|
|
</para>
|
|
<para>Using <code>complex<></code> becomes even more comple- er, sorry,
|
|
<emphasis>complicated</emphasis>, with the not-quite-gratuitously-incompatible
|
|
addition of complex types to the C language. David Tribble has
|
|
compiled a list of C++98 and C99 conflict points; his description of
|
|
C's new type versus those of C++ and how to get them playing together
|
|
nicely is
|
|
<ulink url="http://david.tribble.com/text/cdiffs.htm#C99-complex">here</ulink>.
|
|
</para>
|
|
<para><code>complex<></code> is intended to be instantiated with a
|
|
floating-point type. As long as you meet that and some other basic
|
|
requirements, then the resulting instantiation has all of the usual
|
|
math operators defined, as well as definitions of <code>op<<</code>
|
|
and <code>op>></code> that work with iostreams: <code>op<<</code>
|
|
prints <code>(u,v)</code> and <code>op>></code> can read <code>u</code>,
|
|
<code>(u)</code>, and <code>(u,v)</code>.
|
|
</para>
|
|
|
|
</sect1>
|
|
</chapter>
|
|
|
|
<!-- Chapter 02 : Generalized Operations -->
|
|
<chapter id="manual.numerics.generalized_ops" xreflabel="Generalized Ops">
|
|
<title>Generalized Operations</title>
|
|
<para>
|
|
</para>
|
|
|
|
<para>There are four generalized functions in the <numeric> header
|
|
that follow the same conventions as those in <algorithm>. Each
|
|
of them is overloaded: one signature for common default operations,
|
|
and a second for fully general operations. Their names are
|
|
self-explanatory to anyone who works with numerics on a regular basis:
|
|
</para>
|
|
<itemizedlist>
|
|
<listitem><para><code>accumulate</code></para></listitem>
|
|
<listitem><para><code>inner_product</code></para></listitem>
|
|
<listitem><para><code>partial_sum</code></para></listitem>
|
|
<listitem><para><code>adjacent_difference</code></para></listitem>
|
|
</itemizedlist>
|
|
<para>Here is a simple example of the two forms of <code>accumulate</code>.
|
|
</para>
|
|
<programlisting>
|
|
int ar[50];
|
|
int someval = somefunction();
|
|
|
|
// ...initialize members of ar to something...
|
|
|
|
int sum = std::accumulate(ar,ar+50,0);
|
|
int sum_stuff = std::accumulate(ar,ar+50,someval);
|
|
int product = std::accumulate(ar,ar+50,1,std::multiplies<int>());
|
|
</programlisting>
|
|
<para>The first call adds all the members of the array, using zero as an
|
|
initial value for <code>sum</code>. The second does the same, but uses
|
|
<code>someval</code> as the starting value (thus, <code>sum_stuff == sum +
|
|
someval</code>). The final call uses the second of the two signatures,
|
|
and multiplies all the members of the array; here we must obviously
|
|
use 1 as a starting value instead of 0.
|
|
</para>
|
|
<para>The other three functions have similar dual-signature forms.
|
|
</para>
|
|
|
|
</chapter>
|
|
|
|
<!-- Chapter 03 : Interacting with C -->
|
|
<chapter id="manual.numerics.c" xreflabel="Interacting with C">
|
|
<title>Interacting with C</title>
|
|
|
|
<sect1 id="numerics.c.array" xreflabel="Numerics vs. Arrays">
|
|
<title>Numerics vs. Arrays</title>
|
|
|
|
<para>One of the major reasons why FORTRAN can chew through numbers so well
|
|
is that it is defined to be free of pointer aliasing, an assumption
|
|
that C89 is not allowed to make, and neither is C++98. C99 adds a new
|
|
keyword, <code>restrict</code>, to apply to individual pointers. The
|
|
C++ solution is contained in the library rather than the language
|
|
(although many vendors can be expected to add this to their compilers
|
|
as an extension).
|
|
</para>
|
|
<para>That library solution is a set of two classes, five template classes,
|
|
and "a whole bunch" of functions. The classes are required
|
|
to be free of pointer aliasing, so compilers can optimize the
|
|
daylights out of them the same way that they have been for FORTRAN.
|
|
They are collectively called <code>valarray</code>, although strictly
|
|
speaking this is only one of the five template classes, and they are
|
|
designed to be familiar to people who have worked with the BLAS
|
|
libraries before.
|
|
</para>
|
|
|
|
</sect1>
|
|
|
|
<sect1 id="numerics.c.c99" xreflabel="C99">
|
|
<title>C99</title>
|
|
|
|
<para>In addition to the other topics on this page, we'll note here some
|
|
of the C99 features that appear in libstdc++.
|
|
</para>
|
|
<para>The C99 features depend on the <code>--enable-c99</code> configure flag.
|
|
This flag is already on by default, but it can be disabled by the
|
|
user. Also, the configuration machinery will disable it if the
|
|
necessary support for C99 (e.g., header files) cannot be found.
|
|
</para>
|
|
<para>As of GCC 3.0, C99 support includes classification functions
|
|
such as <code>isnormal</code>, <code>isgreater</code>,
|
|
<code>isnan</code>, etc.
|
|
The functions used for 'long long' support such as <code>strtoll</code>
|
|
are supported, as is the <code>lldiv_t</code> typedef. Also supported
|
|
are the wide character functions using 'long long', like
|
|
<code>wcstoll</code>.
|
|
</para>
|
|
|
|
</sect1>
|
|
</chapter>
|
|
|
|
</part>
|