search for: submatrices

Displaying 20 results from an estimated 38 matches for "submatrices".

2012 Oct 22
4
Help with applying a function to all possible 2x2 submatrices
Hi all, I'm working with a large data set (on the order of 300X300) and trying to apply a function which compares the elements of all possible 2x2 submatrices. There are rc(r-1)(c-1) such submatrices, so obviously the naive method of looping through the rows and columns is computationally unfeasible for my data set: for(i in 1:(nrow(data)-1)) { for(j in (i+1):nrow(data)) { for (m in 1:(ncol(data)-1)) { for (n in (m+1):ncol(data)) {...
2007 Jul 26
0
Diagonal Submatrices Extraction
Yes you are right ... an example is mandatory. So ... I have a matrix of 0 with just a single 1 per row and per column I need to extract all maximal 'diagonal' submatrices Let's say I have the following matrix A B C D E a 0 1 0 0 0 b 1 0 0 0 0 c 0 0 1 0 0 d 0 0 0 1 0 e 0 0 0 0 1 well I would like to get, for this example, the two following submatrices A B C D E a 0 1 c 1 0 0 b 1 0 d 0 1 0 e 0...
2012 Oct 30
2
Put submatrices in an array
Dear R users, I have a Hadamard matrix 16x15 and i want to put 16x5 submatrices in an array put i have an error. > A1<-matrix(c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, + 0,1,1,0,0,1,1,0,0,1,1,0,0,1,1, + 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0, + 0,0,0,1,1,1,1,0,0,0,0,1,1,1,1, + 1,0,1,1,0,1,0,0,1,0,1,1,0,1,0, + 0,1,1,1,1,0,0,0,0,1,1,1,1,0,0, + 1,1,0,1,0,0,1...
2015 Oct 29
2
Extraer elementos diagonales de submatrices
...print(GuardoElementosDeseadosDiagonal) } GuardoElementosDeseadosDiagonal Javier Rubén Marcuzzi Técnico en Industrias Lácteas Veterinario De: Javier Rubén Marcuzzi Enviado: miércoles, 28 de octubre de 2015 17:22 Para: Jorge I Velez CC: R-help-es Asunto: RE: [R-es] Extraer elementos diagonales de submatrices Bien, estoy pensando, diagonal, elementos diagonal mayor que 0, cantidad de elementos en diagonal mayor que cero, borrar esa cantidad de filas de la matriz, todo esto dentro de un bucle, lógicamente guardo (rbind cantidad de elementos en diagonal mayor que cero) . Javier Rubén Marcuzzi Técnico e...
2015 Oct 28
3
Extraer elementos diagonales de submatrices
...úmeros le es útil? > > > > Javier Rubén Marcuzzi > Técnico en Industrias Lácteas > Veterinario > > > > > > > *De: *Jorge I Velez > *Enviado: *miércoles, 28 de octubre de 2015 12:15 > *Para: *R-help-es > *Asunto: *[R-es] Extraer elementos diagonales de submatrices > > > > > > Buenos dias a todos, > > > > Quisiera extraer algunas entradas de una matrix "m" teniendo en cuenta > algunas restricciones. El siguiente ejemplo ilustra la situacion: > > > > ## input > > m <- structure(c(1, 1, 1, 1, 1, 1...
2012 Feb 10
2
Split matrix into square submatices
Hi everybody, I'm looking for an optimal way to split a big matrix (e.g. ncol = 8, nrow=8) into small square submatrices (e.g. ncol=2, nrow=2) For example If I have > h [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 1 9 17 25 33 41 49 57 [2,] 2 10 18 26 34 42 50 58 [3,] 3 11 19 27 35 43 51 59 [4,] 4 12 20 28 36 44 52 60 [5,] 5 13...
2004 Sep 15
2
efficient submatrix extraction
Hi, I have a matrix of say 1024x1024 and I want to look at it in chunks. That is I'd like to divide into a series of submatrices of order 2x2. | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | ... So the first submatrix would be | 1 2 | | 1 2 | the second one would be | 3 4 | | 3 4 | and so on. That is I want the matrix to be evenly divided into 2x2 submatrices. Now I'm...
2015 Oct 28
2
Extraer elementos diagonales de submatrices
...e(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5), .Dim = c(10L, 5L)) m ## output output <- c(1:3, 1:5, 1:2) output Si el numero de filas es r y el numero de columnas k, la idea es construir submatrices de dimension k x k y extraer los elementos diagonales NO ceros. Ahora, en caso de encontrar un cero, debe desplazarse a la siguiente fila, y construir una nueva matriz k x k. Graficamente esto seria : [image: Inline image 2] Observe que en este caso, r = 10 y k = 5. En la primera submatriz, la...
2012 Mar 14
3
Creating 250 submatrices from a large single matrix with 2500 variables using loops
Dear all, I have a large matrix with about 2500 variables, and 100 rows. I would like to calculate the means of the every 10 variables starting from 1:2500 and saving the results as a vector or matrix. How can I do that? Alternatively, How can I create 250 subset matrices in the order of variables 1:2500 in groups of 10 from the single matrix which had initially 2500 variables ? I guess I have
2006 Jun 19
2
Nested variance-covariance matrix in Multilevel model
...V1 0 0 V= 0 V2 0 0 0 V3 where V1...V3 are of the structure: v11 v12 V1= and so on. v21 v22 V1...V3 are assumed to have a compound symmetric variance-covariance structure and therefore the submatrices are of the form: Lambda Delta1 Delta1 ... Delta1 Delta1 Lambda Delta1 ... Delta1 v11=v22= ....... Delta1 ..... Lambda Delta2 Delta2 Delta...
2012 Jul 31
1
ways of getting around allocMatrix limit?
I need to multiply to very large, nonsparse matrices, and so get the error "allocMatrix: too many elements specified". Is there a way to set the limit for allocMatrix? In my case, the two matrices, A and B, are nxm and mxp where m is small, so I could subdivide each into blocks of submatrices A=rbind(A1,A2,...) and B=cbind(B1,B2,...) then multiply each pair of submatrices, but I was thinking there must be a better way to get around the allocMatrix limit. I'd be grateful for any suggestions! Thanks, David
2012 Aug 23
1
Why was my R process killed spontaneously?
...puCor function in the gputools package of R to calcuate the pairwise correlations of a matrix of 40,000 columns. Becuase there would be memory issues if I use the whole matrix at a time, I splitted the matrix into submatrix of 10,000 columns and then calculate the pairwise correlation of different submatrices. There are altogether 4 submatrices, so I need to calculate the pearson correlation of sub matrix 1 with sub matrix 1,2,3,4, and sub matrix 2 with submatrix 1,2,3,4, etc. The program runs well at first, but at the last step, which is calculating the correlation between submatrix 4 with itself, the...
2002 Feb 01
3
matrix with ncol=1
...s) and to calculate cov(y) and other functions for matrices. Unfortunately, if p=1, y is no longer a matrix, cov(y) gives an error, and therefore I use y <- as.matrix(x[gv,]) which makes my program surprisingly slower (this is because lots of gv-vectors are needed). Is there any way to handle submatrices of matrices with p=1 in the same manner than with p>1 without using as.matrix? Best, Christian -- *********************************************************************** Christian Hennig Seminar fuer Statistik, ETH-Zentrum (LEO), CH-8092 Zuerich (current) and Fachbereich Mathematik-SPST/ZMS...
2011 Apr 27
2
sub-matrix block size
Dear Rxperts Below is a small vector of values of zeros and non-zeros... was wondering if there is an efficient way to get the block sizes of submatrices of a big matrix similar to the one shown below? diagonal elements can be zero too. Rows with only a diagonal element may be considered as a unit block size. c(1,0,0,0,0,0,0,0,0,0,0, 1,1,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0,0, 0,0,0,0,1...
2005 Apr 26
1
Index matrix to pick elements from 3-dimensional matrix
Hi all Suppose I have a dim=c(2,2,3) matrix A, say: A[,,1]= a b c d A[,,2]= e f g h A[,,3]= i j k l Suppose that I want to create a 2x2 matrix X, which picks elements from the above-mentioned submatrices according to an index matrix J referring to the "depth" dimension: J= 1 3 2 3 In other words, I want X to be X= a j g l since the matrix J says that the (1,1)-element should be picked from A[,,1], the (1,2)-element should be picked from A[,,3], etc. I have A and I have J. Is there an...
2007 Apr 25
1
for loops
...verybody I'm very new at using R so probably this is a very stupid question. I have a matrix of "p" columns and I have to calculate for each of them the "two sample t-statistic" and p-value and to save the results into two different vectors. I have divided my matrix into two submatrices: submatrix A containing the first "n1" rows (p columns) and submatrix B containing the remaining "n2" (total rows=n1+n2). How can I do this with for loop construction? Friendly regards Silvia ------------------------------------------------------ Passa a Infostrada. ADSL e Tel...
2010 Apr 09
0
Fox's algorithm?
...9;s algorithm for memory management reasons. Does anybody know if there is anything available in R or C libraries? [eg A %*% B is too big to allocate memory for. I really want the values written to disk, so I was thinking that it would be easiest to use something like Fox's algorithm to load submatrices/blocks of A and B iteratively, do the multiplies, write to disk, and repeat to get the rest of the submatrices of A%*%B. If A and B were sufficiently sparse, I would use spam... Best, Blair
2010 Jun 04
1
parttioning a matrix corresponding to different levels of y
Sir, I have a problem regarding partitioning a matrix.I state my problem as follows: I have a y vector of length say 1000.Variable y has 4 levels say 0,1,2.Corresponding to each y(response), I have a x-vector(explanatory) as a row of X matrix.Now, I want to partition the X matrix into 3 submatrices say x1,x2,x3 corresponding to each level of y.Is there any function to do this in R or how can I do this in R? For your convinience I attach a sample version of data. Thanks, Suman Dhara
2011 Aug 02
1
Functions for Sum of determinants of ranges of matrix subsets
...trix of size nxn say, generated as follows   z<-matrix(rnorm(n*n,0,1),nrow=n)   I want to write a function such that for i in 1:n, I will remove the rows and columns corresponding to i (so, will be left with n-1*n-1 submatrix in each cases). Now I need the sum of the determinant of each of this submatrices. As an example, if n=3, it means I will have det(1strow and 1stcolum removed) + det(2ndrow and 2ndcolum removed) + det(3rdrow and 3rdcolum removed).   Any help will be appreciated. Thanks   John [[alternative HTML version deleted]]
2009 Nov 22
1
"Over-coloring" facets on persp() plot
Dear R Community: Recently, I have managed to plot some really useful graphs of my research data using persp(). I have even figured out how to overplot rectangular regions (corresponding to submatrices) with a different color. This is accomplished by using par(new=T). I am now searching for a way to "highlight" a set of (possibly non-contiguous) facets with a specific color, e.g., the facet between each set of four points whose values are all above a certain threshold. An example...