Displaying 7 results from an estimated 7 matches for "subdiagonal".
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 fo...
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...
2011 Feb 25
1
Accessing sub diagonals / spdiag in R ?
...als in a
MATRIX and have been accustomed to using spdiags in MATLAB or Octave. I've
got a solution pieced together using for loops and it works though isn't
vectorized and liable to run very slow
for large matrices.
As an example:
A =
1 2 3 4 5
9 8 7 6 5
4 5 6 7 8
5 4 3 2 1
8 7 6 0 1
The subdiagonals are: 9,5,3,0 4,4,6 5,7 and 8,
I know about lower.tri and can fetch the data in a resulting vector
which ,in this case, would be:
9,4,5,8,5,4,7,3,6,0
though I would have to manipulate this some more to extract the other
diagonals (imagine this being done for say a 1000 x 1000 matrix). I look...
2010 Apr 23
2
Matrix diagonal help
Hi
Suppose I have a matrix (cohort are rows and years are columns)
[2000] [2001] [2002] [2003]
[C1] 0.01 0.03 0.02 0.09
[C2] 0.06 0.05 0.07 0.11
[C3] 0.1 0.5 0.4 0.98
[C4] 0.7 0.6 0.2 0.77
I want to extracts the diagonals to get a matrix which looks like this (C1
becomes C2 in 2002, C2 becomes C3 in 2003
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,
2009 Mar 14
1
multiple hypothesis testing
...e: Sorting rows of a matrix independent of each other
> (Paul Smith)
> 73. Re: How to find maximum values on the density function of
> arandom variable (guox@ucalgary.ca)
> 74. Re: Sorting rows of a matrix independent of each other (Kevski)
> 75. Re: Matrix Construction; Subdiagonal (Paul Smith)
> 76. Re: search for string insider a string (Gabor Grothendieck)
> 77. Re: How to find maximum values on the density function of
> arandom variable (David Winsemius)
> 78. Re: Unable to run smoother in qplot() or ggplot() - complains
> about knots (Christop...