📄 nm10.htm
字号:
<!DOCTYPE HTML PUBLIC "-//SoftQuad Software//DTD HoTMetaL PRO 5.0::19981217::extensions to HTML 4.0//EN" "hmpro5.dtd">
<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="en-nz">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<TITLE>Newmat10 documentation</TITLE>
<link rel="stylesheet" type="text/css" href="rbd.css">
</HEAD>
<BODY>
<H1><A NAME="top"></A>Documentation for newmat10A, a matrix library in C++</H1>
<P CLASS="small"><A HREF="#intro">next</A> - <A HREF="#top">skip</A> -
<A HREF="ol_doc.htm">up</A> - <A HREF="#top">start</A><BR>
<A HREF="ol_doc.htm">return to online documentation page</A></P>
<P><B>Copyright (C) 1991,2,3,4,5,6,7,8,9,2000,1,2: R B Davies</B></P>
<P><i>8 October, 2002</i>.</P>
<TABLE WIDTH=100%>
<TR>
<TD VALIGN="TOP" ALIGN="LEFT" WIDTH="50%"> <A HREF="#intro">1.
Introduction</A><BR>
<A HREF="#starting">2. Getting started</A><BR>
<A HREF="#refer">3. Reference manual</A></TD>
<TD VALIGN="TOP" ALIGN="LEFT" WIDTH="50%"> <A HREF="#error">4.
Error messages</A><BR>
<A HREF="#design">5. Design of the library</A></TD>
</TR>
</TABLE>
<P>This is the <I>how to use</I> documentation for <I>newmat</I> plus some
background information on its design. </P>
<P>There is additional support material on my <A HREF="#where">web site</A>.
</P>
<P CLASS="small">Navigation: This page is arranged in sections,
sub-sections and sub-sub-sections; four cross-references are given at the top
of these. <I>Next</I> takes you through the sections, sub-sections and
sub-sub-sections in order. <I>Skip</I> goes to the next section, sub-section or
sub-sub-section at the same level in the hierarchy as the section, sub-section
or sub-sub-section that you are currently reading. <I>Up</I> takes you up one
level in the hierarchy and <I>start</I> gets you back here.</P>
<P><B>Please read the sections on <A HREF="#custom">customising</A> and
<a href="#compiler">compilers</a> before
attempting to compile <i>newmat</i>.</B> </P>
<H2><A NAME="intro"></A>1. Introduction</H2>
<P CLASS="small"><A HREF="#use">next</A> - <A HREF="#starting">skip</A> -
<A HREF="#top">up</A> - <A HREF="#top">start</A></P>
<TABLE WIDTH=100%>
<TR>
<TD VALIGN="TOP" ALIGN="LEFT" WIDTH="50%"> <A HREF="#use">1.1
Conditions of use</A><BR>
<A HREF="#descript">1.2 Description</A><BR>
<A HREF="#which">1.3 Is this the library for you?</A><BR>
<A HREF="#other">1.4 Other matrix libraries</A></TD>
<TD VALIGN="TOP" ALIGN="LEFT" WIDTH="50%"> <A HREF="#where">1.5
Where to find this library</A><BR>
<A HREF="#author">1.6 How to contact the author</A><BR>
<A HREF="#changes">1.7 Change history</A><BR>
<A HREF="#sources">1.8 References</A></TD>
</TR>
</TABLE>
<H2><A NAME="use"></A>1.1 Conditions of use</H2>
<P CLASS="small"><A HREF="#descript">next</A> - <A HREF="#descript">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A></P>
<P>There are no restrictions on the use of <I>newmat</I> except that I take no
liability for any problems that may arise from this use.</P>
<P>I welcome its distribution as part of low cost CD-ROM collections. </P>
<P>You can use it in your commercial projects. However, if you distribute the
source, please make it clear which parts are mine and that they are available
essentially for free over the Internet. </P>
<HR>
<P><STRONG>Please understand that there may still be bugs and errors. Use at
your own risk. I take no responsibility for any errors or omissions in this
package or for any misfortune that may befall you or others as a result of its
use.</STRONG> </P>
<HR>
<P>Please report bugs to me at <B>robert (at) statsresearch.co.nz</B> </P>
<P>When reporting a bug please tell me which C++ compiler you are using, and
what version. Also give me details of your computer. And tell me which version
of <I>newmat</I> (e.g. newmat03 or newmat04) you are using. Note any changes
you have made to my code. If at all possible give me a piece of code
illustrating the bug. See the <A HREF="#problem">problem report form</A>. </P>
<P><I>Please do report bugs to me.</I> </P>
<H2><A NAME="descript"></A>1.2 General description
</H2>
<P CLASS="small"><A HREF="#which">next</A> - <A HREF="#which">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A></P>
<P>The package is intended for scientists and engineers who need to manipulate
a variety of types of matrices using standard matrix operations. Emphasis is on
the kind of operations needed in statistical calculations such as least
squares, linear equation solve and eigenvalues. </P>
<P>It supports matrix types </P>
<BLOCKQUOTE>
<TABLE WIDTH="80%" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0">
<TR>
<TD>Matrix</TD>
<TD>rectangular matrix</TD>
</TR>
<TR>
<TD>nricMatrix</TD>
<TD>for use with <I>Numerical Recipes in C</I> programs</TD>
</TR>
<TR>
<TD>UpperTriangularMatrix</TD>
<TD> </TD>
</TR>
<TR>
<TD>LowerTriangularMatrix</TD>
<TD> </TD>
</TR>
<TR>
<TD>DiagonalMatrix</TD>
<TD> </TD>
</TR>
<TR>
<TD>SymmetricMatrix</TD>
<TD> </TD>
</TR>
<TR>
<TD>BandMatrix</TD>
<TD> </TD>
</TR>
<TR>
<TD>UpperBandMatrix</TD>
<TD>upper triangular band matrix</TD>
</TR>
<TR>
<TD>LowerBandMatrix</TD>
<TD>lower triangular band matrix</TD>
</TR>
<TR>
<TD>SymmetricBandMatrix</TD>
<TD> </TD>
</TR>
<TR>
<TD>RowVector</TD>
<TD>derived from Matrix</TD>
</TR>
<TR>
<TD>ColumnVector</TD>
<TD>derived from Matrix</TD>
</TR>
<TR>
<TD>IdentityMatrix</TD>
<TD>diagonal matrix, elements have same value</TD>
</TR>
</TABLE>
</BLOCKQUOTE>
<P>Only one element type (float or double) is supported. </P>
<P>The package includes the operations <TT>*</TT>, <TT>+</TT>, <TT>-</TT>,
Kronecker product, Schur product, concatenation, inverse, transpose, conversion between types, submatrix,
determinant, Cholesky decomposition, QR triangularisation, singular value
decomposition, eigenvalues of a symmetric matrix, sorting, fast Fourier
transform, printing and an interface with <I>Numerical Recipes in C</I>. </P>
<P>It is intended for matrices in the range 10 x 10 to the maximum size your
machine will accommodate in a single array. The number of elements in an array
cannot exceed the maximum size of an <I>int</I>. The package will work for very
small matrices but becomes rather inefficient. Some of the factorisation
functions are not (yet) optimised for paged memory and so become inefficient
when used with very large matrices. </P>
<P>A <I>lazy evaluation</I> approach to evaluating matrix expressions is used
to improve efficiency and reduce the use of temporary storage. </P>
<P>I have tested versions of the package on variety of compilers and platforms
including Borland, Gnu, Microsoft, Sun and Watcom. For more details
see the section on <A HREF="#compiler">compilers</A>. </P>
<H2><A NAME="which"></A>1.3 Is this the library for
you?</H2>
<P CLASS="small"><A HREF="#other">next</A> - <A HREF="#other">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A></P>
<P>Do you</P>
<UL>
<LI>understand <TT>*</TT> to mean matrix multiply and not element by element
multiply </LI>
<LI>need matrix operators such as <TT>*</TT> and <TT>+</TT> defined as
operators so you can write things like <TT> X = A * (B + C);</TT></LI>
<LI>need a variety of types of matrices (but not sparse)</LI>
<LI>need only one element type (float or double)</LI>
<LI>work with matrices in the range 10 x 10 up to what can be stored in memory
</LI>
<LI>tolerate a moderately large but not huge package</LI>
<LI>need high quality but not necessarily the latest numerical methods. </LI>
</UL>
<P>Then <I>newmat</I> may be the right matrix library for you. </P>
<H2><A NAME="other"></A>1.4 Other matrix libraries
</H2>
<P CLASS="small"><A HREF="#where">next</A> - <A HREF="#where">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A></P>
<P>For details of other C++ matrix libraries look at
<A
HREF="http://www.robertnz.net/cpp_site.html">http://www.robertnz.net/cpp_site.html</A>.
Look at the section <I>lists of libraries</I> which gives the locations of
several very comprehensive lists of matrix and other C++ libraries and at the
section <I>source code</I>. </P>
<H2><A NAME="where"></A>1.5 Where to find this
library</H2>
<P CLASS="small"><A HREF="#author">next</A> - <A HREF="#author">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A> </P>
<UL>
<LI><a href="http://www.robertnz.net">http://www.robertnz.net</a></LI>
</UL>
<H2><A NAME="author"></A>1.6 How to contact the
author</H2>
<P CLASS="small"><A HREF="#changes">next</A> - <A HREF="#changes">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A></P>
<PRE> Robert Davies
16 Gloucester Street
Wilton
Wellington
New Zealand
<I>email:</I> robert<b>(at)</b>statsresearch.co.nz
</PRE>
<H2><A NAME="changes"></A>1.7 Change history</H2>
<P CLASS="small"><A HREF="#sources">next</A> - <A HREF="#sources">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A></P>
<P><b>Newmat10A - October, 2002:</b></P>
<P CLASS="small">Fix error in Kronecker product; fixes for Intel and GCC3
compilers.</P>
<P><B>Newmat10 - January, 2002:</B> </P>
<P CLASS="small">Improve compatibility with GCC, fix errors in FFT and
GenericMatrix, update simulated exceptions, maxima, minima, determinant, dot
product and Frobenius norm functions, update make files for CC and GCC, faster
FFT, <TT>A.ReSize(B)</TT>, fix pointer arithmetic, <TT><<</TT> for loading
data into rows, IdentityMatrix, Kronecker product, sort singular values.</P>
<P><B>Newmat09 - September, 1997:</B> </P>
<P CLASS="small">Operator <TT>==</TT>, <TT>!=</TT>, <TT>+=</TT>, <TT>-=</TT>,
<TT>*=</TT>, <TT>/=</TT>, <TT>|=</TT>, <TT>&=</TT>. Follow new rules for
<I>for (int i; ... )</I> construct. Change Boolean, TRUE, FALSE to bool, true,
false. Change ReDimension to ReSize. SubMatrix allows zero rows and columns.
Scalar <TT>+</TT>, <TT>-</TT> or <TT>*</TT> matrix is OK. Simplify simulated
exceptions. Fix non-linear programs for AT&T compilers. Dummy inequality
operators. Improve internal row/column operations. Improve matrix LU
decomposition. Improve sort. Reverse function. IsSingular function. Fast trig
transforms. Namespace definitions. </P>
<P><B>Newmat08A - July, 1995:</B> </P>
<P CLASS="small">Fix error in SVD. </P>
<P><B>Newmat08 - January, 1995:</B> </P>
<P CLASS="small">Corrections to improve compatibility with Gnu, Watcom.
Concatenation of matrices. Elementwise products. Option to use compilers
supporting exceptions. Correction to exception module to allow global
declarations of matrices. Fix problem with inverse of symmetric matrices. Fix
divide-by-zero problem in SVD. Include new QR routines. Sum function.
Non-linear optimisation. GenericMatrices. </P>
<P><B>Newmat07 - January, 1993</B> </P>
<P CLASS="small">Minor corrections to improve compatibility with Zortech,
Microsoft and Gnu. Correction to exception module. Additional FFT functions.
Some minor increases in efficiency. Submatrices can now be used on RHS of =.
Option for allowing C type subscripts. Method for loading short lists of
numbers. </P>
<P><B>Newmat06 - December 1992:</B> </P>
<P CLASS="small">Added band matrices; 'real' changed to 'Real' (to avoid
potential conflict in complex class); Inject doesn't check for no loss of
information; fixes for AT&T C++ version 3.0; real(A) becomes A.AsScalar();
CopyToMatrix becomes AsMatrix, etc; .c() is no longer required (to be deleted
in next version); option for version 2.1 or later. Suffix for include files
changed to .h; BOOL changed to Boolean (BOOL doesn't work in g++ v 2.0);
modifications to allow for compilers that destroy temporaries very quickly;
(Gnu users - see the section of compilers). Added CleanUp,
LinearEquationSolver, primitive version of exceptions. </P>
<P><B>Newmat05 - June 1992:</B> </P>
<P CLASS="small">For private release only </P>
<P><B>Newmat04 - December 1991:</B> </P>
<P CLASS="small">Fix problem with G++1.40, some extra documentation
</P>
<P><B>Newmat03 - November 1991:</B> </P>
<P CLASS="small">Col and Cols become Column and Columns. Added Sort, SVD,
Jacobi, Eigenvalues, FFT, real conversion of 1x1 matrix, <I>Numerical Recipes
in C</I> interface, output operations, various scalar functions. Improved
return from functions. Reorganised setting options in "include.hxx".
</P>
<P><B>Newmat02 - July 1991:</B> </P>
<P CLASS="small">Version with matrix row/column operations and numerous
additional functions. </P>
<P><B>Matrix - October 1990:</B> </P>
<P CLASS="small">Early version of package. </P>
<H2><A NAME="sources"></A>1.8 References</H2>
<P CLASS="small"><A HREF="#starting">next</A> - <A HREF="#starting">skip</A> -
<A HREF="#intro">up</A> - <A HREF="#top">start</A></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -