Go to the
previous,
next chapter.
This file defines all operations concerning real matrices and introduces the new
data type
MATRIX
.
- Data Type:
MATRIX Variable [(Rows,Columns)]
- Declares Variable as real matrix.
The optional parameters Rows and Columns denote the initial
dimensions of the matrix.
If the initial dimensions are missing, no memory is allocated for the matrix elements
(this will be done after the matrix is resized or after the first assignment to
the matrix).
The basic operations +, -, *, and /, the unary operators
+ and - as well as +=, -=, *=, and /= are
defined for real matrices.
Comparisons of real matrices are possible with ==, !=, <, <=,
>, and >=. All comparisons are performed componentwise and the result of a
vector comparison is true, if it is true for all components. Otherwise the result is
FALSE
.
If i and j are INT
expressions and M a matrix,
v(i,j) denotes the element in the i-th row
and j-th column of the matrix M
.
Additionally, the following functions are provided:
- Function:
INT RowDimension (MATRIX M)
- Returns the current row dimension of M.
- Function:
INT ColDimension (MATRIX M)
- Returns the current column dimension of M.
- Function:
void Resize (MATRIX M, INT i, INT j)
- Discards the old elements of M and resizes M to contain
i rows and j columns.
- Function:
void MakeTemporary (MATRIX M)
- Changes the temporary variable M into a permanent one.
See section Configuration, for details.
- Function:
void MakePermanent (MATRIX M)
- Changes the temporary variable M into a permanent one.
See section Configuration, for details.
- Function:
void Clear (MATRIX M)
- Initializes all elements of M with 0.
- Function:
void Initialize (MATRIX M, REAL r)
- Initializes all elements of M with r.
- Function:
VECTOR Row (MATRIX M, INT i)
- Returns the i-th row of the matrix M.
- Function:
VECTOR Col (MATRIX M, INT i)
- Returns the i-th column of the matrix M.
- Function:
void SetRow (MATRIX M, INT i, VECTOR v)
- Sets the i-th row of the matrix M to the vector v.
- Function:
void SetCol (MATRIX M, INT i, VECTOR v)
- Sets the i-th column of the matrix M to the vector v.