MUL [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
MUL
The MUL function returns an array that is the result of multiplying two
arrays. The arrays being multiplied must be of the same numeric type and
the result array must be a different variable than either of the arrays
being multiplied. This function has the form:
MAT num_array1 = MUL(num_array2,num_array3)
where num_array1 is num_array2 multiplied by num_array3. Table 5-6 shows
the dimensions of each array in different cases.
Table 5-6. Dimensions of MUL Function Arguments and Results
----------------------------------------------------------------------------------------------
| | | |
| Dimensions of | Dimensions of | Dimensions of |
| num_array2 | num_array3 | num_array1 |
| | | (result) |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| (m,n) | (n,p) | (m,p) |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| (m,n) | (n) | (m) |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| (m) | (m,p) | (p) |
| | | |
----------------------------------------------------------------------------------------------
This function is used with the MAT = statement, with two dimensional
arrays.
Syntax
MUL(array1,array2)
Parameters
array1 Structured collection of variables of the same type.
The structure is determined when the array is declared.
array2 Structured collection of variables of the same type.
The structure is determined when the array is declared.
Examples
Example 1.
10 DIM A(2,4), B(2,3),C(3,4)
.
.
.
110 MAT A = MUL(B,C)
If B is
5 3 1
2 7 8
and C is
1 2 8 5
7 1 3 7
6 4 2 9
then A is
32 17 51 55
99 43 53 131
Example 2.
10 DIM A(2,1),B(2,4),C(4,1)
.
.
.
80 MAT A = MUL(B,C)
If B is
9 8 7 6
1 2 3 4
and C is
1
2
3
4
then A is
78
42
Example 3.
10 DIM A(1,4),B(1,3),C(3,4)
.
.
.
110 MAT A = MUL(B,C)
If B is
6 9 2
and C is
1 2 8 5
7 1 3 7
6 4 2 9
then A is
81 29 79 111
MPE/iX 5.0 Documentation