linbox
PlainSubmatrix< MatDom > Class Template Reference

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

#include <plain-matrix.h>

+ Collaboration diagram for PlainSubmatrix< MatDom >:

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)


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