(10) MultiArrays (Sina)

(10) MultiArrays (Sina) - More on Multidimensional Arrays...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
More on Multidimensional Arrays Sina Meraji Fall 2009
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Review 1 0 1 1 0 2 0 1 3 2 0 0 2 0 0 0 1 1 0 1 0 0 2 0 2 3 3 2 2 2 3 3 3 2 2 2 2 3 3 2 2 2 3 3 3 3 2 2 Occupancy Capacity 1 2 3 4 5 6 Column Indices 4 3 2 1 Row Indices 1 2 3 4 5 6 12 INTEGER :: Hotel_Elephant (2,4,6) Hotel_Elephant ( table , floor , room ) Hotel_Elephant ( 1 , 2 , 5 ) Hotel_Elephant ( 2 , 2 , 5 ) Declaration: Access:
Background image of page 2
Processing Tables O O O O O O O O O O O O O O O O 2 methods for processing tables: ROW-MAJOR Cells can accessed row by row O O O O O O O O O O O O O O O O COLUMN-MAJOR Cells can accessed column by column
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Array Input, ROW-MAJOR PROGRAM rowMajor IMPLICIT NONE INTEGER :: X(2,4) INTEGER :: I,J DO I = 1, 2 DO J = 1, 4 READ(*,*) X(I,J) END DO END DO END PROGRAM rowMajor O O O O O O O O input 4 8 3 9 7 5 2 6 ? ? ? ? ? ? ? ?
Background image of page 4
PROGRAM rowMajor IMPLICIT NONE INTEGER :: X(2,4) INTEGER :: I,J DO I = 1, 2 DO J = 1, 4 READ(*,*) X(I,J) END DO END DO END PROGRAM rowMajor O O O O O O O O input 4 8 3 9 7 5 2 6 6 2 5 7 9 3 8 4 Array Input, ROW-MAJOR
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Array Input, COLUMN-MAJOR PROGRAM colMajor IMPLICIT NONE INTEGER :: X(2,4) INTEGER :: I,J DO J = 1, 4 DO I = 1, 2 READ(*,*) X(I,J) END DO END DO END PROGRAM colMajor O O O O O O O O input 4 8 3 9 7 5 2 6 ? ? ? ? ? ? ? ?
Background image of page 6
Array Input, COLUMN-MAJOR PROGRAM colMajor IMPLICIT NONE INTEGER :: X(2,4) INTEGER :: I,J DO J = 1, 4 DO I = 1, 2 READ(*,*) X(I,J) END DO END DO END PROGRAM colMajor O O O O O O O O input 4 8 3 9 7 5 2 6 6 5 9 8 2 7 3 4
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Compare input 4 8 3 9 7 5 2 6 6 5 9 8 2 7 3 4 6 2 5 7 9 3 8 4 ROW-MAJOR COLUMN-MAJOR
Background image of page 8
Is not there any way to input matrix elements in a matrix-like format?
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2010 for the course COMP COMP 206 taught by Professor Vybihal during the Spring '04 term at McGill.

Page1 / 23

(10) MultiArrays (Sina) - More on Multidimensional Arrays...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online