Multiplies one- or two-dimensional floating point arrays which are interpreted as matrices.
Mat Mul a()=b()*c() or
Mat Mul x=a()*b() or
Mat Mul a(),x
a(),b(),c():names of one- or two-dimensional floating point arrays
x:aexp
Mat Mul a()=b()*c() is intended for 'related' matrices of the same order. Matrices b() and c() are multiplied. The result of this multiplication is written to matrix a(). In order to get a product of a matrix multiplication, the matrix on the left (in this case matrix b()) must have the same number of columns as the matrix on the right (in this case c()) has rows.
The matrix a() must, in this example, have the same number of rows as b() and the same number of columns as c(), i.e. Dim a(2,2),b(2,3),c(3,2)
Matrices are multiplied using the formula 'rows times columns'. I.e. the elements in a(i,j) are obtained by multiplying the elements of the i-th row in matrix b() with the j-th column in matrix c() and the individual products are added up. If vectors are used instead of matrices, Mat Mul a()=b()*c() produces the dyadic product of two vectors.
Mat Mul x=a()*b() is intended for vectors with the same number of elements. The result x is the scalar product of vectors a() and b(). The scalar product of two vectors is defined as the sum of n products a(i)*b(i), i=1,...,n.
Mat Mul a(),x multiplies the matrix or vector a() with the expression x.
OpenW # 1
Global Double a(1 .. 2, 1 .. 2)
Global Double b(1 .. 2, 1 .. 3)
Global Double c(1 .. 3, 1 .. 2)
Mat Set b() = 1
Data 1,2,-3,4,5,-1
Mat Read c()
Mat Print b(), 5, 1
Print String$(18, "-")
Mat Print c(), 5, 1
Print String$(18, "-")
Mat Mul a() = b()*c()
Mat Print a(), 5, 1
Erase a(), b(), c()
...and...
Global Double a(1 .. 3, 1 .. 3
Global Double b(1 .. 3), c(1 .. 3)
Data 1,2,-3,4,5,-1
Mat Read b()
Mat Read c()
Mat Print b(), 5, 1
Print String$(18, "-")
Mat Print c(), 5, 1
Print String$(18, "-")
Mat Mul a() = b()*c()
Mat Print a(), 5, 1
Erase a(), b(), c()
...and...
OpenW 1 // Mat Mul x = a()*b()
Global Double b(1 .. 3), c(1 .. 3), x%
Data 1,2,-3,4,5,-1
Mat Read b()
Mat Read c()
Mat Print b(), 5, 1
Print String$(18, "-")
Mat Print c(), 5, 1
Print String$(18, "-")
Mat Mul x = b()*c()
Print x
Erase b(), c()
-
{Created by Sjouke Hamstra; Last updated: 14/10/2014 by James Gaite}