ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE LMatrices;


  (*******************************************************************

    Module  LMatrices     (Version 1.0)

      Copyright (c) 1995-2006 by Dimitrios Gyalistras and ETH Zurich.

    Purpose   Manage double precision matrices and vectors, 
              various operations (matrix dimensions up to 62 x 62).

    Remarks   --


    Programming

      o Design
        Dimitrios Gyalistras      12/05/1995

      o Implementation
        Dimitrios Gyalistras      12/05/1995


    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:  14/09/1999  AF

  *******************************************************************)


   CONST
     MaxElems = 62;

   TYPE
     LVector    = ARRAY [1..MaxElems] OF LONGREAL;
     LVectorPtr = POINTER TO LVector;

   TYPE
     LMatrix    = ARRAY [1..MaxElems] OF LVector;
     LMatrixPtr = POINTER TO LMatrix;



  PROCEDURE AllocVector( VAR vec    : LVectorPtr;
                         initVal    : LONGREAL;  (* value to use for initialization *)
                         VAR errTxt : ARRAY OF CHAR ): BOOLEAN;


  PROCEDURE DeallocVector( VAR vec : LVectorPtr );



  PROCEDURE AllocMatrix( VAR mat    : LMatrixPtr;
                         initVal    : LONGREAL;  (* value to use for initialization *)
                         VAR errTxt : ARRAY OF CHAR ): BOOLEAN;


  PROCEDURE DeallocMatrix( VAR mat : LMatrixPtr );



  (***********************************************************************)



   PROCEDURE SetVector( VAR vec: LVector; val: LONGREAL );


   PROCEDURE CopyVector( VAR vec    : LVector;  (* VAR for speed-up only *)
                         nElements  : INTEGER;
                         VAR result : LVector );



   PROCEDURE MatVecProduct( VAR mat    : LMatrix;  (* VAR for speed-up only *)
                            VAR vec    : LVector; (* VAR for speed-up only *)
                            nRowsCols  : INTEGER;
                            VAR result : LVector );


  (***********************************************************************)


   PROCEDURE SetMatrixColumn( VAR mat     : LMatrix;
                              columnNr    : INTEGER;
                              VAR colData : LVector ); (* VAR for speed-up only *)


   PROCEDURE GetMatrixColumn( VAR mat     : LMatrix; (* VAR for speed-up only *)
                              columnNr    : INTEGER;
                              VAR colData : LVector );


   PROCEDURE SetMatrix( VAR mat: LMatrix; val: LONGREAL );


   PROCEDURE SetToIdentityMatrix( VAR mat: LMatrix );


   PROCEDURE IsIdentityMatrix( VAR mat   : LMatrix; (* VAR for speed-up only *)
                               nRowsCols : INTEGER;
                               tolerance : LONGREAL ): BOOLEAN;


   PROCEDURE ScaleMatrix( VAR mat   : LMatrix;
                          nRowsCols : INTEGER;
                          factor    : LONGREAL );


   PROCEDURE CopyMatrix( VAR mat    : LMatrix;  (* VAR for speed-up only *)
                         nRowsCols  : INTEGER;
                         VAR result : LMatrix );


   PROCEDURE TransposeMatrix( VAR mat    : LMatrix;  (* VAR for speed-up only *)
                              nRowsCols  : INTEGER;
                              VAR result : LMatrix );


   PROCEDURE MatrixProduct( VAR mat1   : LMatrix;  (* VAR for speed-up only *)
                            VAR mat2   : LMatrix;  (* VAR for speed-up only *)
                            nRowsCols  : INTEGER;
                            VAR result : LMatrix );


   PROCEDURE MatrixSum( VAR mat1   : LMatrix;  (* VAR for speed-up only *)
                        VAR mat2   : LMatrix;  (* VAR for speed-up only *)
                        nRowsCols  : INTEGER;
                        VAR result : LMatrix );




  PROCEDURE ReadMatrix( filename   : ARRAY OF CHAR;
                        VAR mat    : LMatrix;
                        VAR nRows  : INTEGER;
                        VAR nCols  : INTEGER;
                        VAR errTxt : ARRAY OF CHAR ): BOOLEAN;


  PROCEDURE WriteMatrix( filename   : ARRAY OF CHAR;
                         VAR mat    : LMatrix;  (* VAR for speed-up only *)
                         nRows      : INTEGER;
                         nCols      : INTEGER;
                         VAR errTxt : ARRAY OF CHAR ): BOOLEAN;


END LMatrices.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]