Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
6  
It would be good if you could give a small example to work with so we know we are on the right track. – Andy Ross Nov 15 '12 at 1:19
4  
As Andy says, we need an example to understand what you're doing. It looks like ArrayRules is probably what you're looking for. – rm -rf Nov 15 '12 at 1:36

closed as not a real question by Jens, Oleksandr R., Simon Woods, rm -rf Dec 10 '12 at 14:55

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.