vincent wrote:
Hello,
I use extensively m[i0:i1,j0:j1] = ... to update matrices parts.
This writing is very convenient, but, since I'm doing this
calculus many many times, I would like to know if there is a way
(a hope ?) to do the same operation faster ?

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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to