Game Development Reference
In-Depth Information
(Of course, this assumes that the sizes of
A
,
B
, and
C
are such that
multiplication is allowed. Note that if (
AB
)
C
is defined, then
A
(
BC
)
is always defined as well.) The associativity of matrix multiplication
extends to multiple matrices. For example,
ABCDEF
= ((((
AB
)
C
)
D
)
E
)
F
=
A
((((
BC
)
D
)
E
)
F
)
= (
AB
)(
CD
)(
EF
).
It is interesting to note that although all parenthesizations compute
the correct result, some groupings require fewer scalar multiplications
than others.
1
•
Matrix multiplication also associates with multiplication by a scalar
or a vector:
(k
A
)
B
= k(
AB
) =
A
(k
B
),
(
vA
)
B
=
v
(
AB
).
•
Transposing the product of two matrices is the same as taking the
product of their transposes in reverse order:
(
AB
)
T
=
B
T
A
T
.
This can be extended to more than two matrices:
M
n−1
M
n
)
T
=
M
n
T
M
n−1
T
M
2
T
M
1
T
.
(
M
1
M
2
4.1.7
Multiplying a Vector and a Matrix
Since a vector can be considered a matrix with one row or one column, we
can multiply a vector and a matrix by applying the rules discussed in the
previous section. Now it becomes very important whether we are using row
or column vectors. Equations (4.4)-(4.7) show how 3D row and column
vectors may be pre- or post-multiplied by a 3 × 3 matrix:
1
The problem of finding the parenthesization that minimizes the number of scalar
multiplications is known as the matrix chain problem.
Search WWH ::
Custom Search