For detailed description on intervals, vectors and matrices see sections
Defined types and data structures
The main header file
#include "capd/capdlib.h"
defines the following types for computation in double (D), long double (LD) precision and interval (I) arithmetics.
- DVector, LDVector, IVector - elements of in double and long double precision, and interval vectors
- DMatrix, LDMatrx, IMatrix - matrices, elements and/or subsets of
- DEuclNorm, LDEuclNorm, IEuclNorm - classes that compute Euclidean norm of vectors and matrices (operator norm).
- DMaxNorm, LDMaxNorm, IMaxNorm - classes that compute max norm of vectors and matrices (operator norm)
- DSumNorm, LDSumNorm, ISumNorm - classes that compute norm of vectors and matrices (operator norm)
Vectors and matrices
Vectors and matrices are defined by a simple constructor calls
Initialization of vectors and matrices:
cout << v << endl;
double mcoeff[] = {1,2,3,4,5,6};
cout << m << endl;
long double xcoeff[] = {1,2,3,4,5};
cout << x << endl;
- Note
- Contructors of vectors and matrices assume that arrays of coefficients contain enough elements
Indexing of vectors and matrices
Vectors and matrices are indexed from zero by means of overloaded operator[].
- Note
- Indexing of vectors and matrices starts from zero.
Arrays of vectors and matrices
When constructing arrays of matrices one has to provide two informations:
- what is the length of array
- what are dimensions of matrices/vectors in the array
If one wish to define array of matrices or vectors of the same dimensions we strongly encourage to use the following static funcitons
int dimension = 6;
int rows = 2, columns = 5;
int length = 3;
delete []t;
delete []p;
delete []m;
- Attention
- The above operations are not thread safe. For thread safe arrays of vectors (or matrices) use
int dimension = 6;
int rows = 2, columns = 5;
int length = 3;
for(int i=0;i<length;++i){
}
Basic operations on vectors and matrices
Mathematical operators are overloaded wherever it is intuitive, like multiplications, additions, subtractions
Basic algorithms of linear algebra.
Among others we provide algorithms for
- transposition of matrices
- solving linear systems
- computing inverse matrices (inverting should be avoided if possible)
- QR decomposition
- Note
- both functions
gaussInverseMatrix
and krawczykInverse
compute enclosure of inverse of an interval matrix M. We recommend to use krawczykInverse as it always produces tighter enclosures.
- Attention
- In principle linear system could be solved by but this is much slower.
- Note
- The above functions throw an exception (object of type std::runtime_error) when they cannot finish operation.
Eigenvectors and eigenvalues of matrices
These functions are implemented for non-interval matrices only!. More information on this topic is given in section Non-rigorous computations of eigenvalues and eigenvectors.