Sorry I didn't answer before. Martin, thanks very much for your notes and for tidying the function up! About matPower, I didn't realise that where it says "pot <- pot %*% p ot", consumption of memory was higer than it was on the original algorithm, And about the other function in this thread, matExp, I can remember I us look to m >Message: 27 >Date: Thu, 22 Jan 2004 18:22:27 +0100 > >Subject: [R >To: Vicente Canto Casasol >Cc: r-help at stat.mat >Message-ID: <16400.1747.101241.439215 at gargle.gargle.HOW >Content-Type: text/plain; charset=us-ascii > >&g to.ext at juntadeandalucia.es> >>>>>> &nbs > > &nb r > Vicente> my poor English. It's for years I do > >no problem at all. Well, that is because I'm not speaking!! ;) > > Vicente> This is a R-version of a funct > Vicente> ago for my HP48 cal > Vicente> binar > Vicente > >excellent. This is really >I think. > >As I've menti >computing a matrix "power" is really mu >matrix exponential. I do agree. It did sound strange to me, but I followed the thread! > >Hence I wouldn't use exponential in the function name. &g >co A C++ tic I have to correct!! Thank you, Martin. > >These slight modifications (+ initial "test") >give> >matPower <- function(X,n) >## Function to calculate >{ > if(n != ro > n <- round(n) > warning("rounding exponen > } > phi <- > pot <- X # the first po > > while (n > 0) > > if (n > & > > &nb > p > } > return( >}