Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

MatSimple(Type) Class Reference

simple dense matrix, base=1, no arithmetic operations. More...

#include <MatSimple_Type.h>

Inheritance diagram for MatSimple(Type)::

MatSimplest_Type Mat_Type MatSimpleH_Type List of all members.

Public Methods

 MatSimple(Type) ()
 MatSimple(Type) (int nrows, int ncolumns)
 MatSimple(Type) (const MatSimple(Type) &X)
 ~MatSimple(Type) ()
void getColumn (int column_no, VecSimple(Type) &column) const
void getRow (int row_no, VecSimple(Type) &row) const
void swapRows (int row1, int row2)
void fill (Type value)
MatSimple(Type)& operator= (const Type &value)
MatSimple(Type)& operator= (const MatSimple(Type) &X)
void transpose ()
void print (Os os, const char *header=NULL, int nentries_per_line=3) const
void scan (Is is)
void printAscii (Os os, const char *header=NULL) const

Friends

Osoperator<< (Os &os, const MatSimple(Type) &x)
Isoperator>> (Is &is, MatSimple(Type) &x)

Detailed Description

simple dense matrix, base=1, no arithmetic operations.

NAME: MatSimple(Type) - simple dense matrix, base=1, no arithmetic operations

DESCRIPTION:

The class implements a standard matrix type derived from "MatSimplest(Type)". The public interface consists of various operations such as fill functions, row and column extraction, print and scan functions etc.

No arithmetic operations are used in any of the member functions. Hence this class is suited as a general matrix class for various objects. The only requirement is that the object has a constructor with no arguments so that an array of the class objects can be allocated by "new". In addition, the class must define "operator=", "operator<<" and "operator>>". Macros for generating default versions of these operators are collected in the file "default_op.h".


Constructor & Destructor Documentation

MatSimple(Type)::MatSimple_Type ( )
 

Several constructors are available. The constructor without parameters allocates no memory. To allocate the proper amount of memory at a later stage, the "redim" function inherited from MatSimplest can be used. Another constructor takes the number of rows and columns in the matrix as parameters and allocates memory for the corresponding matrix representation. Finally, a copy-constructor is available.

To initialize the matrix entries one can use the member functions "fill" or "operator()".

MatSimple(Type)::MatSimple_Type ( int nrows,
int ncolumns )
 

See documentation of one of the overloaded constructor.

MatSimple(Type)::MatSimple_Type ( const MatSimple(Type) & X )
 

See documentation of one of the overloaded constructor.

MatSimple(Type)::~MatSimple(Type) ( )
 


Member Function Documentation

void MatSimple(Type)::fill ( Type a )
 

Reimplemented in Mat(Type).

void MatSimple(Type)::getColumn ( int column_no,
VecSimple(Type) & column ) const
 

extracts a column in the matrix.

void MatSimple(Type)::getRow ( int row_no,
VecSimple(Type) & row ) const
 

extracts a row in the matrix.

MatSimple(Type) & MatSimple(Type)::operator= ( const MatSimple(Type) & X )
 

See documentation of one of the overloaded functions.

MatSimple(Type) & MatSimple(Type)::operator= ( const Type & value ) [inline]
 

the version of this function that takes another "MatSimple" as argument redimensions the matrix and sets all the entries equal to each other. The overloaded version of this function, taking a value as argument, sets all the entries in the matrix equal to this value.

void MatSimple(Type)::print ( Os os,
const char * header = NULL,
int nentries_per_line = 3 ) const
 

writes the content of the matrix in a format that can be read by "scan". See the documentation for "VecSimple scan" and "VecSimple print".

Reimplemented in Mat(Type).

void MatSimple(Type)::printAscii ( Os os,
const char * header = NULL ) const
 

Reimplemented in Mat(Type).

void MatSimple(Type)::scan ( Is is )
 

reads the matrix from an "Is". The format is documented in "VecSimple scan". A few additional examples on matrix formats are given here. First the most comprehensive form:

      [3x2] Example of a data file with much additional information such as
      indices for each matrix entry. This file is in ascii format.
      (1,1)=1.2
      (2,1)=3.4
      (3,1)=1.8
      (1,2)=11.2
      (2,2)=13.4
      (3,2)=11.8

Here is an ascii format file with as little information as possible:

      1.2 3.4 1.8 11.2 13.4 11.8
An equivalent form may be

      1.2 3.4
      1.8
      11.2 13.4 11.8
To read this matrix, the dimensions must be known on beforehand. Finally we show a binary file with a header. To indicate a binary number (f.ex. 8.1) we use the notation [B8.1].

      [2x3]b my matrix $@[B3][B4][B1.2][B3.4][B1.8][B11.2][B13.4][B11.8]

Reimplemented in Mat(Type).

void MatSimple(Type)::swapRows ( int row1,
int row2 )
 

swaps "row1" and "row" in the matrix.

void MatSimple(Type)::transpose ( )
 

transposes the matrix.

Reimplemented in Mat(Type).


Friends And Related Function Documentation

Os & operator<< ( Os & os,
const MatSimple(Type) & x ) [friend]
 

defined in terms of the "print" function.

Is & operator>> ( Is & is,
MatSimple(Type) & x ) [friend]
 

defined in terms of the "scan" function.


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.