Hi Meddee,
Try this:
dmat <- lapply(1:100, function(d) diag(d, 2))
That will give you a list of all 100 matrices.
Cheers,
Josh
On Tue, Aug 30, 2011 at 1:00 PM, meddee wrote:
> I am trying to generate a sequence of diagonal matrices.
>
> In the scalar case I would use something like, seq(0,10
I am trying to generate a sequence of diagonal matrices.
In the scalar case I would use something like, seq(0,100,by=1).
How do I generalise the above for , say a 2 dimensional diagonal matrix. In
other words how do I produce the series of diagonal matrices {
diag(0,2),diag(1,2), diag(2,2),...,di
2 matches
Mail list logo