Skip to content
Prev 69897 / 398503 Next

fast matrix update

vincent wrote:
It tends to be faster to use vector indexing rather than matrix 
indexing, so if you can calculate which entries correspond to the block 
you want to replace you might find this is faster:

block <- [ some calculation here, e.g. i0:i1 if j0 = j1 = 1 ]
m[block] <- ...

Of course, the calculation involved in the general case is ugly and 
could be slow.  If this is really a crucial bottleneck to your 
calculation, I'd suggest skipping over that optimization and redoing the 
function in C or Fortran.

Duncan Murdoch