Civil Engineering Reference
In-Depth Information
the resulting vector v T would be of shape (1,3).
Matrix multiplication: The multiplication of two matrices of shapes (1,3) and (3,2)
gives a result of shape (1,2). For example
a
a
ª
º
11
12
>
@
>
@
«
»
T
(2.4)
v
A
v
v
v
a
a
v
a
v
a
v
a
,
v
a
v
a
v
a
x
y
z
«
21
22
»
x
11
y
21
z
31
x
12
x
22
x
32
a
a
¬
¼
31
32
translates into
B= MATMUL (VT,A)
It is obvious that for matrix multiplication to be possible, the shapes of the matrices to
be multiplied have to obey certain rules.
Vector dot product: The vector “dot” product of two vectors
v
v
1
x
2
x
°°
°°
(2.5)
v
v
;
v
v
®¾
®¾
1
1
y
2
2
y
°°
°°
v
v
¯¿
¯¿
1
z
2
z
is a scalar and is defined as:
x
x
vv
vv
vv
vv
(2.6)
1
2
1
x
2
x
1
y
2
y
1
z
2
z
this translates into
X= DOT_PRODUCT (V1,V2)
Maximum value in an array: To find the element of array A in (2.2) which has the
maximum value one writes
AMAX= MAXVAL (A)
Location of maximum value: To find the location of the maximum element of array A ,
NMAX, execute the statement
NMAX= MAXLOC (A)
Upper bound of an array: Sometimes it is useful for the program to find out what
shape an array had when it was assigned. This will be used extensively in
SUBROUTINES in order to reduce parameter lists. The statement
Search WWH ::




Custom Search