Re: [R] populating a large matrix

2012-06-20 Thread Nick Matzke
Hi! Thanks for the replies, comments below: On 6/20/12 3:26 AM, Oliver Ruebenacker wrote: Hello, For an optimization strategy, we need to know more: do you have many variables? do you have many different formulae? do you re-calculate after changing only one variable? Take care

Re: [R] populating a large matrix

2012-06-20 Thread Oliver Ruebenacker
Hello, For an optimization strategy, we need to know more: do you have many variables? do you have many different formulae? do you re-calculate after changing only one variable? Take care Oliver On Tue, Jun 19, 2012 at 11:10 PM, Nick Matzke wrote: > Hi all, > > This question is

Re: [R] populating a large matrix

2012-06-19 Thread Joshua Wiley
Hi Nick, Off the cuff: doit2 <- function(s, d, e) { matrix(c(s, d, d*d, e, s, d*e, e*e, e*d, s), 3, byrow=FALSE) } doit2(s, d, e) seems like it should offer a substantial speed up. Unless the matrix can be populated with arbitrary formulae, I do not see why it should be a text matrix and the

[R] populating a large matrix

2012-06-19 Thread Nick Matzke
Hi all, This question is slightly weird. I am trying to populate a matrix with equations. The matrix represents transition probabilities between states. A simple example is: state1 state2 state3 state1 s d d*d state2 e s d*e state3 e*e e*d s Th