Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
2
votes
Accepted
Computation of concordant and discordant pairs
If the counting operation is a performance bottleneck in your code, then one possibility would be to implement it in C++ using the Rcpp package:
library(Rcpp)
cppFunction(
"IntegerVector CDcount(NumericVector …
4
votes
Accepted
Vectorize/speed-up exponentially weighted covariance calculation in R
A key performance bottleneck in your code is your calculation of the Cov_t^{k,l} values:
Sum <- 0
for(j in 1:i){ # calc sum of exponentially weighted average of past returns
Sum <- Sum + (1-60/61)*( … past returns
Cov[k,l] <- sum((1-delta)*delta^(0:(i-1))*(Data[i:1,k] - means[k])*(Data[i:1,l] - means[l]))
l <- l + 1
}
}
res[[i]] <- Cov
}
return(res)
}
To see the performance …
4
votes
Accepted
Looping through two lists and randomly aggregating elements to equal an element from another...
To briefly summarize your problem, for each of your column numbers (1-19) you have two vectors (FV and CV) of the same length. For each pair of elements, you can only pick one. You want to pick the el …
9
votes
Accepted
Count lengths of constant subarrays
A few initial thoughts on the code:
Iterating through groups of consecutive elements is implemented efficiently by itertools.groupby, which for each consecutive group in a collection returns both the …
5
votes
Accepted
Rolling mean lag function
allFipsRM2(dat, "x",2)
outdat2 = merge( dat[, c("fips","x","year")], rm1b, by=c("fips","year") )
outdat2 = merge( outdat2, rm2b, by=c("fips","year") )
all.equal(outdat, outdat2)
# [1] TRUE
To see the performance …
1
vote
Solving for a seed value in R
It seems that you are looping through seeds to find the one that causes a randomized procedure's output to match the output from a previous run.
If you had set the random seed immediately before runn …