On 2/10/06, Mike Cheponis <[EMAIL PROTECTED]> wrote: > What's the best way to represent a matrix M with 4 dimensions, such as > M[x][y][z][t] where each element in the sparse matrix could be a simple > number, or could be an executable Python function snipped that returns a > value when that cell is evaluated? > > The user of the program will type in Python functions to be inserted into > particular cells in the 4-D matrix. > > I did't see any package that exactly does this; do I write my own Matrix > class and base it on lists? > > Thanks! -Mike
If it is a truly sparse matrix, I would use a dictionary with tuples as keys; i.e., m{(x, y, z, t) = "element"} André > > p.s. This seems to me like it ought to be built into the base language - > multidimensional object arrays. (Indeed, maybe it is, and I'm just too dense > to notice!) > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor