Displaying 20 results from an estimated 1000 matches similar to: "Problem about for loop"
2011 Mar 20
2
Why unique(sample) decreases the performance ?
Hi,
I' am interested in differences between sample's result when samples consist
of full elements and consist of only distinct elements. When sample consist
of full elements it take about 120 sec., but when consist of only distinct
elements it take about 4.5 or 5 times more sec. I expected that opposite of
this result, because unique(sample) has less elements than full sample. Code
as
2010 Jun 24
4
Simple qqplot question
I am a beginner in R, so please don't step on me if this is too
simple. I have two data sets datax and datay for which I created a
qqplot
qqplot(datax,datay)
but now I want a line that indicates the perfect match so that I can
see how much the plot diverts from the ideal. This ideal however is
not normal, so I think qqnorm and qqline cannot be applied.
Perhaps you can help?
Ralf
2007 Mar 20
1
Symbol and Ellipsis problems
Hi Everyone,
When I have a load of functions which have various arguments passed
via the ellipsis argument it keeps on assigning them as symbol making
them unusable to the function. My current work around involves using
do.call but this is rather cumbersome.
Does anyone know why it suddenly changes the types to symbol and if
there is a way to get the actual data pointed to by the symbol? (I
2006 Jul 31
4
question about dataframe ("sensory") in PLS package
Dear all,
I am trying to my dataframe for the PLS analysis using the PLS package.
However I have some trouble generating the correct dataframe. The main
problem is how to use one name to represent several columns in the
dataframe.
The example dataframe in PLS package is called "sensory". I cannot
directly read the data file since it's a binary file. If I use
2013 Nov 03
3
[LLVMdev] loop vectorizer issue
Actually what I meant in my original loop, that there is a dependency
between every two consecutive iterations. So, how the loop vectorizer says
'we can vectorize this loop'?
for(int k=20;k<50;k++)
dataY[k] = dataY[k-1];
From: Henrique Santos [mailto:henrique.nazare.santos at gmail.com]
Sent: Sunday, November 03, 2013 4:28 PM
To: Sara Elshobaky
Cc: <llvmdev at
2013 Nov 03
0
[LLVMdev] loop vectorizer issue
Hi Sarah,
the loop vectorizer runs not on the C code but on LLVM IR this c code was lowered to. Before the loop vectorizer runs many other optimization change the shape of this IR.
You can see in the LLVM IR you referenced below, a preceding LLVM IR transformation has change your loop from:
> for(int k=20;k<50;k++)
> dataY[k] = dataY[k-1];
to
> int a = d[19];
>
2013 Nov 03
0
[LLVMdev] loop vectorizer issue
Notice that the code you provided, for globals and stack allocations, at
least,
is semantically equivalent to:
int a = d[19];
for(int k = 20; k < 50; k++)
dataY[k] = a;
Like so, the load you see missing was redundant, probably hoisted by
GVN/PRE
and replaced with "%.pre".
H.
On Sun, Nov 3, 2013 at 11:26 AM, Sara Elshobaky <sara.elshobaky at gmail.com>wrote:
>
2013 Nov 03
2
[LLVMdev] loop vectorizer issue
Hello,
I was trying to trace the Loop vectorizer of the LLVM, I wrote a simple loop
with a clear dependency.
But found that the debug shows that 'we can vectorize this loop'
Here you are my loop with dependency:
for(int k=20;k<50;k++)
dataY[k] = dataY[k-1];
And the debug prints:
LV: Checking a loop in "main"
LV: Found a loop: for.body4
LV: Found an
2009 Mar 02
2
R-code help for filtering with for loop
Dear Sir / Madam,
I am new for R coding. Kindly help me out in sorting out the following problem.
There are 50 rows with six coloumns(you could see in the attached .txt file). I
wish to go for filtering this 50 rows for any one of the six coloumns
satisfying the value >= 64.
I need to have a final table with rows having >= 64 value in any one of the six
coloumns and the rest could be
2020 Jun 26
4
Quedarse con las muestras de una BD que están presentes otra, basado en dos variables
Buenas tardes, quedarme con las muestras de una BD (data) que están
presentes en otra (datax), cuando se tiene una variable que nunca se repite
(Key) es fácil: data <- subset(data,data$Key %in% datax$Key).
Mi problema es cuando la exclusividad viene dada por dos variables. P.e.,
las coordenadas de un mapa: lon y lat.
¿Como puedo quedarme con las muestras de una df cuya lon y lat son iguales
a
2000 Oct 12
2
works in R-1.1.1 but not in R-development; why?
Dear All,
A library (PHYLOGR) that passed the usual tests in R-1.1.1 gives errors with
R-devel; my (mis?)understanding of scoping rules is
that it should have worked in both. The problems seem related to using the
name of the data frame for extracting weights or subsets within a function
call. The problems can be reproduced as follows:
**********************
datai <- data.frame( y =
2010 Mar 27
1
R runs in a usual way, but simulations are not performed
Dear addresses, I need perform a batch of 10 000 simulations for each of
4 options considered. (The idea is to obtain the parameter estimates in
a heteroskedastic linear regression model - with additive or mixed
heteroskedasticity - via the Kenward-Roger small-sample adjusted
covariance matrix of disturbances). For this purpose I wrote an R
program which would capture all possible options (true
2006 Nov 21
1
crossprod(x) vs crossprod(x,x)
I found out the other day that crossprod() will take a single matrix
argument;
crossprod(x) notionally returns crossprod(x,x).
The two forms do not return identical matrices:
x <- matrix(rnorm(3000000),ncol=3)
M1 <- crossprod(x)
M2 <- crossprod(x,x)
R> max(abs(M1-M2))
[1] 1.932494e-08
But what really surprised me is that crossprod(x) is slower than
crossprod(x,x):
R>
2002 Mar 15
1
Thought on crossprod
Hi everyone,
I do a lot of work with large variance matrices, and I like to use
"crossprod" for speed and to keep everything symmetric, i.e. I often
compute "crossprod(Q %*% t(A))" for "A %*% Sigma %*% t(A)", where
"Sigma" decomposes as "t(Q) %*% Q". I notice in the code that
"crossprod", current definition
> crossprod
function (x,
2005 Jan 27
3
the incredible lightness of crossprod
The following is at least as much out of intellectual curiosity
as for practical reasons.
On reviewing some code written by novices to R, I came
across:
crossprod(x, y)[1,1]
I thought, "That isn't a very S way of saying that, I wonder
what the penalty is for using 'crossprod'." To my surprise the
penalty was substantially negative. Handily the client had S-PLUS
as
2005 Oct 05
2
eliminate t() and %*% using crossprod() and solve(A,b)
Hi
I have a square matrix Ainv of size N-by-N where N ~ 1000
I have a rectangular matrix H of size N by n where n ~ 4.
I have a vector d of length N.
I need X = solve(t(H) %*% Ainv %*% H) %*% t(H) %*% Ainv %*% d
and
H %*% X.
It is possible to rewrite X in the recommended crossprod way:
X <- solve(quad.form(Ainv, H), crossprod(crossprod(Ainv, H), d))
where quad.form() is a little
2003 Oct 17
2
Problems with crossprod
Dear R-users,
I found a strange problem
working with products of two matrices, say:
a <- A[i, ] ; crossprod(a)
where i is a set of integers selecting rows. When i is empty
the result is in a sense random.
After some trials the right answer
(a matrix of zeros) appears.
--------------- Illustration --------------------
R : Copyright 2003, The R Development Core Team
Version 1.8.0
2004 Oct 06
3
crossprod vs %*% timing
Hi
the manpage says that crossprod(x,y) is formally equivalent to, but
faster than, the call 't(x) %*% y'.
I have a vector 'a' and a matrix 'A', and need to evaluate 't(a) %*% A
%*% a' many many times, and performance is becoming crucial. With
f1 <- function(a,X){ ignore <- t(a) %*% X %*% a }
f2 <- function(a,X){ ignore <-
2010 May 08
1
matrix cross product in R different from cross product in Matlab
Hi all,
I have been searching all sorts of documentation, reference cards, cheat
sheets but can't find why R's
crossprod(A, B) which is identical to A%*%B
does not produce the same as Matlabs
cross(A, B)
Supposedly both calculate the cross product, and say so, or where do I
go wrong?
R is only doing sums in the crossprod however, as indicated by
(z <- crossprod(1:4)) # = sum(1 +
2008 Mar 10
1
crossprod is slower than t(AA)%*BB
Dear Rdevelopers
The background for this email is that I was helping a PhD student to
improve the speed of her R code. I suggested to replace calls like
t(AA)%*% BB by crossprod(AA,BB) since I expected this to be faster. The
surprising result to me was that this change actually made her code
slower.
> ## Examples :
>
> AA <- matrix(rnorm(3000*1000),3000,1000)
> BB <-