I have a large array A with ~500.000 rows of the form
[ id1 id2 value1 value2 zero zero ]
and another, smaller Array B (~20.000 rows) with rows with some of the identifiers from A
[ id1 id2 value3 value4 ]
All the pairs of IDs in B exist in A. I want to update the values of B into A at the positions where respectively the values of id1 and id2 match. The (row-)order of the new array may be arbitraty.
An example:
A = 1 1 3 5 0 0
1 2 6 4 0 0
1 3 3 1 0 0
2 1 3 8 0 0
3 4 0 2 0 0
B = 2 1 7 4
1 1 2 1
should yield
C = 1 1 3 5 2 1
1 2 6 4 0 0
1 3 3 1 0 0
2 1 3 8 7 4
3 4 0 2 0 0
Iterating through A for each element in B with for loops takes incredibly long. I hope there is a faster way.