\chapter{Introduction}
\section{What is the Problem?}
I wrote this code to solve some of my matrix algebra
problems for my research. I needed a generic program that
could handle matrix algebra on a PC, for instance 
$$
\hat \beta = (X'X)^{-1}X'y
$$ 
The computer languages I've used for this problem just were
not agile enough to handle alot of matrix algebra (FORTRAN,
Pascal and C). This C++ incarnation of my attempts to solve
this problem would code the equation above as

\begin{verbatim}
      VMatrix b,X,Y;
      // code to read in X and Y
           .
           .
           .
      b = Inv(Tran(X)*X)*Tran(X)*Y;
\end{verbatim}

\noindent where b, X, and Y are matrices. This not quite as
powerful as some matrix interpreters, but it works. C++ is
powerful enough for this problem since it can overload
functions for objects. It also flexible enough to handle
the recursive and nested function calls needed for matrix
algebra.

The next problem was to minimize the overhead of
manipulating the data structures required for keeping track
of all of the matrices. The ability to bind functions to
data structures using objects solved this problem. It was
reasonably easy to write a stack of matrices to keep track
of the intermediate calculations, and then delete the
unnecessary matrices. It also made it reasonably easy to
assign matrices using the equals operator.

The next problem was the 640K barrier on the PC class
machines. Most of my problems are too big to keep all of
the data in RAM, so I have to resort to special data IO
tricks. This is fine for any single problem, but it does
not generalize very well. I found a virtual memory allocator
to solve this problem. It writes to a disk file. The new
class of 386 machines can keep RAM disks in extended
memory, so there is only a modest performance penalty for
accessing the data in electronic memory.  The virtual
memory scheme only keeps about 64 elements in RAM, so
finding elements in a large matrix is slower than direct
access to the heap. This tradeoff suited me since I would
rather be able to use matrices that are potentially larger
than 640K. A 3 or 4 meg RAM disk would suit most of my
needs. The hard drive can be used too. Again, it ain't
fast, but it works.

The properties of C++ helped solve these problems. This
document will develop a matrix class from lower level
functions. The first step is to explain the virtual memory
allocator. The next step is to explain the string
functions. The third step is to develop a vector class
based on the virtual memory allocator. The next step is to
explain the matrix class and matrix stack classes. The
virtual vector class is the base class for the matrix
class. The matrix stack is derived from the matrix class.
Developing a general matrix program is hard without
encapsulation and inheritance.



\section{Who Owns the Code?}
My philosophy about the code is that it should provide a
basic data structure for the user to develop. You can add
functions as you need them. Many of you are far better
numerical analysts, so you will want to use your own
functions. You can have your copy of the source code. I
still own the copywrite. You may distribute the code,
provided you don't change it. 

Nevertheless, the source is in the public domain. Perhaps
this is a naive attitude, but I do not think of this code
as a thing to be owned, but as more of thought to be spread
about. If you want to send me some money because I have
saved you $x$-manhours, then feel free to do so. For lack
of a better word, call it {\em begger-ware}. I kind of see
myself on a street corner, playing my guitar, singing a
song, and my case with a little spare change in it. If you
like the song, you can toss in a buck or two. God only
knows but Frank Borland could trek by with his burro and
his dogs on his way to the High Sierras for
\index{YAMP }{\em Yet Another Matrix Program}--ming camp out.

I do not plan to support the code very much.  It costs too
much time and money. You can write me if you have any
problems. I will keep a list of names and addresses of the
people who contact me about the code.  It may become
advantageous to change this support policy. But as of now
I'm not out to start some company that eats into my
otherwise busy normal life. I already have a good job.

I assume that anyone who uses this code is smart enough to
use it well, so I have minimized the amount of commenting
in it.  Some of the code is very fragile, so change it at
your own risk. Your best bet is to study it and just add
functions. I will give references for those of you who want
to really dig into the guts. Also read the test file. I
really think this documentation will be a sufficient
explanation of the details you can fool with safely. (This
document is prepared in \LaTeX  but it should be readable
as pure text)

Also please send me your name and address if you are using yamp.
I need to convince some people that it has a user base. As of
this release, there have been about 800 downloads from
Compuserve, with about 50 onto local bulletin boards and public
domain software distributors. By now I am guessing that it is
being used around the world. That's neat.


I have tested the program, and it does what I tell it to do
(and we all know how much of a problem that can be). I have
only tested it in Turbo C++. It may not work in any other
language. It works on my XT, AT, and 386 clones, so I
assume it will work on the same machines where Turbo C++
works well.  There are places where its performance can be
improved. I just wanted something that works.  I'm not a
professional computer scientist, so improving the
algorithms will provide some challenges to a professional.
I also hope it sparks some interest in C++ among
mathematicians.

Maybe the only reason I'm circulating the code because I'm
amazed that it works at all. I guess that other people have
been fishing around for an answer to the same problems.
Here is my answer.