[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

efficient way to fill a matrix based on a pattern?

From: justin.cress
Subject: efficient way to fill a matrix based on a pattern?
Date: Wed, 1 Sep 2010 15:07:41 -0700 (PDT)

So here's the code I used to create an AR covariance matrix in R... is there
a more efficient way to make the matrix in octave?  

omega <- matrix(nrow=dim(indata)[1],ncol=dim(indata)[1])
for (i in 1:dim(indata)[1])
for (j in 1:dim(indata)[1])

It occurs to me now that I could have just generated the lower triangle and
copied to the upper... but, im not entirely sure if that'd be much faster.. 

my problem is, i've been having trouble trying to get acclimated to the
programming environment in octave, specifically, when it's ok to reference
objects and how... 

every entry in the matrix should just be rho^(abs(i-j))...   and hopefully
i'll come up with a decent way to make one of arbitrary size.. 
View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]