DEFINITION MODULE MatDeclare;
(*******************************************************************
Module MatDeclare (Version 1.0)
Copyright (c) 1990-2006 by Andreas Fischlin, Olivier Roth and
ETH Zurich.
Purpose Manage real matrices.
Remarks The particular purpose of this module is the
instantiation/declaration of matrix objects.
Access, calculations, and other operations on
or with matrices are provided by various other
modules of the Mat-library.
Note, for the time-being only matrices of limited
size are supported, i.e. with a maximum of 8000
elements.
This module is part of the Mat-library, which forms
part of the RAMSES package.
Programming
o Design
Andreas Fischlin 28/05/1993
Olivier Roth 24/04/1990
o Implementation
Andreas Fischlin 28/05/1993
ETH Zurich
Systems Ecology
CHN E 35.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND
URLs:
<mailto:RAMSES@env.ethz.ch>
<http://www.sysecol.ethz.ch>
<http://www.sysecol.ethz.ch/SimSoftware/RAMSES>
Last revision of definition: 28/05/1993 AF
*******************************************************************)
FROM Matrices IMPORT Matrix, Cell, Selection;
VAR
notExistingMatrix: Matrix; (* read only variable! *)
(* Read only variable which may be used for variables of type
* Matrix to denote that the associated matrix is actually not
* existing, i.e. has not been declared via a call to
* DeclMatrix. It is a recommended programing practice to
* assign notExistingMatrix to any variable of type Matrix in
* the body of the module, which owns the matrix variable. *)
PROCEDURE DeclMatrix( VAR m: Matrix;
nRows, nCols: INTEGER;
name : ARRAY OF CHAR );
(* declares a dynamic matrix with the dimensions [1..nRows,1..nCols]
* and stores its "name".
* If the matrix cannot be allocated (i.e. insufficent memory) "m" returns
* the value "notExistingMatrix". *)
PROCEDURE MatrixExists( m: Matrix ): BOOLEAN;
PROCEDURE RemoveMatrix( VAR m: Matrix );
PROCEDURE SetMatrixDim( VAR m: Matrix; nRows, nCols: INTEGER );
PROCEDURE GetMatrixDim( m: Matrix; VAR nRows, nCols: INTEGER );
(* the two procedures allow to set/get the matrix "m"'s dimension.
*
* Note: SetMatrixDim does NOT copy any data and it may even loose
* the existing ones (i.e. when the new dimensions exceed the
* originally allocated space), it only ensures that enough memory
* is allocated for the specified dimensions. If the data should be
* conserved use procedures "Delete/InsertMatrixRow/col". If the
* dimensions are too big and exceed the maximum number of elements
* a matrix may contain when calling SetMatrixDim, the dimensions
* are actually reduced to a 0x0 matrix (yet, data are not touched).
* Be also aware that SetMatrixDim never frees memory; to reduce
* the allocated memory to what is really needed make a copy of the
* matrix with procedure CopyMatrix and throw away the old one. *)
END MatDeclare.