|
linbox
|
Time and space efficient representation of sparse {0,1}-matrices. More...
#include <zo.h>
Inheritance diagram for ZeroOne< _Field >:Data Structures | |
| class | IndexIterator |
| IndexIterator. More... | |
| class | Iterator |
| Raw iterator. More... | |
| struct | rebind |
Public Types | |
| enum | howToSort { sortedByRow , sortedByCol } |
| typedef ZeroOne< _Field > | Self_t |
| typedef _Field | Field |
| typedef _Field::Element | Element |
| typedef size_t | Index |
| typedef ZeroOne< _Field > | Self_t |
| typedef _Field | Field |
| typedef _Field::Element | Element |
| typedef std::vector< Index > | IndexVector |
| typedef std::vector< IndexVector::iterator > | PointerVector |
| typedef MatrixCategories::BlackboxTag | MatrixCategory |
Public Member Functions | |
| ZeroOne (const Field &F) | |
| ZeroOne (Field &F, Index *rowP, Index *colP, Index rows, Index cols, Index NNz, bool rowSort=false, bool colSort=false) | |
| ~ZeroOne () | |
| template<class OutVector, class InVector> | |
| OutVector & | apply (OutVector &y, const InVector &x) const |
| apply. | |
| template<class OutVector, class InVector> | |
| OutVector & | applyTranspose (OutVector &y, const InVector &x) const |
| applyTranspose. | |
| size_t | rowdim () const |
| size_t | coldim () const |
| template<typename _Tp1> | |
| ZeroOne (const ZeroOne< _Tp1 > &Z, const Field &F) | |
| Iterator | Begin () |
| Iterator | End () |
| const Iterator | Begin () const |
| const Iterator | End () const |
| IndexIterator | indexBegin () |
| const IndexIterator | indexBegin () const |
| IndexIterator | indexEnd () |
| const IndexIterator | indexEnd () const |
| std::istream & | read (std::istream &is) |
| Read the matrix from a stream in the JGD's SMS format. | |
| std::ostream & | write (std::ostream &out=std::cout) |
| const Field & | field () const |
| bool | isRowSorted () const |
| bool | isColSorted () const |
| size_t | nnz () const |
| ZeroOne () | |
| ZeroOne (const Field &F) | |
| ZeroOne (const Field &F, IndexVector &index, PointerVector &indexP, Index Rowdim, Index Coldim, bool sortedBy) | |
| ZeroOne (Field &F, Index *rowP, Index *colP, Index rows, Index cols, Index NNz) | |
| The real constructor /todo give docs here assuming entries are sorted in lexicographic order by (row,col) pair. | |
| ZeroOne (const ZeroOne< Field > &A) | |
| void | switch_sort () const |
| ~ZeroOne () | |
| template<class OutVector, class InVector> | |
| OutVector & | apply (OutVector &y, const InVector &x) const |
| Uses one of the three private utility functions. | |
| template<class OutVector, class InVector> | |
| OutVector & | applyTranspose (OutVector &y, const InVector &x) const |
| Uses one of the three private utility functions, in the manner described above. | |
| size_t | rowdim () const |
| size_t | coldim () const |
| std::istream & | read (std::istream &is) |
| Read the matrix from a stream in the JGD's SMS format. | |
| std::ostream & | write (std::ostream &out=std::cout) const |
| const Field & | field () const |
| size_t | nnz () const |
| template<typename _Tp1> | |
| ZeroOne (const ZeroOne< _Tp1 > &A, const GF2 F2) | |
Data Fields | |
| IndexVector | _index |
| PointerVector | _indexP |
| Index | _rowdim |
| Index | _coldim |
| bool | sorted |
Protected Types | |
| typedef size_t | Index |
Protected Member Functions | |
| void | rowSort () const |
| Tells the number of nonzero entries. | |
| void | colSort () const |
| void | _qsort (size_t start, size_t endp1, int &mode) const |
| size_t | _part (size_t start, size_t endp1, int &mode) const |
| void | init (std::vector< std::pair< Index, Index > > &ip) |
Protected Attributes | |
| const Field * | _field |
| Element | _tmp |
| Index | _rows |
| Index | _cols |
| Index | _nnz |
| Index * | _rowP |
| Index * | _colP |
| bool | _rowSort |
| bool | _colSort |
| bool | dynamic |
Time and space efficient representation of sparse {0,1}-matrices.
A 0-1 matrix is a matrix with all 0's and 1's as entries. We're using a NAG-sparse format. Applies can be performed fast, using only additions. When initalizing this class, you only need to build 2 arrays of equal length: an array of the row indices for the non-zero (1's) entries, and an array of the column indices for the non-zero (1's) entries.
A {0, 1,-1} matrix can be effecively represented as the Dif of two ZeroOne's.
A 0-1 matrix is a matrix with all 0's and 1's as entries. We're using a comp-col or comp-row format. That is we have an array of col indices and an array of pointers indicating where the col indices for each row begins within the col index array. (or vice versa if we have sorted by columns.
Applies can be performed fast, using only additions. When initalizing this class, you only need to build 2 arrays of equal length: an array of the row indices for the non-zero (1's) entries, and an array of the column indices for the non-zero (1's) entries.
A {0, 1,-1} matrix can be effecively represented as the Dif of two ZeroOne's.
|
protected |
| typedef _Field Field |
| typedef _Field::Element Element |
| typedef size_t Index |
| typedef _Field Field |
| typedef _Field::Element Element |
| typedef std::vector<Index> IndexVector |
| typedef std::vector<IndexVector::iterator> PointerVector |
| typedef MatrixCategories::BlackboxTag MatrixCategory |
| enum howToSort |
| ZeroOne | ( | Field & | F, |
| Index * | rowP, | ||
| Index * | colP, | ||
| Index | rows, | ||
| Index | cols, | ||
| Index | NNz, | ||
| bool | rowSort = false, | ||
| bool | colSort = false ) |
|
inline |
|
inline |
|
inline |
|
inline |
The real constructor /todo give docs here assuming entries are sorted in lexicographic order by (row,col) pair.
|
inline |
|
inline |
apply.
Uses one of the three private utility functions. It calls the generalized utility function _apply if there is no special ordering, _fyapply if there is C_ordering or _fxapply if there is fortran_ordering
|
inline |
applyTranspose.
Uses one of the three private utility functions, in the manner described above. Worthy of note is the fact that applyTranspose works by passing the column positions to the _apply functions as if they were rows, and row positions as if they were columns, as if the matrix had been transposed.
|
inline |
|
inline |
|
inline |
Read the matrix from a stream in the JGD's SMS format.
| is | Input stream from which to read the matrix |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
Tells the number of nonzero entries.
Non blackbox function.
|
protected |
|
protected |
QuickSort function for when there is no sorting
|
protected |
Partition for quicksort
|
inline |
| OutVector & apply | ( | OutVector & | y, |
| const InVector & | x ) const |
Uses one of the three private utility functions.
It calls the generalized utility function _apply if there is no special ordering, _fyapply if there is C_ordering or _fxapply if there is fortran_ordering
| OutVector & applyTranspose | ( | OutVector & | y, |
| const InVector & | x ) const |
Uses one of the three private utility functions, in the manner described above.
Worthy of note is the fact that applyTranspose works by passing the column positions to the _apply functions as if they were rows, and row positions as if they were columns, as if the matrix had been transposed.
|
inline |
|
inline |
|
inline |
Read the matrix from a stream in the JGD's SMS format.
| is | Input stream from which to read the matrix |
|
inline |
|
inline |
|
inline |
|
protected |
The field used by this class
|
protected |
|
protected |
number of columns
|
protected |
Number of Non-Zero elements in the Matrix. It also happens to be the length of the three NAGSparse arrays.
|
mutableprotected |
pointer to an array of row indexes.
|
mutableprotected |
pointer to an array of column indexes. (_rowP and _colP are the other arrays of a NAGSparse format Matrix.)
|
mutableprotected |
|
mutableprotected |
status flags for sorting state
|
protected |
|
mutable |
|
mutable |
| Index _rowdim |
| Index _coldim |
|
mutable |