Graphics Reference
In-Depth Information
APPENDIX
B
Background Information
and Techniques
B.1
Vectors and matrices
A
vector
is a one-dimensional list of values. This list can be shown as a row vector or a column vector
2
3
a
b
c
4
5
½abc
(B.1)
2
3
abc
def
ghi
4
5
(B.2)
Matrices are multiplied together by taking the
i
th row of the first matrix and multiplying each
element by the corresponding element of the
j
th column of the second matrix and summing all
the products to produce the
i
,
j
th element. When computing
C ¼ AB
, where
A
has
v
elements
in each row and
B
has
v
elements in each column, an element
C
ij
is computed according to
C
ij
¼ A
i
1
B
1
j
þ A
i
2
B
2
j
þ A
i
3
B
3
j
þ ...þ A
iv
B
vj
X
v
k¼
1
A
ik
B
kj
(B.3)
¼
The “inside” dimension of the matrices must match in order for the matrices to be multiplied
together. That is, if
A
and
B
are multiplied and
A
is a matrix with
U
rows and
V
columns (a
U V
matrix), then
B
must be a
V W
matrix; the result will be a
U W
matrix. In other words, the number
of columns (the number of elements in a row) of
A
must be equal to the number of rows (the number of
elements in a column) of
B.
As a more concrete example, consider multiplying two 3
3 matrices.
Equation B.4
shows the computation for the first element.
Search WWH ::
Custom Search