linbox
PlainSubmatrix< MatDom > Class Template Reference

to be used in reference matrix domain (PlainDomain). More...

#include <plain-matrix.h>

Public Types

typedef PlainSubmatrix< MatDom > Self_t
 
typedef MatDom MatrixDomain
 
typedef size_t Index
 
typedef MatrixDomain::Scalar Entry
 

Public Member Functions

Index rowdim () const
 
Index coldim () const
 
const MatrixDomaindomain () const
 
const MatrixDomainfield () const
 
EntrygetEntry (Entry &x, Index i, Index j) const
 
const EntrysetEntry (Index i, Index j, const Entry &x)
 
void submatrix (const Self_t &A, Index i, Index j, Index m, Index n)
 
Self_tzero ()
 
Self_tidentity ()
 
Self_trandom ()
 
std::istream & read (std::istream &is)
 
std::ostream & write (std::ostream &os) const
 
 PlainSubmatrix ()
 
 PlainSubmatrix (const Self_t &A)
 
Self_tcopy (const Self_t &B)
 
Self_toperator= (const Self_t &B)
 

Protected Attributes

Entryrep_
 
const MatrixDomaindomain_
 
Index rows_
 
Index cols_
 
Index row_stride_
 

Detailed Description

template<class MatDom>
class LinBox::PlainSubmatrix< MatDom >

to be used in reference matrix domain (PlainDomain).

Matrix variable declaration, sizing, entry initialization may involve one to 3 steps. Matrix ops are container ops. (sizing, copying)

Mathematical operations are to be found only in an associated matrix domain ). (exceptions are some use of domain scalars in, eg., zero(), random(), setEntry(), getEntry().

A Submatrix does not allocate heap memory. It shares (subset of) the memory of a (memory allocating) DenseMatrix. When a DenseMatrix goes out of scope or is reinitialized with init(), the memory is released and all Submatrices of it become invalid.

Allocating: Given a matrix domain, MatDom MD,

MatDom::Matrix A(MD, 2, 3); // allocation of mem for 6 entries at construction MatDom::Matrix B; B.init(MD, 10, 10); // default constr and subsequent allocation.

Allocation of memory plus entry initialization: // a meaningful value of DenseMatrix::Entry x is set by a field. MatDom::Matrix B(A); // allocation at copy construction. A could be a submatrix of another. MatDom::Matrix A; A.read(stream); // allocation at read time. MatDom::Submatrix A(MD, n, m); A.read(stream); // no allocation at read time. Shape must match.

Nonallocation sizing: MatDom::Submatrix S,T; S.submatrix(A, 1, 0, 2, A.coldim()); // S is second 2 rows of A T.submatrix(S, 0, S.coldim()-2, 2, 2); // T is 2by2 at right end of S, shares mem with S and A.

Entry initialization (and overwriting) in already sized matrices: S.setEntry(i, j, x); S.copy(B); S = B; // A and B must have the same shape. S.read(stream); // A and matrix in stream must have the same shape.

Entry read access. OK on const matrices S.getEntry(x,i,j), S.write(stream)

Member Typedef Documentation

◆ Self_t

template<class MatDom>
typedef PlainSubmatrix<MatDom> Self_t

◆ MatrixDomain

template<class MatDom>
typedef MatDom MatrixDomain

◆ Index

template<class MatDom>
typedef size_t Index

◆ Entry

template<class MatDom>
typedef MatrixDomain::Scalar Entry

Constructor & Destructor Documentation

◆ PlainSubmatrix() [1/2]

template<class MatDom>
PlainSubmatrix ( )
inline

◆ PlainSubmatrix() [2/2]

template<class MatDom>
PlainSubmatrix ( const Self_t & A)
inline

Member Function Documentation

◆ rowdim()

template<class MatDom>
Index rowdim ( ) const
inline

◆ coldim()

template<class MatDom>
Index coldim ( ) const
inline

◆ domain()

template<class MatDom>
const MatrixDomain & domain ( ) const
inline

◆ field()

template<class MatDom>
const MatrixDomain & field ( ) const
inline

◆ getEntry()

template<class MatDom>
Entry & getEntry ( Entry & x,
Index i,
Index j ) const
inline

◆ setEntry()

template<class MatDom>
const Entry & setEntry ( Index i,
Index j,
const Entry & x )
inline

◆ submatrix()

template<class MatDom>
void submatrix ( const Self_t & A,
Index i,
Index j,
Index m,
Index n )
inline

◆ zero()

template<class MatDom>
Self_t & zero ( )
inline

◆ identity()

template<class MatDom>
Self_t & identity ( )
inline

◆ random()

template<class MatDom>
Self_t & random ( )
inline

◆ read()

template<class MatDom>
std::istream & read ( std::istream & is)
inline

◆ write()

template<class MatDom>
std::ostream & write ( std::ostream & os) const
inline

◆ copy()

template<class MatDom>
Self_t & copy ( const Self_t & B)
inline

◆ operator=()

template<class MatDom>
Self_t & operator= ( const Self_t & B)
inline

Field Documentation

◆ rep_

template<class MatDom>
Entry* rep_
protected

◆ domain_

template<class MatDom>
const MatrixDomain* domain_
protected

◆ rows_

template<class MatDom>
Index rows_
protected

◆ cols_

template<class MatDom>
Index cols_
protected

◆ row_stride_

template<class MatDom>
Index row_stride_
protected

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