linbox
Public Types | Public Member Functions
DenseMat< _Element > Class Template Reference

to be used in standard matrix domain More...

#include <dense-matrix.h>

Public Types

typedef DenseMat< _Element > Self_t
 Self type.
 

Public Member Functions

void submatrix (const DenseMat &A, size_t i, size_t j, size_t m, size_t n)
 Set this to be an m by n submatrix of A with upper left corner at i,j position of A. More...
 
template<class Field >
std::istream & read (std::istream &file, const Field &field)
 Read the matrix from an input stream. More...
 
template<class Field >
std::ostream & write (std::ostream &os, const Field &field, bool mapleFormat=false) const
 Write the matrix to an output stream. More...
 
std::ostream & write (std::ostream &os, bool mapleFormat=false) const
 Write the matrix to an output stream. More...
 

Detailed Description

template<class _Element>
class LinBox::DenseMat< _Element >

to be used in standard matrix domain

Matrix variable declaration, sizing, entry initialization may involve one to 3 steps. Matrix ops are container ops. (sizing, copying) Mathematically meaningful operations are to be found only in an associated matrix domain

A matrix may be allocated or not. A matrix initialized by a submatrix() call is not allocated. When an allocated matrix goes out of scope or is reinitialized with init(), the memory is released and all submatrices of it become invalid.

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

Allocation of memory plus entry initialization: // a meaningful value of DenseMat::Entry x is set by a field or matrix domain. DenseMat A(10, 10, x); DenseMat B: B.init(10, 10, x); DenseMat C(A); // allocation at copy construction. A could be a submatrix of another. A.read(istream)

Nonallocation sizing: // assume D declared, A initialized, n = A.coldim(). D.submatrix(A, 0, 1, 2, n-1); // D is 2 by n-1 in upper right of A.

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

Entry read access. OK on const matrices getEntry, write

Under consideration: Require A.clear() on an allocated matrix before any action that would abandon the allocated mem (init or submatrix).

Member Function Documentation

void submatrix ( const DenseMat< _Element > &  A,
size_t  i,
size_t  j,
size_t  m,
size_t  n 
)
inline

Set this to be an m by n submatrix of A with upper left corner at i,j position of A.

Requires i+m <= A.rowdim(), j+n <= A.coldim().

For instance, B.submatrix(A, i, 0, 1, A.coldim()) makes B the i-th row of A.

std::istream & read ( std::istream &  file,
const Field &  field 
)

Read the matrix from an input stream.

Parameters
fileInput stream from which to read
field
std::ostream & write ( std::ostream &  os,
const Field &  field,
bool  mapleFormat = false 
) const

Write the matrix to an output stream.

Parameters
osOutput stream to which to write
field
mapleFormatwrite in Maple(r) format ?
std::ostream & write ( std::ostream &  os,
bool  mapleFormat = false 
) const

Write the matrix to an output stream.

This a raw version of write(os,F) (no field is given).

Parameters
osOutput stream to which to write
mapleFormatwrite in Maple(r) format ?

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