logo.jpg rejtrix.h

Matrix Libraries for C++:

By Rondall E. Jones, Ph.D.

www.rejonesconsulting.com

Introduction

This software package for C++ is intended to satisfy most needs of end-users of matrix software. 

It is usually packaged as a single C++ *.h file, but contains several separate packages, as shown in this UML diagram.  The matrix.h library should handle most typical needs that do not involve ill-conditioning.  rejtrix.h handles ill-conditioned systems as well, including the use of constraints.  sparse.h solves non-pathological sparse systems of equations, and computes eigenvalues and optionally, eigenvectors if the system is sufficiently sparse.

 

For complete programs which will solve your system of equations, see our main page, which offers several of the most powerful algorithms in rejtrix.h in easy to use executables.

matrix.h contains all the code for dense matrices for:

·         declaring, defining, indexing, copying, building a Matrix, Vector, Row, or Diagonal

·         element-wise operations, Matrix:scalar operations, Matrix:Vector operations, Matrix:Matrix operations

·         transforms, norms, stack operations, sorting, row/column manipulation, reshaping, etc.

·         decomposition routines for SVD, QR, and symmetric eigenvalue/eigenvector.  These are as received from NIST/Mathworks, (see main page for references) except for adapting to use the above Matrix/Vector libraries.

·         code for pseudoinverse solution and related utilities.  This pseudoinverse solver handles solving square, overdetermined (least-squares), underdetermined (minimum norm) and simply singular system of equations.

You may download this library here: matrix.h.

rejtrix.h contains utility routines (no new classes) for handling dense ill-conditioned systems:

·         traditional manually regularized solutions in several forms

·         automatically regularized solutions.  For details see paper.

·         automatically regularized solutions with constraints on the norm of the derivative of the solution, or the second derivative,etc., rather than the norm of the solution itself.

·         automatically regularized solutions with constraint to discrete levels

·         Non-negatively constrained solutions.

This file contains matrix.h, so you do not need both matrix.h and rejtrix.h.  You may download this library here: rejtrix.h.

 

Documentation

For matrix.h:

·         This tells how to Create a Matrix, Vector, Row, or Diagonal.

·         This tells how to do many Operations on matrices, vectors, etc, other than actual solutions.

·         This tells how to Solve arbitrary matrix systems other than ill-conditioned ones which need the rmatrix.h algorithms.

For rejtrix.h:

·         This details all the regularized and constrained methods: Ill-Conditioned. This file also tells how to directly call the primary autoregularized solvers from C or Fortran without use of the matrix class.

Note: rejtrix.h does not contain any serious graphics capabilities for displaying matrices or solutions.  There are many other graphics packages.  However, we do include some graphic-like text displays which may be adequate for quick looks.  The “star magnitude” displays may be particularly useful to see the general form of a matrix, whether dense or Sparse.

How to compile with rejtrix.h (for example)

·         Just #include rejtrix.h in your C++ program file.

·         If you need a pre-compiled library rather than source, just make a one-line rejtrix.cpp file containing the one line below and compile it.

o   #include “rejtrix.h

·         Please note that all these file include  <iostream.h>, <fstream.h>, and< iomanip.h>.  Some newer compilers may diagnose these library names as wrong.  In this case, you need to EDIT OUT the “.h” from each of these names.  Just search for “include” in the source code.  It’s easy.

·         rejtrix.h has been compiled with multiple PC-based C++ compilers, and on a SUN Solaris system and some Linux systems.  If you experience any compilation difficulties, please contact the author.