search for: repmat

Displaying 10 results from an estimated 10 matches for "repmat".

Did you mean: repeat
2004 Sep 28
2
S4 method selection based on second argument
I'm translating some Matlab code and need some help figuring out how to change this call into an S4 generic method. In matlab, there's a function called 'repmat' with three calling sequences (all I have to deal with anyway): 1) B = repmat(A, m, n) 2) B = repmat(A, [m n]) 3) B = repmat(A, n) In all cases, A is the fill value, m is number of rows, and n is number of columns. As separate functions, the translations would roughly be: repmat1...
2006 May 29
2
Analog to matlab repmat function
Hello, I'm trying to switch from Matlab to R-project, and having some difficulties. I make a use of multidimensional matrices. For example, I need to extract mean from one of the dimensions: % we have matrix data of size: 130 x 11 x 350 x 2 data = data - repmat(mean(data,3),[130 1 1 1]); In R project I managed to do that in a very pervarsive way: # mean(data,3) in R base <- apply(data,c(2,3,4),mean) # repmat(...,[130 1 1 1]) base <- rep(base,130) dim(base) <- c(11,2,350,130) base <- aperm(base,c(4,1,2,3)) # data = data - repmat data...
2001 Jul 10
0
speeding up aperm/ adding repmat
...cate elements of B to make it same size as A diffdom <- Adom[-Bdom] # Adom \ Bdom B2dom <- c(Bdom, diffdom) perm <- match(Adom, B2dom) B3 <- aperm(B2, perm) # make B2 have the same order as A (VERY SLOW) C <- A * B3 In Matlab, there is a quicker way, using 'reshape' and 'repmat': one can reshape B to have the same number of dimensions as A, where the new dimensions have size 1; then one does a repmat to replicate B along the new dimensions; finally one does the multiplication. This avoids the cost of a permutation. This is much quicker than the R method, especially wh...
2002 Jan 03
6
Graphical representation of a matrix ?
Hi, The function Repmat under S allows to represent a matrix of data. Is there an equivalent function under R ? thanks for your reply Bruno -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", &...
2009 Feb 05
2
Non-linear optimisation
...@(C) compute_strategy_before_fees(prices, C, floor, cap, m_ret_reb, prices_TR, hedge_fund, vg, euribor, last_reb_date, Maturity, fixed_fees, var_fees); objFunc(C); options = optimset('MaxIter',10000000,'MaxFunEvals',10000000); tic; % OPTIMISE %M = fmincon(objFunc,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9), at TriskellConstraints,options); M = fmincon(objFunc_vol,C,[],[],[],[],repmat(-20,12,9),repmat(20,12,9), at TriskellConstraints,options); [Z, ZZ] = compute_strategy_after_fees(prices, C, floor, cap, m_ret_reb, prices_TR, Hedge_Fund, vg, euribor, last_reb_date, Maturity, f...
2005 Oct 13
3
Help with Matrix package
...hallenge to convert some MATLAB code into R, to see which is faster. We'd seen that benchmark comparing MATLAB 6.5 to R1.90 (and others), and so I thought that I should be able to get roughly comparable speeds. The code has lots of multiplications of matrixes, transposes, and MATLAB's "repmat". I did the code conversion, and R was about 6 times slower, so I had a closer look at the benchmark comparison and it seems that I should be using the "Matrix" package. Is there any dummies-level help available for this package? I am struggling even to apply simple functions such a...
2013 Mar 05
1
boxplot with frequencies(counts)
Dear All, I have a table as following position type count 1 2 100 1 3 51 1 5 64 1 8 81 1 6 32 2 2 41 2 3 85 and so on Normally if would have a vector of 2,3,4,5... by position position and plot them by position. But now i have counts of these types. Is there a way to compute boxplot of such
2011 Nov 02
4
array manipulation
Hello, I'm at the very beginning of the learning process of this language. Sorry in advance for the (possible but plausible) stupidity of my question. I would like to find a way to permute the DIMENSIONS of an array. Something that sounds like the function "permute()" in matlab. Given an array C of dimensions c x d x T , for instance, the command permute(C, [2 1 3]) would provide
2007 May 07
1
looking for equivalent of matlab's medfilt1 function
Dear all, I have several files with Matlab code, which I am translating to R. For the zero-level approach, I took the very old shell script from R-help archives, which has made some obvious leg-work such as replacement of "=" with "<-". Now I am translating indexing, matrix operations and function call using this table http://37mm.no/mpy/octave-r.html The problem is, I
2003 Feb 06
6
Confused by SVD and Eigenvector Decomposition in PCA
Hey, All In principal component analysis (PCA), we want to know how many percentage the first principal component explain the total variances among the data. Assume the data matrix X is zero-meaned, and I used the following procedures: C = covriance(X) %% calculate the covariance matrix; [EVector,EValues]=eig(C) %% L = diag(EValues) %%L is a column vector with eigenvalues as the elements percent