Ch 19 - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Ch 19

Description:

Now what do I do with it? -Ways to confuse ourselves with Matrices (i.e. ... Keanu Reeves dodging bullets? A rectangular array of elements? Ex. A = NO. YES ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 23
Provided by: cosc3
Category:
Tags: keanu | reeves

less

Transcript and Presenter's Notes

Title: Ch 19


1
Ch 19
By Jon Stone
Prepare to enter the wonderful and exciting world
of
...MATRICES
holy cow
2
Matrices
The table of contents your guide to my slides
-What? You dont know what a Matrix is? -A box
with numbers. Wow. Now what do I do with
it? -Ways to confuse ourselves with Matrices
(i.e. adding boxes). -They come in all different
shapes and sizes, too. -Presentation break,
brought to you by the A-Teams very own
gold-bearing, flight fearing powerhouse, Mr.
T. -How Java uses and abuses our friend the
Matrix (primitive data types and abstract data
types) -Where did I get this stuff anyway?
3
Matrices
What? You dont know what a Matrix is?
So what is a matrix?
Keanu Reeves dodging bullets?
NO
A rectangular array of elements?
YES
An element aij is said to be located at the ith
row and jth column, thus the element in the 2nd
row, 1st column is a21 or 21. The size of the
matrix is said to be ixj, or 3x3 in the shown
example.
Ex. A
4
A box with numbers. Wow. Now what do I
do with it?
Matrices
Matrices have many uses. -Mathematics
(simultaneous equations, etc.) -Finance
-Modeling (for air traffic control, et al)
-Games (Tetris, Columns, Dr Mario, etc.) -Areas
of use from the Matrix Market..
Check out the market
5
Ways to confuse ourselves with Matrices (i.e.
adding boxes with numbers in them)
Matrices
Matrix Addition
Both matrices must be the same size
6
Ways to confuse ourselves with Matrices (i.e.
adding boxes with numbers in them)
Matrices
Matrix Multiplication Where A is size ixk
and B is kxj
7
Ways to confuse ourselves with Matrices (i.e.
adding boxes with numbers in them)
Matrices
Matrix Multiplication
Order of complexity depends on algorithm
Basic algorithm for square matrix consists of
O(n3) multiplications -n2 elements, n
multiplications for each element ABC A40x20
B20x10 C10x50
(AB)C gt AB(402010) 8,000 multiplications
(AB-new 40x10)C gt (401050) 20,000 .so
28K multiplications A(BC) gt BC(201050)
10,000 multiplications A(BC-new 20x50) gt
402050 40,000 .so 50K multplications
8
Ways to confuse ourselves with Matrices (i.e.
adding boxes with numbers in them)
Matrices
The Transpose
The transpose of a an mxn matrix is the nxm
matrix found by interchanging the rows and
columns of the matrix
9
Matrices
They come in all different shapes and sizes, too
The identity matrix
The indentity matrix of order n is an nxn matrix
containing 1s on its diagonal, and 0s in all
other positions
I3
10
Matrices
They come in all different shapes and sizes, too
The symmetric matrix
A matrix is symmetric when A A , or aij aji
T
An example of a symmetric matrix A
11
Matrices
They come in all different shapes and sizes, too
The Binary (Zero-One) Matrix
A matrix whose elements consists of only 1s or
0s.
Binary matrices of the same size may be ORed and
ANDed. The boolean product functions just as
matrix multiplication, but with ANDs substituted
for multiplication and ORs substituted for
addition. No example given. Look it up.
12
Matrices
They come in all different shapes and sizes, too
Upper Triangular Matrix
An nxn matrix where aij 0 whenever i gt j
13
Matrices
They come in all different shapes and sizes, too
Other Types
Check out the Matrix Market. Fulfill all your
matrix needs at one website.
Lets go matrix shopping.
Including my personal favorite. ??
Yeah, thats a ding dong!
?? Dont forget about FRANK!
14
Matrices
Presentation Break
Let the awe-inspiring countenance of Mr. T. take
you away
15
Enough of that jibba jabba! You suckas need a
break!
Mr. T.
16
Matrices
How Java uses and abuses our friend the Matrix
Declaration of primitive data type int A
new int23 or int A 2,5,6,
9,8,10
17
Matrices
How Java uses and abuses our friend the Matrix
In memory
00
01
10
00
01
10
11
20
21
11
20
21
18
Matrices
How Java uses and abuses our friend the Matrix
The Matrix ADT Tims Matrix ADT methods
elementAt(int i, int j) -returns Object at
location i,j
numberColumns() -returns int number of
columns
numberRows() -returns int number of columns
setElementAt(Object o, int i, int j) -void
return, loads object at i,j
setSize(int row, int column) -void return,
resizes matrix
19
Matrices
How Java uses and abuses our friend the Matrix
The Matrix ADT symantec.itools.awt.Matrix methods
addElement(object, int, int)
object elementAt(int i, int j)
enumeration elements()
insertRow(int)
printRow(int)
removeAllElements()
removeElementAt(int,int)
removeRow(int)
int rows()
sort(CompareFunc, int)
string toString()
updateElement(int,int,Object)
sort() sorts row into ascending order by
comparing column values
update() adds or updates the indicated element as
necessary
20
Matrices
How Java uses and abuses our friend the Matrix
The Sparse Matrix
Why use it? It saves space!
Why not use it? Horrible for multiplication and
other such uses.
How is it stored? Creates new matrix with three
columns, and number of non-zero elements plus one
rows. First row indicates size. Other rows
contain row location, column location, element.
21
Matrices
How Java uses and abuses our friend the Matrix
Noninteger Keys
A map of maps allows strings or other objects to
be used to identify locations in a matrix.
22
Matrices
Where did I get this stuff from anyway? (aka
Resources)
The Mr. T Resource Archive ttp//sucka.50megs.com
/ The Official Matrix Site ttp//whatisthematrix.
warnerbros.com Textures Archive
ttp//www.grsites.com/textures/beige001.shtml Plan
et Twinkie ttp//www.twinkies.com Matrix Market
ttp//math.nist.gov/MatrixMarket/ DeWitt
Industries ttp//www.dewittindustries.com
Classic Data Structures in Java - Timothy Budd
Addison Wesley 2001
Discrete Mathematics and its Applications
Kenneth H. Ross
American Telepone and Telegraph Company 1999
Write a Comment
User Comments (0)
About PowerShow.com