Displaying 20 results from an estimated 1000 matches similar to: "efficient submatrix extraction"
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
2012 Aug 23
1
Why was my R process killed spontaneously?
I tried to use gpuCor 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
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
2002 Feb 01
3
matrix with ncol=1
Hello list,
I try to optimize some R code and it turns out that the function as.matrix
takes a lot of time in my code. There is only one reason why I need
as.matrix: My code should work for matrices with ncol=p and p should be
allowed to be 1 or larger.
Now I have a matrix x with dim(x)=(n,p), and
I need to work with the submatrix y <-x[gv,], (gv a vector of
n logicals) and to calculate
2007 Apr 25
1
for loops
Hello everybody
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
1998 Apr 09
1
0-extent matrices?
Is there a good reason not to allow matrix extents to be zero? I have been
writing a function which fits glms under certain linear constraints. I
fit the model with a reduced set of variables and then transform back to
the original set. This involves operating on submatrices of the
covariance matrix and subsets of the coefficients. Sometimes these subsets
are empty. A zero-length subset of the
2011 Aug 02
1
Functions for Sum of determinants of ranges of matrix subsets
Dear R-help list,
Pls I have this problem. Suppose I have a matrix 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
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,
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
2004 Jan 26
3
write.table file="file.txt" help
Hi all,
I have a R script that creates several input files for an analysis
program. It loops through the matrix read into R and picks out
submatrices and then creates a separate output file for each
submatrix. The loop works great, but I am having trouble getting all
the separate output files written.
The line I have is:
write.table(ch1d,
2015 Oct 29
2
Extraer elementos diagonales de submatrices
El código que me olvide pegar
input
m <- structure(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
nfilas <- nrow(m)
while(nfilas > 0) {
diagonal <- diag(m)
2006 Jun 19
2
Nested variance-covariance matrix in Multilevel model
Dear R community,
I have trouble implementing a nested variance-covariance matrix in the
lme function.
The model has two fixed effects called End and logpgc, the response
variable is the logarithm to base 2 of Intensity ( log2(Intensity) )
and the random effects are called Probe and ProbeNo.
The model has the following nesting structure: A Pixel is nested within
the ProbeNo,the ProbeNo is
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
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,0,1,1,0,1,0,0,1,
+
2015 Oct 28
3
Extraer elementos diagonales de submatrices
Estimado Javier,
Gracias por tu mensaje.
No, lo unico que requiero es la lista de números (i1, 2, 3, 1, 2, 3, 4, 5,
1, 2).
Saludos cordiales,
Jorge.-
2015-10-28 14:35 GMT-05:00 Javier Rubén Marcuzzi <
javier.ruben.marcuzzi en gmail.com>:
> Estimado Jorge I Velez
>
>
>
> No comprendo un punto, dices que deseas construir sub matrices y extraer
> elementos de sub
2002 Oct 10
2
tapply for matrices
Does anyone have something like tapply that is extremely fast for matrices when there is a very large number of levels of the grouping variable?
I'm referring to, for example,
tapply(x, grouping.variable, function.operating.on.submatrix)
where x is a matrix and the submatrix is a subset of the rows of x. The grouping variable's length equals the number of rows of x.
--
Frank E
2009 Jul 01
0
probit with sample selection error?
Deal all:
i want to do the probit with sample selection estimation, the following
is my code:
probit with sample selection can be done by stata :heckprob
The heckprobll is the likelihood function shown in W.H. Greene 5th p714
¡´ The question is the convergence is very slow compare with Stata using
likellihood only.
¡´ Second i did the similar way in matlab using
fminsearch , the estimated
2015 Oct 28
2
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, 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 <-
2014 Mar 03
1
Doubled Quotas on Ubuntu
Hi all,
I'm seeing doubled quotas on Windows 7 when connecting to Samba. By
doubled, I mean that if I set a 1GB group quota on Linux, I see a 2GB
quota on Windows 7. The quotas seem correct with Samba 3.6.19 running
on a Linux 2.6.32 kernel on Mandriva; they are incorrect with Samba
3.6.22 on a Linux 3.12 kernel on Ubuntu. What could be wrong?
In more detail, I'm testing on both a
2004 Dec 13
4
Calling R from a non-X shell script to plot?
I am trying to run R from an apache C++ module in a shell script to
plot some data to display it in apache later. I get the error
(reported in apache's logs):
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
Error in X11(paste("png::", filename, sep = ""), width, height, pointsize, :
unable to start device PNG
In addition: Warning