cs32310 matrices 1. vector vs matrix transformation formulae geometric reasoning allowed us to...

Post on 26-Dec-2015

220 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

CS32310

MATRICES

2

Vector vs Matrix transformation formulae

• Geometric reasoning allowed us to derive vector expressions for the various transformation formulae

• For efficiency reasons, the transformation formulae are usually executed in matrix form

3

Example comparison

• Consider the scaling formula, for scaling the component of vector r in the ŝ direction:

• What is the operation count for executing this formula?

4

5

• The operation count (mults,adds) = (7,6) is for the transformation of one vector.

• 3 sequential scalings (in directions ŝ1, ŝ2, ŝ3 for factors α1, α2, α3) for 1000 points Cost: 3000(7,6) = 39000 operations.

• Slightly reduced cost by evaluating (α-1)ŝ once for each scaling operations (cost: 3(3,1)), and reusing these results of every point. Resulting cost:

3(3,1) + 3000(6,5) = 33012 operations

6

Derivation of Matrix form

• Take x, y, z components of the vector scaling formula

This leads to (with )

7

Derivation of Matrix form

• Regrouping the component formulae for

leads to (with )

8

Derivation of Matrix form

• Recognise the equivalent matrix formulation of

(with )

9

Derivation of Matrix form

10

11

Op count of Matrix form

• Cost of setting up the matrix– (10,3) for the scaling matrix

• Cost of doing one matrix multiplication A r– 3(3,2) = (9,6) – 3 elements of a 3 x 1 matrix to be computed– Same operations as for the written out form

12

Op count of Matrix form

• Consider carrying out 3 successive scaling operations in tandem

13

14

Op count of Matrix form

No gain over vector approach – not this way!

15

Op count of Matrix form

• Consider carrying out 3 successive scaling operations

by successive substitution and concatenation:

16

17

Op count of Matrix form

18

Op count of Matrix formBack to 35

19

Op count of Matrix form

• Each of the formulae is linear and homogeneous in the vector r

• Each follows the pattern

• can be expressed in matrix form

20

Op count of Matrix form

• or

• Details of the operation (in A) are separated from the details of the point being transformed (operand r)

• Abstraction!• Concatenation possible

21

Matrix Product

• Motivation for product formula• Let

Then

22

Matrix Product

Thus

where

23

Matrix Product

Thus we can write C = BA

where

Inner product of row i and column j.Op count: (3,2) in this case.

24

25

Matrix Product

In general, if C = BAB and A must satisfy a compatibility constraint: No of columns in first factor (row length)

= No of rows in second factor (col

length)

26

27

Matrix Algebra

• Vectors and Matrices are branches of Linear Algebra

28

29

30

31

Matrix Transposition

See http://en.wikipedia.org/wiki/Transpose

32

Matrix Transposition Examples

33

Matrix block multiplication

34

Matrix block multiplication

35

Linear Mapping propertyTable 5

36

Derivation of Matrix form II

37

38

39

40

Summary

top related