SOLVE
Linear Solver for Double Dimensioned Arrays


SOLVE is a C++ library which implements a linear solver which makes it easy to create doubly-dimensioned arrays and solve associated linear systems.

The purpose of the library is to allow the user to declare a square matrix A of any size, access matrix entries using the usual double indexing formula A[i][j]=value;, and call a linear solver to solve A*x=b using a call like:

        x = solve ( n, A, b );
      

In C and C++, it can be awkward to set up matrices in a way that makes it easy to access them with the usual two index form, and to pass these matrices back and forth to other functions. This is because, when using the simplest interface to another function, it is necessary that the second dimension, that is, the number of columns, be declared as a fixed integer, not a variable. Such an interface is impossible to use with a general purpose linear solver.

These problems can be overcome by using a data structure known as a pointer to a pointer. However, creating and deleting such objects can be unfamiliar to the average user. This library hides the details behind an object called an R8RMAT, that is, a double precision real (R8) row-major (R) matrix (MAT). A set of functions, with the "r8rmat_" label, are provided to make it easy to create and delete such objects, and more importantly, to solve an associated linear system.

The SOLVE library makes it possible to set up and solve linear systems in a natural way, as long as the user does the following:

The library can also be useful because:

Licensing:

The computer code and data files made available on this web page are distributed under the GNU LGPL license.

Languages:

SOLVE is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

ALLOCATABLE_ARRAY, a C++ program which demonstrates how a C++ function can declare a pointer to an array, call a function, which can then allocate it and fill it with data, and then return the allocated and initialized array to the calling function through the argument list.

CPP_ARRAYS, C++ programs which illustrate the use of vectors, matrices and tensors.

LINPACK, a C++ library which solves linear systems for a variety of matrix storage schemes, real or complex arithmetic, and single or double precision. It includes a routine for computing the singular value decomposition (SVD) of a rectangular matrix. The original version of this library is by Jack Dongarra, Jim Bunch, Cleve Moler, Pete Stewart.

LINPLUS, a C++ library which carries out operations such as matrix-vector products, matrix factorization, direct and iterative linear solvers for matrices in a variety of formats, including banded, border-banded, circulant, lower triangular, pentadiagonal, sparse, symmetric, toeplitz, tridiagonal, upper triangular and vandermonde formats.

R8LIB, a C++ library which contains many utility routines using double precision real (R8) arithmetic.

Source Code:

Examples and Tests:

List of Routines:

You can go up one level to the C++ source codes.


Last revised on 27 May 2014.