similar to: Efficient nested loops

Displaying 20 results from an estimated 1000 matches similar to: "Efficient nested loops"

2013 Jun 07
4
matched samples, dataframe, panel data
I R-helpers #I have a data panel of thousands of firms, by year and industry and #one dummy variable that separates the firms in two categories: 1 if the firm have an auditor; 0 if not #and another variable the represents the firm dimension (total assets in thousand of euros) #I need to create two separated samples with the same number os firms where #one firm in the first have a corresponding
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
Hi R-helpers, My real data is a panel (unbalanced and with gaps in years) of thousands of firms, by year and industry, and with financial information (variables X, Y, Z, for example), the number of firms by year and industry is not always equal, the number of years by industry is not always equal. #reproducible example firm1<-sort(rep(1:10,5),decreasing=F) year1<-rep(2000:2004,10)
2011 Jul 02
5
How many times occurs
Hi all, I have a data matrix likein "input.txt" 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 5 6 4 8 9 2 5 4 5 8 5 6 6 8 9 2 8 9 2 8 9 2 1 8 9 2 5 4 5 8 9 2 2 In this example will be an 6x10 matrix (or data frame) I want to detect how many times in a row appears this combination 8 follewd by 9 followed by 2, and create a new matrix with only this number of occurs then
2013 Mar 29
3
if clause in data frame
Hi, final<-data.frame() ?? for (m1 in 4:10) { ?????? for (n1 in 4:10){? ?????????? for (x1 in 0: m1) { ????????????? for (y1 in 0: n1) { final<- rbind(final,c(m1,n1,x1,y1)) res}}}} ?final1<-within(final,{flag<-ifelse(x1/m1>y1/n1, 1,0)}) ?head(final1) #? m1 n1 x1 y1 flag #1? 4? 4? 0? 0??? 0 #2? 4? 4? 0? 1??? 0 #3? 4? 4? 0? 2??? 0 #4? 4? 4? 0? 3??? 0 #5? 4? 4? 0? 4??? 0 #6? 4? 4?
2011 Dec 04
1
Polishing my geom_bar for publication
Dear list, I am new with ggplot2 and I have spend quiet some time putting together the following code to create the attached plot. However there's still a few things that I'm having trouble with! I would be grateful if someone can tell me how to fix (1) the colour of my bars into grey scales (2) removing the y-axis (species name) on the right figure to avoid duplication, and (3) fix the
2007 Mar 23
1
objects of class "matrix" and mode "list"?
Hello everyone, I cannot seem to find information about objects of class "matrix" and mode "list", and how to handle them (apart from flattening the list). I get this type of object from using sapply(). Sorry for the long example, but the code below illustrates how I get this type of object. Is anyone aware of documentation regarding this object? Thanks very much, Stephen
2008 Jan 06
0
[LLVMdev] Another memory fun
Zalunin Pavel wrote: > hm.... I think, that is valid in c [snip] > I tried decompile code: > main(int argc, char **argv) { > char str1[] = "mother "; > strcat(str1, "father"); > return 0; > } > This is valid C but you forget that str1 is not magically expanded by strcat. It starts out as, and remains a char array with 8 elements. >
2011 Oct 21
2
'Apply' giving me errors
So i have a simple function: bmass=function(y){ weight=y$WT*y$MSTR return(bio) } And want to apply to a whole bunch of rows in my data.frame: final1=apply(final,1,yldbu) BUT...recieve the following error: "Error in y$WT : $ operator is invalid for atomic vectors" However when i try: > final[1,]$WT*final[1,]$MSTR [1] 156.3 It gives me the correct answer....what is apply not
2008 Jan 06
4
[LLVMdev] Another memory fun
hm.... I think, that is valid in c but next code too doesn't works right: ; ModuleID = 'sample.lz' @.str1 = internal global [6 x i8] c"world\00" ; <[6 x i8]*> [#uses=1] @.str2 = internal global [7 x i8] c"hello \00" ; <[7 x i8]*> [#uses=1] @.str7 = internal global [7 x i8] c"father\00" ; <[7 x i8]*> [#uses=1]
2017 Jul 31
1
[RFC] Profile guided section layout
Michael Spencer via llvm-dev <llvm-dev at lists.llvm.org> writes: > I've recently implemented profile guided section layout in llvm + lld using > the Call-Chain Clustering (C³) heuristic from > https://research.fb.com/wp-content/uploads/2017/01/cgo2017-hfsort-final1.pdf > . In the programs I've tested it on I've gotten from 0% to 5% performance > improvement over
2017 Jun 15
7
[RFC] Profile guided section layout
I've recently implemented profile guided section layout in llvm + lld using the Call-Chain Clustering (C³) heuristic from https://research.fb.com/wp-content/uploads/2017/01/cgo2017-hfsort-final1.pdf . In the programs I've tested it on I've gotten from 0% to 5% performance improvement over standard PGO with zero cases of slowdowns and up to 15% reduction in ITLB misses. There are
2018 Aug 07
3
Regarding basic block layout/code placement optimizations of profile guided optimization (PGO)
Hi, I would like to learn the details regarding what exactly PGO does for basic block layout/code placement optimizations in llvm. Could you please point me to some descriptions? Is it close to this paper (Karl Pettis and Robert C. Hansen. 1990. Profile guided code positioning. PLDI'90) http://perso.ensta-paristech.fr/~bmonsuez/Cours/B6-4/Articles/papers15.pdf? Whether it is purely
2013 Apr 07
2
group data in classes
Hello all! I have a problem to group my data (years) in 10 years classes. For example for year year decade 1598 1590-1600 1599 1590-1600 1600 1590-1600 1601 1600-1610 --- my is like this> [1] 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 [16] 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 [31] 1628 1629 1630 1631 1632 1633
2009 Jun 09
2
is it possible to combine multiple barplots?
i am working with two sets of likert scale type (4 distinct values) data: dataA <- rep(1:4, c(3,2,2,4)) dataB <- rep(1:4, c(5,4,3,2)) i can now (bar)plot both of these separately and compare the distributions. plot(table(dataA), type='h') plot(table(dataB), type='h') is there a way to plot both of them in one plot, so that the bars for value "1" (dataA: 3,
2013 Jun 08
0
data
Hi, Try this: final3New<-read.table(file="real_data_cecilia.txt",sep="\t") dim(final3New) #[1] 5369??? 5 #Inside the split within split, dummy==1 for the first row.? For lists that have many rows, I selected the row with dummy==0 (from the rest) using the #condition that the absolute difference between the dimensions of those rows and the first row dimension was minimum
2007 Feb 28
1
Efficient way to repeat rows (or columns) of a matrix?
Hi. If I have a vector, v_1, and another vector of positive integers, i_1, the same length as v_1, then rep(v_1,i_1) will repeat v_i[j] exactly i_1[j] times, like so: >rep(c(1,2,3),c(3,2,1)) [1] 1 1 1 2 2 3 > I'd like to do the same sort of thing where I replace v_1 with a matrix, and the jth row of the matrix is repeated i_1 times. Obviously, I could do this with for loops, like
2008 Jan 07
3
Seeking a more efficient way to find partition maxima
Hi. Suppose I have a vector that I partition into disjoint, contiguous subvectors. For example, let v = c(1,4,2,6,7,5), partition it into three subvectors, v1 = v[1:3], v2 = v[4], v3 = v[5:6]. I want to find the maximum element of each subvector. In this example, max(v1) is 4, max(v2) is 6, max(v3) is 7. If I knew that the successive subvector maxima would never decrease, as in the example,
2005 Jun 20
6
sweep() and recycling
Hi I had a hard-to-find bug in some of my code the other day, which I eventually traced to my misusing of sweep(). I would expect sweep() to give me a warning if the elements don't recycle nicely, but X <- matrix(1:36,6,6) sweep(X,1,1:5,"+") [,1] [,2] [,3] [,4] [,5] [,6] [1,] 2 9 16 23 30 32 [2,] 4 11 18 25 27 34 [3,] 6 13 20 22
2008 Jan 06
1
[LLVMdev] Another memory fun
so, thanx to all.... now I understand my fault and now I have another question: how I can write those code with using API: %final = alloca [256 x i8], align 16 ; <[256 x i8]*> [#uses=1] %final1 = getelementptr [256 x i8]* %final, i32 0, i32 0 ; <i8*> [#uses=2] call void @llvm.memcpy.i32( i8* %final1, i8* getelementptr ([3 x i8]* @.str, i32
2005 Nov 23
4
x[1,], x[1,,], x[1,,,], ...
Hi, is there a function in R already doing what I try to do below: # Let 'x' be an array with *any* number of dimensions (>=1). x <- array(1:24, dim=c(2,2,3,2)) ... x <- array(1:24, dim=c(4,3,2)) i <- 2:3 ndim <- length(dim(x)) if (ndim == 1) y <- x[i] else if (ndim == 2) y <- x[i,] else if (ndim == 3) y <- x[i,,] else ... and so on. My current