Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS32310 MATRICES 1. Vector vs Matrix transformation formulae Geometric reasoning allowed us to derive vector expressions for the various transformation.

Similar presentations


Presentation on theme: "CS32310 MATRICES 1. Vector vs Matrix transformation formulae Geometric reasoning allowed us to derive vector expressions for the various transformation."— Presentation transcript:

1 CS32310 MATRICES 1

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 2

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? 3

4 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 5

6 Derivation of Matrix form Take x, y, z components of the vector scaling formula This leads to (with ) 6

7 Derivation of Matrix form Regrouping the component formulae for leads to (with ) 7

8 Derivation of Matrix form Recognise the equivalent matrix formulation of (with ) 8

9 Derivation of Matrix form 9

10 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 11

12 Op count of Matrix form Consider carrying out 3 successive scaling operations in tandem 12

13 13

14 Op count of Matrix form No gain over vector approach – not this way! 14

15 Op count of Matrix form Consider carrying out 3 successive scaling operations by successive substitution and concatenation: 15

16 16

17 Op count of Matrix form 17

18 Op count of Matrix form 18 BacBack 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 19

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 20

21 Matrix Product Motivation for product formula Let Then 21

22 Matrix Product Thus where 22

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. 23

24 24

25 Matrix Product In general, if C = BA B and A must satisfy a compatibility constraint: No of columns in first factor (row length) = No of rows in second factor (col length) 25

26 26

27 Matrix Algebra Vectors and Matrices are branches of Linear Algebra 27

28 28

29 29

30 30

31 Matrix Transposition 31 See http://en.wikipedia.org/wiki/Transposehttp://en.wikipedia.org/wiki/Transpose

32 Matrix Transposition Examples 32

33 Matrix block multiplication 33

34 Matrix block multiplication 34

35 Linear Mapping property 35 Table 5

36 Derivation of Matrix form II 36

37 37

38 38

39 39

40 Summary 40


Download ppt "CS32310 MATRICES 1. Vector vs Matrix transformation formulae Geometric reasoning allowed us to derive vector expressions for the various transformation."

Similar presentations


Ads by Google