Feedback Each dimension of a matrix is a level of list nesting 

Forum: Com Sci 12500, U Chicago, Autumn 2002, Discuss Classwork
Re: News I posted a study guide for the final (Mike O'Donnell)
Re: News Study questions for problem 1 (Mike O'Donnell)
Re: Question matrices ...??? (Ivan Beschastnikh)
Date: 2002, Dec 10
From: Mike O'Donnell <odonnell@cs.uchicago.edu>

Look at the following 2-dimensional matrix, which has size 3 in the 1st (horizontal) dimension and size 4 in the 2d (vertical) dimension:


 1  2  3
 4  5  6
 7  8  9
10 11 12
In Scheme, we may represent such a matrix by the list of its rows:

((1 2 3) (4 5 6) (7 8 9) (10 11 12))

3-dimensional matrices are hard to picture in 2 dimensions. Consider the 3-dimensional matrix with size 2 in the 1st dimension, 3 in the second dimension, and 4 in the 3d dimension, whose entry at index i j k is i+10*j+100*k. I can draw each of the 4 2-dimensional slices of this matrix (each one has size 2x3):


111 112 | 211 212 | 311 312 | 411 412
121 122 | 221 222 | 321 322 | 421 422
131 132 | 231 232 | 331 332 | 431 432
Imagine the 4 slices stacked up in the depth dimension---the one that goes perpendicularly to the plane of the computer screen. In Scheme, we may represent such a matrix by the list of lists of rows:

(((111 112) (121 122) (131 132)) ((211 212) (221 222) (231 232))
 ((311 312) (321 322) (331 332)) ((411 412) (421 422) (431 432)))
If we project this 3-dimensional matrix to 2 dimensions by summing through the last dimension (not the same as the study question that I proposed) we get a 2-dimensional matrix of size 2x3:

1044 1048
1084 1088
1124 1128
represented by the following list of lists:

((1044 1048) (1084 1088) (1124 1128))
Going back to the study question that I proposed, if we concatenate the 3d dimension into the 2d dimension, we get the 2-dimensional 2x12 matrix:

111 112
121 122
131 132
211 212
221 222
231 232
311 312
321 322
331 332
411 412
421 422
431 432
represented by the list of lists:

((111 112) (121 122) (131 132) (211 212) (221 222) (231 232)
 (311 312) (321 322) (331 332) (411 412) (421 422) (431 432))
This projection contains all of the entries in the original 3-dimensional 2x3x4 matrix, projected into 2 dimensions.




Mike O'D.


Messages

1. More Solutions to 2 practice projections of matrices by Ivan Beschastnikh, 2002, Dec 10
1. Feedback I think the exam question is easier by Mike O'Donnell, 2002, Dec 10
2. More Summing is not that hard by Maris Goldmanis, 2002, Dec 10
2. More Mark's solutions by Mark Kittisopikul, 2002, Dec 10

to: "Each dimension of a matrix is a level of list nesting"