230 likes | 245 Views
Explore the concept of regular arrays as trees and learn about their construction, visualization, and ordering. Presented by Dr. Ronald I. Frank at CSIS Research Day 2017 at Pace University.
E N D
Regular Arrays ARE TreesCSIS Research Day 2017 Dr. Ronald I. Frank Pace University Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
1. Table of Contents – 1/1 • Table of Contents [2] • Definitions [3-6] • Shape List Ordering [7] • Visualization [8-9] • Shape List Ordering & Odometering [10-11] • Recursive Construction of an Array from A Shape List [12-16] • Binary Hyper cube Method [12] • FORTRAN Order (m, n, k) [13] • APL Order (k, m, n) [14] • Comment on Odometering Order [15] • The Recursive Construction Order Choice [16] • Construction to Tree Mapping [17-21] • Construction To Tree Algorithm [17] • FORTRAN Order (m, n, k) Tree [18] • The FORTRAN ordered Odometered values [19] • APL Order (k, m, n) Tree[20] • The APL ordered Odometered values [21] • SUMMARY [22] Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
2. DEFINITIONS 1/4 A Regular Array is an Array defined by a shape list. A Shape List is a parenthetical list of dimension lengths. For example: Shape List: (2, 3, 2 ) An Index List is a bracketed list of specific dimension values defining a cell. For example: Index List: [1, 2, 1] of he cell indicated above. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
2. DEFINITIONS 2/4 There are two diagram types used for array visualizations. A pigeon-hole or egg-cratediagram such as: Or A Wire-frame or Lattice diagram such as: They both have the same shape list and sub structure (cell count, vector count, and plane count). They are duals of each other. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
2. DEFINITIONS 3/4 Odometering is the process of generating a complete cell index list for an array. The index value is never 0. For example: For the (2, 3, 2) Assuming (Row, Column, Plane) [R, C, P] [R, C, P] [1, 1, 1] [1, 1, 2] [1, 2, 1] [1, 2, 2] [1, 3, 1] [1, 3, 2] [2, 1, 1] [2, 1, 2] [2, 2, 1] [2, 2, 2] [2, 3, 1] [2, 3, 2] Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
2. DEFINITIONS 4/4 Array Cell Content Thinking of data arrays, the contents of a cell is the result of a mapping from the cell to a codomain of contents. This is independent of the visualization diagram. We are not concerned with contents here. Cells are 0-D Regular Arrays. A single cell as an array, can be of any dimension >0. [1], [1, 1], [1, 1, 1], [1, 1, 1, 1] are cells of dimension 1, 2, 3, and 4. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
2. DEFINITIONS 3/4 Odometering is the process of generating a complete sell index list for an array. For example: For the (2, 3, 2) Assuming (Row, Column, Plane) [R, C, P] [R, C, P] [1, 1, 1] [1, 1, 2] [1, 2, 1] [1, 2, 2] [1, 3, 1] [1, 3, 2] [2, 1, 1] [2, 1, 2] [2, 2, 1] [2, 2, 2] [2, 3, 1] [2, 3, 2] Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
4. Visualization 1/2 We always diagram this way: R, C, P. This is consistent with the usual matrix picture of R, C. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
4. Visualization 2/2 We visualize higher dimensions this way: Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
5. Shape List Ordering & Odometering 1/2 • Given the array’s diagram, we choose the two ways to write its shape list: • Left-to-right (called FORTRAN order) (2, 3, 4)~(R, C, P) • [keeping the leftmost 2 dimensions as (R, C)] (R, C, P, HP, HHP) • and • Right-to-left (APL order) (4, 2, 3)~(P, R, C) • [keeping the rightmost 2 dimensions as (R, C)] (HHP, HP, P, R, C) The effect on odometering is as follows: Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
5. Shape List Ordering & Odometering 2/2 FORTRAN (2, 3, 4) 1 [1, 1, 1] 13 [2, 1, 1] 2 [1, 1, 2] 14 [2, 1, 2] 3 [1, 1, 3] 15 [2, 1, 3] 4 [1, 1, 4] 16 [2, 1, 4] 5 [1, 2, 1] 17 [2, 2, 1] 6 [1, 2, 2] 18 [2, 2, 2] 7 [1, 2, 3] 19 [2, 2, 3] 8 [1, 2, 4] 20 [2, 2, 4] 9 [1, 3, 1] 21 [2, 3, 1] 10 [1, 3, 2] 22 [2, 3, 2] 11 [1, 3, 3] 23 [2, 3, 3] 12 [1, 3, 4] 24 [2, 3, 4] APL (4, 2, 3) 1 [1, 1, 1] 13 [3, 1, 1] 2 [1, 1, 2] 14 [3, 1, 2] 3 [1, 1, 3] 15 [3, 1, 3] 4 [1, 2, 1] 16 [3, 2, 1] 5 [1, 2, 2] 17 [3, 2, 2] 6 [1, 2, 3] 18 [3, 2, 3] 7 [2, 1, 1] 19 [4, 1, 1] 8 [2, 1, 2] 20 [4, 1, 2] 9 [2, 1, 3] 21 [4, 1, 3] 10 [2, 2, 1] 22 [4, 2, 1] 11 [2, 2, 2] 23 [4, 2, 2] 12 [2, 2, 3] 24 [2, 2, 3] Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
6. Recursive Construction of An Array 1/5 From a Shape List We use the same recursive construction method used in building binary Hyper cubes. At each stage, we move the array built in the previous stage along a new dimension. The shape list determines how far we move in each dimension. In this case it is a (2, 2, 2…). Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
(0-D) 6. Recursive Construction of An Array 2/5 From a Shape List • (m, n, k) Left-to-Right FORTRAN (R, C, P) • Front plane along k • (0-D) • (2-D) • (1-D) • (3-D) • (m, n, k) Right-to-LeftFORTRAN (R, C, P) • Top plane along m • (0-D) • (2-D) • (1-D) • (3-D) Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
6. Recursive Construction of An Array 3/5 From a Shape List • (k, m, n) Left-to-Right APL (P, R, C) • Left Front-to-rear plane along n • (0-D) • (2-D) • (1-D) • (3-D) • (k, m, n) Right-to-Left APL (P, R, C) • Front plane along k • (0-D) • (2-D) • (1-D) • (3-D) Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
6. Recursive Construction of An Array 4/5 From a Shape List • Comment: • We will want to map the constructed array to a tree • whose leaves are the cells in odometered order. • Therefore we want the construction to proceed from • left to right in the shape list. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
6. Recursive Construction of An Array 5/5 From a Shape List • There are 6 possible construction scenarios: • 1 (m, n, k) [Front along k] 4 (n, m, k) [Front along k] • 2 (m, k, n) [Side along n] 5 (k, m, n) [Side along n] • (n, k, m) [Top along m] 6 (k, n, m) [Top along m] • Fro compatibility with odometering, we choose: • (m, n, k) Structure (diagram) • 1 m, then n, then k [Front along k] • (k, m, n) Structure (diagram) • 5 k, then m, then n [Side along n] Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
7. Construction to Tree Mapping 1/5 • A TREE CONSTRUCTION ALGORITHM USING RECURSIVE ARRAY CREATION [FORTRAN] Left-to-right. • The Tree Root (Level 0) Is the Entire N-D Array • (Shape List) (n1, n2, … , nN-1, nN). • (Level 1) is the n1, {(N-1)-D)} Arrays Defined by Enumerating {(N-1)-D) Elements One-at-a-time. • (i1, n2, … , nN-1, nN). • (Level k {k ≤ N}) is the nk, {(N-k)-D)} Arrays Defined by Enumerating {(N-k)-D) Elements One-at-a-time for EACH of the nodes defined at the previous level. • (i1, i2, … , ik, … , nN-1, nN). • The nodes at level N are the (0-D) cells of the array. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
7. Construction to Tree Mapping 2/5 • Example: • FORTRAN Order (R, C, P) (2, 3, 4) Left-to-right. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
7. Construction to Tree Mapping 3/5 FORTRAN (2, 3, 4) 1 [1, 1, 1] 13 [2, 1, 1] 2 [1, 1, 2] 14 [2, 1, 2] 3 [1, 1, 3] 15 [2, 1, 3] 4 [1, 1, 4] 16 [2, 1, 4] 5 [1, 2, 1] 17 [2, 2, 1] 6 [1, 2, 2] 18 [2, 2, 2] 7 [1, 2, 3] 19 [2, 2, 3] 8 [1, 2, 4] 20 [2, 2, 4] 9 [1, 3, 1] 21 [2, 3, 1] 10 [1, 3, 2] 22 [2, 3, 2] 11 [1, 3, 3] 23 [2, 3, 3] 12 [1, 3, 4] 24 [2, 3, 4] Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
7. Construction to Tree Mapping 4/5 • A TREE CONSTRUCTION ALGORITHM USING THE RECURSIVE ARRAY CREATION [APL] Left-to-right. • The algorithm is the same as above. • Example: APL Order (P, R, C) (4, 2, 3) Left-to-right. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
7. Construction to Tree Mapping 5/5 APL (4, 2, 3) 1 [1, 1, 1] 13 [3, 1, 1] 2 [1, 1, 2] 14 [3, 1, 2] 3 [1, 1, 3] 15 [3, 1, 3] 4 [1, 2, 1] 16 [3, 2, 1] 5 [1, 2, 2] 17 [3, 2, 2] 6 [1, 2, 3] 18 [3, 2, 3] 7 [2, 1, 1] 19 [4, 1, 1] 8 [2, 1, 2] 20 [4, 1, 2] 9 [2, 1, 3] 21 [4, 1, 3] 10 [2, 2, 1] 22 [4, 2, 1] 11 [2, 2, 2] 23 [4, 2, 2] 12 [2, 2, 3] 24 [2, 2, 3] Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
8. SUMMARY 1/1 • First we defined: • Regular Array • Shape List • Index List • Two Visualizations • Egg-Crate / Pigeon-hole • Wire-Frame / Lattice • Odometering • Cell Content • 0-D Cells • Second we discussed: • Shape List Orderings • Their Odometering • Third • We reviewed the recursive construction of N-D Arrays. • Fourth (& Last) • We used the recursive construction to map any (N-D) array to a tree, for both shape list orderings. Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017
END Regular Arrays ARE TreesCSIS Research Day 2017 • Dr. Ronald I. Frank • Pace University Regular Arrays ARE Trees V.1. (C) Ronald I. Frank 2017