search for: superdiagonal

Displaying 5 results from an estimated 5 matches for "superdiagonal".

2009 Feb 19
4
Matrix package: band matrix
I want to construct a symmetric band matrix in the Matrix package from a matrix where the first column contains data for the main diagonal, the second column has data for the first subdiagonal/superdiagonal and so on. Since the Matrix will be 10^5 x 10^5 or so, with perhaps 10-20 non-zero elements above the diagonal per row, I can't do it by constructing a full matrix and then using the band() function to subset it to a band matrix. Any suggestions? -thomas Thomas Lumley Assoc. Profes...
2009 Mar 11
3
Matrix Construction; Subdiagonal
I'm trying to enter a vector into the subdiagonal of a matrix but cannot find a command in R which corresponds to the MatLab version of diag(vec, k), where vec = the vector of interest, and k = the diagonal (k=0 for the diagonal; k=-1 for the subdiagonal; k=1 for superdiagonal, etc.) Is there an equivalent command in R? I'm looking for something like this: vec = seq(1, 5, 1) # vector of interest A = xyz(vec,-1) # creates a 6x6 matrix with vec on the subdiagonal where xyz is some function similar to diag, but with differing arguments. I can'...
2012 Apr 12
3
writing spdiags function for R
Dear R-list, I am in the process of translating a long function written in Matlab into R (mainly because I am a big of fan of R, and folks will not have to pay to use it :). In the translation of this function I got stack because they use spdiags, which, as far as I can tell it is not available in R. I have explored the Matrix package, from which I borrowed some of the functions (e.g.,
2005 Jul 12
3
elegant matrix creation
Hi I want to write a little function that takes a vector of arbitrary length "n" and returns a matrix of size n+1 by n+1. I can't easily describe it, but the following function that works for n=3 should convey what I'm trying to do: f <- function(x){ matrix(c( 1 , 0 , 0 , 0, x[1] , 1 , 0 , 0, x[1]*x[2] , x[2] , 1 , 0,
2007 Aug 16
6
an easy way to construct this special matirx
Hi, Sorry if this is a repost. I searched but found no results. I am wondering if it is an easy way to construct the following matrix: r 1 0 0 0 r^2 r 1 0 0 r^3 r^2 r 1 0 r^4 r^3 r^2 r 1 where r could be any number. Thanks. Wen [[alternative HTML version deleted]]