📄 nm10.htm
字号:
<P CLASS="small"><A HREF="#bugs">next</A> - <A HREF="#bugs">skip</A> -
<A HREF="#starting">up</A> - <A HREF="#top">start</A></P>
<P>The library package contains a comprehensive test program in the form of a
series of files with names of the form tmt?.cxx. The files consist of a large
number of matrix formulae all of which evaluate to zero (except the first one
which is used to check that we are detecting non-zero matrices). The printout
should state that it has found just one non-zero matrix. </P>
<P>The test program should be run with <I>Real</I> typedefed to <I>double</I>
rather than <I>float</I> in <A HREF="#custom">include.h</A>. </P>
<P>Make sure the <A HREF="#elements">C subscripts</A> are enabled if you want
to test these. </P>
<P>If you are carrying out some form of bounds checking, for example, with
Borland's <I>CodeGuard</I>, then disable the testing of the <A
HREF="#nric">Numerical Recipes in C</A> interface. Activate the statement
<TT>#define DONT_DO_NRIC</TT> in tmt.h. </P>
<P>Various versions of the make file (extension .mak) are included with the
package. See the section on <A HREF="#make">make files</A>. </P>
<P>The program also allocates and deletes a large block and small block of
memory before it starts the main testing and then at the end of the test. It
then checks that the blocks of memory were allocated in the same place. If not,
then one suspects that there has been a memory leak. i.e. a piece of memory has
been allocated and not deleted.</P>
<P>This is not completely foolproof. Programs may allocate extra print buffers
while the program is running. I have tried to overcome this by doing a print
before I allocate the first memory block. Programs may allocate memory for
different sized items in different places, or might not allocate items
consecutively. Or they might mix the items with memory blocks from other
programs. Nevertheless, I seem to get consistent answers from <i>some</i> of the
compilers I work with, so I think this is a worthwhile test. The compilers that
the test seems to work for include the Borland compilers, Microsoft VC++ 6 ,
Watcom 10a, and Gnu 2.96 for Linux.</P>
<P>If the <A HREF="#custom">DO_FREE_CHECK</A> option in include.h is activated,
the program checks that each <TT>new</TT> is balanced with exactly one
<TT>delete</TT>. This provides a more definitive test of no memory leaks. There
are additional statements in myexcept.cpp which can be activated to print out
details of the memory being allocated and released. </P>
<P>I have included a facility for checking that each piece of code in the
library is really exercised by the test routines. Each block of code in the
main part of the library contains a word <TT>REPORT</TT>. <TT>newmat.h</TT> has
a line defining <TT>REPORT</TT> that can be activated (deactivate the dummy
version). This gives a printout of the number of times each of the
<TT>REPORT</TT> statements in the <TT>.cpp</TT> files is accessed. Use a grep
with line numbers to locate the lines on which <TT>REPORT</TT> occurs and
compare these with the lines that the printout shows were actually accessed.
One can then see which lines of code were not accessed. </P>
<H2><A NAME="bugs"></A>2.9 Bugs</H2>
<P CLASS="small"><A HREF="#files">next</A> - <A HREF="#files">skip</A> -
<A HREF="#starting">up</A> - <A HREF="#top">start</A> </P>
<UL>
<LI>Small memory leaks may occur when an exception is thrown and caught. </LI>
<LI>My exception scheme may not be not properly linked in with the standard
library exceptions. In particular, my scheme may fail to catch out-of-memory
exceptions. </LI>
</UL>
<H2><A NAME="files"></A>2.10 List of files</H2>
<P CLASS="small"><A HREF="#problem">next</A> - <A HREF="#problem">skip</A> -
<A HREF="#starting">up</A> - <A HREF="#top">start</A></P>
<TABLE WIDTH="100%" BORDER="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0">
<TR>
<TD width="25%"><B>Documentation</B></TD>
<TD width="25%">readme</TD>
<TD width="50%">readme file</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">nm10.htm</TD>
<TD width="50%">documentation file</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">add_time.pgn</TD>
<TD width="50%">image used by nm10.htm - move to subdirectory "images"</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">rbd.css</TD>
<TD width="50%">style sheet for nm10.htm</TD>
</TR>
<TR>
<TD width="25%"><B>Definition files</B></TD>
<TD width="25%">boolean.h</TD>
<TD width="50%">boolean class definition</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">controlw.h</TD>
<TD width="50%">control word definition file</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">include.h</TD>
<TD width="50%">details of include files and options</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">myexcept.h</TD>
<TD width="50%">general exception handler definitions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat.h</TD>
<TD width="50%">main matrix class definition file</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatap.h</TD>
<TD width="50%">applications definition file</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatio.h</TD>
<TD width="50%">input/output definition file</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatnl.h</TD>
<TD width="50%">non-linear optimisation definition file</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatrc.h</TD>
<TD width="50%">row/column functions definition files</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatrm.h</TD>
<TD width="50%">rectangular matrix access definition files</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">precisio.h</TD>
<TD width="50%">numerical precision constants</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">solution.h</TD>
<TD width="50%">one dimensional solve definition file</TD>
</TR>
<TR>
<TD width="25%"><B>Program files</B></TD>
<TD width="25%">bandmat.cpp</TD>
<TD width="50%">band matrix routines</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">cholesky.cpp</TD>
<TD width="50%">Cholesky decomposition</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">evalue.cpp</TD>
<TD width="50%">eigenvalues and eigenvector calculation</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">fft.cpp</TD>
<TD width="50%">fast Fourier, trig. transforms</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">hholder.cpp</TD>
<TD width="50%">QR routines</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">jacobi.cpp</TD>
<TD width="50%">eigenvalues by the Jacobi method</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">myexcept.cpp</TD>
<TD width="50%">general error and exception handler</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newfft.cpp</TD>
<TD width="50%">new fast Fourier transform</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat1.cpp</TD>
<TD width="50%">type manipulation routines</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat2.cpp</TD>
<TD width="50%">row and column manipulation functions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat3.cpp</TD>
<TD width="50%">row and column access functions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat4.cpp</TD>
<TD width="50%">constructors, resize, utilities</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat5.cpp</TD>
<TD width="50%">transpose, evaluate, matrix functions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat6.cpp</TD>
<TD width="50%">operators, element access</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat7.cpp</TD>
<TD width="50%">invert, solve, binary operations</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat8.cpp</TD>
<TD width="50%">LU decomposition, scalar functions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmat9.cpp</TD>
<TD width="50%">output routines</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatex.cpp</TD>
<TD width="50%">matrix exception handler</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatnl.cpp</TD>
<TD width="50%">non-linear optimisation</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">newmatrm.cpp</TD>
<TD width="50%">rectangular matrix access functions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">sort.cpp</TD>
<TD width="50%">sorting functions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">solution.cpp</TD>
<TD width="50%">one dimensional solve</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">submat.cpp</TD>
<TD width="50%">submatrix functions</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">svd.cpp</TD>
<TD width="50%">singular value decomposition</TD>
</TR>
<TR>
<TD width="25%"><B>Example files</B></TD>
<TD width="25%">example.cpp</TD>
<TD width="50%">example of use of package</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">example.txt</TD>
<TD width="50%">output from example</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">sl_ex.cpp</TD>
<TD width="50%">example of OneDimSolve routine</TD>
</TR>
<TR>
<TD width="25%"> </TD>
<TD width="25%">sl_ex.txt</TD>
<TD width="50%">output from example</TD>
</TR>
<TR>
<TD width="25%"> </TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -