3Д БУМ

3Д принтеры и всё что с ними связано

Scalar Multiplication

There are two types of matrix multiplication: matrix times matrix and matrix times scalar. Before you get into multiplying matrices by other matrices, you should perform scalar multiplication because it is much easier. A scalar is simply a number such as 10, 3, or 13,142. Multiplying or dividing a matrix by a scalar is quite easy. As always, you start with the matrix and a scalar value. All you need to do to multiply the whole matrix by your scalar is take each element, multiply it by the scalar, and place it in the resulting matrix. The same principle applies for scalar division. This operation is illustrated in Figure 1.5. A good use of this technique again goes back to the example used in the addition and subtraction section.

Say your group of units takes a wrong turn and plows across a pit full of radioactive slime. This radioactive slime has the special property of removing half of the health from each unit in the group. Using scalar multiplication or division, you can perform this operation in one shot. Simply multiply the hitpoints matrix by 0.5 or divide it by 2.

~3

5

o"

3×4

5×4

0x4

12

20

o’

4

4

8

4×4

4×4

8×4

=

16

16

32

9

6

1

9×4

6×4

1×4

36

24

4

Figure 1.5 Multiplying a matrix by a scalar (a constant number).

Scalar multiplication will scale every element in the matrix by the same value.

Для любых предложений по сайту: [email protected]