Skip to content
Prev 32001 / 398506 Next

How to speed R with triangular matrix

Dear r-help,

I want to solve an equation XR=B where R is a regular 10x10 upper
triangular matrix and B a 100x10 matrix. I do X=B%*%solve(R) which work
well but I need to do this operation a great number of time and this is
very long. With my pentium 2.4 GHz,  Windows XP and R 1.7.0, I do this
100000 times in 58 seconds (for comparaison Scilab take 22 seconds and
Matlab only 8 seconds to do the same thing). So, I try backsolve with
X=t(backsolve(R,t(B),transpose=TRUE)) or X=t(backsolve(t(R),t(B))) but
this is longer (more than 1 minute 10).

Is there a mean to to this more rapidly with R ? 

Thank you very much

P. Grandeau

---