Vectors, rows, matrices

By default, Vector, Row and Matrix objects are initialized with \(0\) values.

More documentation to come…

Matrix preconditioning

Matrix codac2::gauss_jordan(const Matrix &A)

Gauss Jordan band diagonalization preconditioning.

Takes a Matrix \(\mathbf{A}\) with A.cols >= A.rows and returns \(\mathbf{P}\) such that \(\mathbf{P}\mathbf{A}\) is a band matrix. The square left part of \(\mathbf{A}\) must be full-rank. This function does not involve interval computations.

From https://www.ensta-bretagne.fr/jaulin/centered.html

Parameters:

A – matrix with A.cols >= A.rows

Returns:

P such that \(\mathbf{P}\mathbf{A}\) is a band matrix. Return Id if the left part of \(\mathbf{A}\) is not well-conditioned.

Using Vector as keys in std::map (C++ use)

In C++, the Vector type can be used as a key in associative containers such as std::map. Since std::map requires a strict weak ordering between keys, a custom comparison functor must be provided. Codac provides the VectorCompare struct for this purpose.

Below is a minimal example showing how to create a map whose keys are Vector objects and whose values are integers.

// std::map<codac2::Vector, int> m; // does not compile
std::map<codac2::Vector, int, codac2::VectorCompare> m;
codac2::Vector v1({1,3}), v2({-42,10});
m[v1] = 10;
m[v2] = 20;