I have a need for a matrix structure in lisp. I'm having trouble defining how to handle this using lisp. The problem is:
I have a list (X Y) which make up a matrix (M) with indices i & j. I and J are unknown quantities before run time. The matrix dimension of i x j is in excess of 10000. I must be able to both add values to the end of the column and retrieve columns of values to this structure. For example
M= | 1 2 3 4 5 6 7
---------------
1 | 1 4 X 8 9 1 3 2 | 1 1 3 4 4 5 3 | 2 3 5 5 4 2 4 | 2 2 2 2 X 2 5 | 1 3 X X 0 6 | 0 X X 7 | XNeed to a save item to the end (or beginning) of any column (where X's are shown) and need to retrieve the whole column (not individual items).
Does anyone have an idea of how to handle this? I mentioned the dimension of the Matrix so you have an understanding that the structure must be fast. I cannot rebuild the list each time I add an item.
My best plan to handle this was to use j+1 lists. There would be one list for each column plus an index list holding the names of the lists. For example the columns would be named and in a list like this (col1 col2 col3...) Where col1 was the var that pointed to the list. Then to add to a list look-up the var then evaluate the name and cons a new item to the list. To retrieve just look-up the name. My problem here is I cannot figure out how to generate the lists names (col1 etc) dynamically. (I don't know the number of columns until run time.)
Any help would be appreciated.