Matrix Math Toolbox
This section describes the six FUNCTION procedures supported by the Matrix
Math toolbox.
* MatAdd FUNCTION
* MatSub FUNCTION
* MatMult FUNCTION
* MatDet FUNCTION
* MatInv FUNCTION
* MatSEqn FUNCTION
Matrix Math is the name of a BASIC toolbox (MATB.BAS) included with
Microsoft BASIC. The toolbox contains a set of matrix-manipulation
procedures that perform math operations on two-dimensional matrixes. There
is a separate toolbox procedure for each supported numeric data type. Which
one to use depends on the data type of the elements in the matrix. The last
letter in the procedure name identifies the data type of the procedure, as
follows.
Letter Numeric data type
I Integer
S Single precision floating point
C Currency
L Long integer
D Double precision floating point
All numeric data types are supported by MatAdd, MatSub, MatMult, and MatDet.
Integer and long integer data types are not supported by MatInv and MatSEqn.
Each procedure returns a result code that indicates the success of the
operation, or, in the case of an error, the nature of the problem
encountered. The following result codes are defined.
Result code Significance
0 Normal completion. No error occurred.
- 1 Determinant for matrix is 0. No inverse of the input matrix
exists.
- 2 Matrix not square; doesn't have same number of rows as
columns.
- 3 Inside dimension not the same. The number of columns in
matrix1 is not the same as the number of rows in matrix2.
- 4 Matrixes not of the same dimension. That is, there are not
the same number of rows in matrix1 that are in matrix2 or there are not the
same number of columns in matrix1 that are in matrix2.
- 5 Dimensions for the solution matrix not correctly declared.
The matrix does not have the proper number of rows and columns.
Note
----
By default all arrays are zero based; that is, the lower bound of an array
is 0. You may wish to use OPTION BASE 1 so that the numbers in the DIM
statement accurately reflect the number of row and column elements in your
matrixes.
Following is a description of the FUNCTION procedures in the Matrix Math
toolbox.