Displaying 1 result from an estimated 1 matches for "shiftmatrixl".
2006 Oct 09
2
shifting a huge matrix left or right efficiently ?
I'm wondering what's the best way to shift a huge matrix left or right.
My current implementation is the following:
shiftMatrixL <- function(X, shift, padding=0) {
cbind(X[, -1:-shift], matrix(padding, dim(X)[1], shift))
}
X <- shiftMatrixL(X, 1)*3 + shiftMatrixL(X,2)*5...
However, it's still slow due to heavy use of this function.
The resulting matrix will only be read once and then discarded,
so I believe the...