similar to: speeding up aperm/ adding repmat

Displaying 20 results from an estimated 500 matches similar to: "speeding up aperm/ adding repmat"

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 <-
2010 Dec 27
1
aperm() should retain class of input object
aperm() was designed for multidimensional arrays, but is also useful for table objects, particularly with the lattice, vcd and vcdExtra packages. But aperm() was designed and implemented before other related object classes were conceived, and I propose a small tune-up to make it more generally useful. The problem is that aperm() always returns an object of class 'array', which
2000 Jun 13
1
problem with aperm? (PR#568)
R version 1.0.1 OS RedHat Linux 6.1 In attempting to test for numeric vectors in a data frame, I tried: apply(dataframe,2,is.numeric) and found that it returned FALSE for all vectors whether they were numeric or not. I tracked this to the fact that as.array() was converting the data frame to character vectors, and thought I could solve it by using array(), which preserved the mode of the
2010 Jul 29
1
Using 'dimname names' in aperm() and apply()
I think that the "dimname names" of tables and arrays could make aperm() and apply() (and probably some other functions) easier to use. (dimname names are, for example, created by table() ) The use would be something like: -- x <-table( from=sample(3,100,rep=T), to=sample(5,100,rep=T)) trans <- x / apply(x,"from",sum) y <- aperm( trans,
2004 Mar 10
3
aperm() and as.list() args to "["
Hi everyone. I'm playing with aperm(): a <- 1:24 dim(a) <- c(2,3,2,2) permutation <- c(1,2,4,3) b <- aperm(a,permutation) So if my understanding is right, a[1,3,2,1] == b[c(1,3,2,1)[permutation] ] but this isn't what I want because the RHS evaluates to a vector, and I am trying to identify a single element of b. How do I modify the RHS to give what I want? Following
2007 May 04
0
[PATCH] 3/4 "nemesis" scheduling domains for Xen
Implements tool interfaces for scheduling domains. libxenctrl, xm, and xend. signed-off-by: Mike D. Day <ncmike@us.ibm.com> -- libxc/xc_domain.c | 85 +++++++++++++++++++++++++++++++++--- libxc/xenctrl.h | 43 ++++++++++++++++-- python/xen/xend/XendDomain.py | 78 +++++++++++++++++++++++++++++++++ python/xen/xend/server/SrvDomain.py |
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
2009 Feb 05
2
Non-linear optimisation
Hi there, I have a piece of Matlab code I use to optimise a trding strategy. If there are any Matlab/R specialists out there, I would appreciate your help in doing the exact same optimisation in R. I suspect I would use nlm() in R but am not sure where to define my constraints. I have attached my Matlab code below for reference. Many thanks. Constraints function [c,ceq]=TriskellConstraints(X)
2005 Oct 13
3
Help with Matrix package
Hello all, A colleague at work set me the challenge 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
2010 Jul 26
2
the real dimnames
Hi, R seems to have a feature that isn't used much, which I don't really now how to call. But, the dimnames function, can in addition to giving names to rows/columns/dim 3 rows/dim 4 rows... can also give labels to the dimensions themselves. Thus, I can do: A = matrix(1:9,3,3) dimnames(A) = list(from=c(), to=c() ) and now, printing a prints these dimension labels nicely: > A
2003 Oct 21
5
do.call() and aperm()
Hi everyone I've been playing with do.call() but I'm having problems understanding it. I have a list of "n" elements, each one of which is "d" dimensional [actually an n-by-n-by ... by-n array]. Neither n nor d is known in advance. I want to bind the elements together in a higher-dimensional array. Toy example follows with d=n=3. f <-
2010 Dec 15
0
Problems with the borders (High difficulty)
Dear r-help members, Could any of you help me with this model, please? This model gives error when some value touch whatever border and I do not know how to correct it. The 80% of the seeds produced by a plant will fell into the parent cell, the 15% in the first ring according to the king movement (in chess), and a 5% in the second ring defined by the queen2 matrix. Someone said me the functions
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", "help", or "[un]subscribe" (in the "body", not
2001 Jul 18
1
hypothesis testing in models
Dear all, Being an economics student, I am trying to put together a little tutorial/FAQ/... for those who have (more) background in econometrics rather than in statistics -- just as I have. I'v been looking for a hypothesis testing tool in R (just linear or also nonlinear) for model parameters, but could not find anything so far. I did find a similar but unanswered question in the archives,
2017 Sep 28
0
building random matrices from vectors of random parameters
The use of aperm is unnecessary if you call array() properly. ms <- array(c(rep(0, 5),so,sa*m,sa), c(5, 2, 2)) -- Sent from my phone. Please excuse my brevity. On September 28, 2017 9:10:26 AM PDT, Evan Cooch <evan.cooch at gmail.com> wrote: >Sure -- thanks -- only took me 3-4 attempts to get aperm to work (as >opposed to really thinking hard about how it works ;-) > >On
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
2006 Jun 09
1
Idempotent apply
Dear all, I have been working on an idempotent version of apply, such that applying a function f(x) = x (ie. force) returns the same array (or a permutation of it depending on the order of the margins): a <- array(1:27, c(2,3,4)) all.equal(a, iapply(a, 1, force)) all.equal(a, iapply(a, 1:2, force)) all.equal(a, iapply(a, 1:3, force)) all.equal(aperm(a, c(2,1,3)), iapply(a, 2, force))
2002 May 22
1
bug report: errors in file transfer
Hi! I just encountered a serious problem with rsync. I used rsync to copy a big directory between two computers. The source machine was a sun, the destination was a linux box. The destination directory did not exist before the copy started. I used the following command to copy the directory over: rsync -aSz source_machine:projects/ projects2 because I was somewhat paranoid, I checked if all
2015 Aug 25
0
Child thread libR.so
Simon, Ah, thank you! quiet right. For anyone searching for this in the future, I changed my init fuction to: ---------- SNIP ---------------- void init_r() { SEXP aperm_function; /* this is our version of Rf_initEmbeddedR where we disable stack checking */ const char *init_argv[] = {"MyFront", "--vanilla", "--slave"}; Rf_initialize_R(sizeof
2002 Jan 30
1
mosaicplot(formula, data)--- bugged?
I have been tinkering with mosaicplot() and friends as a way of learning R. As part of this, I've written a pair.table() method for mosaic matrices, and would like to extend mosaicplot to work with loglin and logln (MASS) objects. I'm using R 1.4.0 on Win 98. I've been trying to figure out the formula interface, and think there's a bug, but not sure how to find it, yet alone fix