ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
SparseMatrix.h File Reference

A sparse matrix on orthogonal lists, beyond the book (section 2.2.6 of Knuth): each nonzero entry is a node on the circular list of its row, sorted by column, and on that of its column, sorted by row, each list with a head node; the space is \( O( m + n + \mathit{nnz} ) \) and an entry is found by walking its row. More...

#include "ADS/Contract.h"
#include <cmath>
#include <cstddef>
#include <iterator>
#include <map>
#include <ranges>
#include <utility>
#include <vector>
#include "ADS/numeric/impl/SparseMatrix.tpp"

Go to the source code of this file.

Classes

class  ADS::SparseMatrix
 a sparse matrix on orthogonal circular lists More...

Namespaces

namespace  ADS

Detailed description

A sparse matrix on orthogonal lists, beyond the book (section 2.2.6 of Knuth): each nonzero entry is a node on the circular list of its row, sorted by column, and on that of its column, sorted by row, each list with a head node; the space is \( O( m + n + \mathit{nnz} ) \) and an entry is found by walking its row.

pivot() is the pivot step of Algorithm 2.2.6S, the core of the elimination by exchange: with the pivot \( a \) in the row \( r \) and the column \( c \), the pivot becomes \( 1 / a \), the rest of its row \( b / a \), the rest of its column \( - c / a \), and every other entry \( d \) with a nonzero \( b \) in its column of the pivot row and \( c \) in its row of the pivot column becomes \( d - b c / a \), the entries that become zero leaving the lists and those that appear (the fill-in) entering them. As in Knuth's step, each row of the pivot column is walked side by side with the pivot row, and for each column of the pivot row the node above the current row only moves down, in time proportional to the nonzeros of these rows and columns plus \( |R| \cdot |C| \). A pivot step on each diagonal place, in turn, inverts a matrix whose pivots are not zero.

The contracts [see Contract.h]: the places are in the matrix, and the pivot is not zero; the invariant is that the lists are sorted and that a node is on the lists of its row and of its column, an audit. The operations are defined in SparseMatrix.tpp.

See also
D. E. Knuth, The Art of Computer Programming, vol. 1, 3rd ed., Addison-Wesley, 1997, section 2.2.6
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa