search for: collisionm

Displaying 1 result from an estimated 1 matches for "collisionm".

Did you mean: collision
2010 Aug 14
1
incrementing matrix elements more efficiently
I need to increment cells of a matrix (collusionM). The indexes to increment are in an index (matchIndex). This is some of the code for (j in 1:(rows-1)) matchIndex[[j]] <- which(mx[j]==mx) for (j in 1:(rows-1)) collisionM[j,matchIndex[[j]]] <- collisionM[j,matchIndex[[j]]] + 1 I could put them in the same loop but this is slower. The first for statement is fine. It finds the matches and creates a list of the matches. The second is too slow, it increments the sparse matrix elements. Let me know if I need to...