I have two text files that I am importing, one is a sparse array of format {large row index,column,value1} and the other is {large row index,value2}. The row values are a small subset of a much larger table (about 500 rows out of a total of 10 million). I want to modify the sparse array so that it uses the positions from the smaller second vector instead of the row indices from the extremely large table. The reason for this is that when I try to parse the sparse array, I am getting an error saying it is too large (I checked that it works on a smaller copy).
I can create a new array of just the value2, and I can create a rule that maps the large row index to the actual row number in this smaller vector {large row index -> new row index}. I'd like to be able to apply this rule to the first column of my sparse array.
For smaller tables I would parse the sparse array using a command like SparseArray[input[[All, 1;2]] -> input[[All,3]]], but I can't figure out how too apply the rule that maps the old row numbers to the new ones.
Thanks for helping a Mathematica newbie.
ArrayRulesis probably what you're looking for. – rm -rf♦ Nov 15 '12 at 1:36