Is there an easy way to turn a vector of length n into an n by n matrix, in
which the diagonal equals the vector, the first off diagonal equals the
first order differences, the second... etc. I.e. to do this more
efficiently:
diffmatrix - function(x){
n - length(x);
M - diag(x);
Jeroen Ooms jeroenooms at gmail.com writes:
Is there an easy way to turn a vector of length n into an n by n matrix, in
which the diagonal equals the vector, the first off diagonal equals the
first order differences, the second... etc. I.e. to do this more
efficiently:
diffmatrix -
On Apr 27, 2011, at 7:25 AM, Hans W Borchers wrote:
Jeroen Ooms jeroenooms at gmail.com writes:
Is there an easy way to turn a vector of length n into an n by n
matrix, in
which the diagonal equals the vector, the first off diagonal equals
the
first order differences, the second...
On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
Jeroen Ooms jeroenooms at gmail.com writes:
Is there an easy way to turn a vector of length n into an n by n matrix, in
which the diagonal equals the vector, the first off diagonal equals the
first order differences, the
-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Petr Savicky
Sent: Wednesday, April 27, 2011 11:01 AM
To: r-help@r-project.org
Subject: Re: [R] matrix of higher order differences
On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
Jeroen Ooms jeroenooms at gmail.com writes
@r-project.org
Subject: Re: [R] matrix of higher order differences
On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
Jeroen Ooms jeroenooms at gmail.com writes:
Is there an easy way to turn a vector of length n into an n by n matrix, in
which the diagonal equals the vector
AM
To: r-help@r-project.org
Subject: Re: [R] matrix of higher order differences
On Wed, Apr 27, 2011 at 11:25:42AM +, Hans W Borchers wrote:
Jeroen Ooms jeroenooms at gmail.com writes:
Is there an easy way to turn a vector of length n into an n by n matrix, in
which the diagonal
7 matches
Mail list logo