linbox
Public Types | Public Member Functions
SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > Class Template Reference

Sparse matrix, Coordinate storage. More...

#include <sparse-coo-implicit-matrix.h>

Public Types

typedef _Field Field
 Field.
 
typedef _Field::Element Element
 Element.
 
typedef const Element constElement
 const Element
 
typedef SparseMatrixFormat::COO::implicit Storage
 Matrix Storage Format.
 
typedef SparseMatrix< _Field, StorageSelf_t
 Self type.
 

Public Member Functions

void transposeIn ()
 In place transpose. More...
 
SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > & transpose (SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &S)
 Transpose the matrix. More...
 
size_t rowdim () const
 number of rows. More...
 
size_t coldim () const
 number of columns. More...
 
size_t size () const
 Number of non zero elements in the matrix. More...
 
constElementgetEntry (const size_t &i, const size_t &j) const
 Get a read-only individual entry from the matrix. More...
 
const ElementsetEntry (const size_t &i, const size_t &j, const Element &e)
 Set an individual entry. More...
 
ElementrefEntry (const size_t &i, const size_t &j)
 Get a writeable reference to an entry in the matrix. More...
 
template<class Format >
std::ostream & write (std::ostream &os, Format=SparseFileFormat::CSR()) const
 Write a matrix to the given output stream using field read/write. More...
 
template<class Format >
std::istream & read (std::istream &file, Format=SparseFileFormat::CSR())
 Read a matrix from the given input stream using field read/write. More...
 
template<class Vector >
Vectorapply (Vector &y, const Vector &x, const Element &a) const
 
bool consistent () const
 
 SparseMatrix ()
 Constructors. More...
 
 SparseMatrix (const _Field &F)
 Constructors. More...
 
 SparseMatrix (const _Field &F, size_t m, size_t n)
 Constructors. More...
 
 SparseMatrix (const _Field &F, size_t m, size_t n, size_t z)
 Constructors. More...
 
 SparseMatrix (const SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &S)
 Constructors. More...
 
template<typename _Tp1 , typename _Rw1 >
 SparseMatrix (const SparseMatrix< _Tp1, _Rw1 > &S, const Field &F)
 Constructors. More...
 
void resize (size_t nn)
 Constructors. More...
 
void resize (const size_t &mm, const size_t &nn, const size_t &zz)
 Constructors. More...
 
template<class _OtherStorage >
 SparseMatrix (const SparseMatrix< _Field, _OtherStorage > &S)
 Default converter. More...
 
void importe (const SparseMatrix< _Field, SparseMatrixFormat::CSR > &S)
 Conversions. More...
 
void importe (const SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &S)
 Conversions. More...
 
SparseMatrix< _Field, SparseMatrixFormat::CSR > & exporte (SparseMatrix< _Field, SparseMatrixFormat::CSR > &S)
 Export a matrix in CSR format from COO::implicit. More...
 
SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > & exporte (SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &S)
 Conversions. More...
 

Detailed Description

template<class _Field>
class LinBox::SparseMatrix< _Field, SparseMatrixFormat::COO::implicit >

Sparse matrix, Coordinate storage.

Constructor & Destructor Documentation

◆ SparseMatrix() [1/7]

SparseMatrix ( )
inline

Constructors.

Todo:
convert from other matrix.

◆ SparseMatrix() [2/7]

SparseMatrix ( const _Field &  F)
inline

Constructors.

Todo:
convert from other matrix.

◆ SparseMatrix() [3/7]

SparseMatrix ( const _Field &  F,
size_t  m,
size_t  n 
)
inline

Constructors.

Todo:
convert from other matrix.

◆ SparseMatrix() [4/7]

SparseMatrix ( const _Field &  F,
size_t  m,
size_t  n,
size_t  z 
)
inline

Constructors.

Todo:
convert from other matrix.

◆ SparseMatrix() [5/7]

SparseMatrix ( const SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &  S)
inline

Constructors.

Todo:
convert from other matrix.

◆ SparseMatrix() [6/7]

SparseMatrix ( const SparseMatrix< _Tp1, _Rw1 > &  S,
const Field F 
)
inline

Constructors.

Todo:
convert from other matrix.

◆ SparseMatrix() [7/7]

SparseMatrix ( const SparseMatrix< _Field, _OtherStorage > &  S)
inline

Default converter.

Parameters
Sa sparse matrix in any storage.

Member Function Documentation

◆ resize() [1/2]

void resize ( size_t  nn)
inline

Constructors.

Todo:
convert from other matrix.

◆ resize() [2/2]

void resize ( const size_t &  mm,
const size_t &  nn,
const size_t &  zz 
)
inline

Constructors.

Todo:
convert from other matrix.

◆ importe() [1/2]

void importe ( const SparseMatrix< _Field, SparseMatrixFormat::CSR > &  S)
inline

Conversions.

Any sparse matrix has a converter to/from CSR. A specialisation can skip the temporary CSR matrix created.

Import a matrix in CSR format to COO::implicit.

Parameters
SCSR matrix to be converted in COO::implicit

◆ importe() [2/2]

void importe ( const SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &  S)
inline

Conversions.

Any sparse matrix has a converter to/from CSR. A specialisation can skip the temporary CSR matrix created.

Import a matrix in CSR format to COO::implicit.

Parameters
SCSR matrix to be converted in COO::implicit

◆ exporte() [1/2]

SparseMatrix<_Field,SparseMatrixFormat::CSR >& exporte ( SparseMatrix< _Field, SparseMatrixFormat::CSR > &  S)
inline

Export a matrix in CSR format from COO::implicit.

Parameters
SCSR matrix to be converted from COO::implicit

◆ exporte() [2/2]

SparseMatrix<_Field,SparseMatrixFormat::COO::implicit >& exporte ( SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &  S)
inline

Conversions.

Any sparse matrix has a converter to/from CSR. A specialisation can skip the temporary CSR matrix created.

Import a matrix in CSR format to COO::implicit.

Parameters
SCSR matrix to be converted in COO::implicit

◆ transposeIn()

void transposeIn ( )
inline

In place transpose.

Not quite...

◆ transpose()

SparseMatrix<_Field,SparseMatrixFormat::COO::implicit>& transpose ( SparseMatrix< _Field, SparseMatrixFormat::COO::implicit > &  S)
inline

Transpose the matrix.

Parameters
S[out] transpose of self.
Returns
a reference to S.

◆ rowdim()

size_t rowdim ( ) const
inline

number of rows.

Returns
row dimension.

◆ coldim()

size_t coldim ( ) const
inline

number of columns.

Returns
column dimension

◆ size()

size_t size ( ) const
inline

Number of non zero elements in the matrix.

or at least the size of the _data if

Returns
size of the _data.

◆ getEntry()

constElement& getEntry ( const size_t &  i,
const size_t &  j 
) const
inline

Get a read-only individual entry from the matrix.

Parameters
iRow _colid
jColumn _colid
Returns
Const reference to matrix entry

◆ setEntry()

const Element& setEntry ( const size_t &  i,
const size_t &  j,
const Element e 
)
inline

Set an individual entry.

Setting the entry to 0 will not remove it from the matrix

Parameters
iRow _colid of entry
jColumn _colid of entry
valueValue of the new entry
Todo:
make it faster if i is 0 or m-1 ?

◆ refEntry()

Element& refEntry ( const size_t &  i,
const size_t &  j 
)
inline

Get a writeable reference to an entry in the matrix.

If there is no entry at the position (i, j), then a new entry with a value of zero is inserted and a reference to it is returned.

Parameters
iRow _colid of entry
jColumn _colid of entry
Returns
Reference to matrix entry

◆ write()

std::ostream& write ( std::ostream &  os,
Format  = SparseFileFormat::CSR() 
) const
inline

Write a matrix to the given output stream using field read/write.

Parameters
osOutput stream to which to write the matrix
formatFormat with which to write

◆ read()

std::istream& read ( std::istream &  file,
Format  = SparseFileFormat::CSR() 
)
inline

Read a matrix from the given input stream using field read/write.

Parameters
fileInput stream from which to read the matrix
formatFormat of input matrix
Returns
ref to file.

◆ apply()

Vector& apply ( Vector y,
const Vector x,
const Element a 
) const
inline
Bug:
may be 0...

◆ consistent()

bool consistent ( ) const
inline

The documentation for this class was generated from the following file: