Displaying 20 results from an estimated 4000 matches similar to: "Passing an R matrix to a C program"
2009 Jan 05
1
can't get names of R_env
Hi,
I'm quite knew in R, so I might not have the R specific jargon.
But here is my problem,
I'm trying to access and use variabels given by a function environment,
more specifically the rho in do_optim in src/main/optim.c
According to the documentation
http://cran.r-project.org/doc/manuals/R-ints.html#The-_0027data_0027
the envsxp is defined as a tagged pairlist.
"ENVSXP: Pointers
2011 Jul 28
0
[LLVMdev] Spills and values present in both registers & stack
On Tue, Jul 26, 2011 at 11:35 AM, Taral <taralx at gmail.com> wrote:
>
> One piece of code I'm writing has a lot of intermediates, and I'm
> trying to optimize down the number of memory accesses. Here's a
> snippet from the start of the function, where I think there is some
> low-hanging fruit:
>
> # BB#0:
> pushq %rbp
> pushq %r15
2011 Jul 26
3
[LLVMdev] Spills and values present in both registers & stack
One piece of code I'm writing has a lot of intermediates, and I'm
trying to optimize down the number of memory accesses. Here's a
snippet from the start of the function, where I think there is some
low-hanging fruit:
# BB#0:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rcx
movq %rdi, -16(%rsp) # 8-byte Spill
movq (%rsi), %rdi
movq
2002 Mar 13
1
R matrix to Python
I'm trying to export an R (1.4.0 on linux) matrix to python
(+Pyclimate) via a binary file. The problem is
that while R writes by columns, python reads
by rows. For a 2D matrix, there is no problem:
writeBin writes vectors, so
writeBin(t(x)[1:length(x)],...) works fine.
But the objects I want to export are 3D arrays
(slice rasters of lat,lon for each time t).
One way is to use a loop over
2003 Jan 14
1
R-release.diff.gz: "patch detected! Assume -R? [n]"
Hi!
I'm upgrading to 1.6.2. (linux suse7.3).
I see that there is
a patch in R-release.diff.gz.
1. Is this patch stable? In other words, is
it adviced that I install R-release.diff.gz ?
2. When I do:
zcat R-release.diff.gz | patch -p1 -E
I get many lines such as:
patching file AUTHORS
Reversed (or previously applied) patch detected! Assume -R? [n]
Should I just accept the default
2008 Aug 29
3
extract variance components
HI,
I would like to extract the variance components estimation in lme function
like
a.fit<-lme(distance~age, data=aaa, random=~day/subject)
There should be three variances \sigma_day, \sigma_{day %in% subject } and
\sigma_e.
I can extract the \sigma_e using something like a.fit$var. However, I cannot
manage to extract the first two variance components. I can only see the
results in
2011 Jan 13
1
ERROR Unable to deny all devices for (solution)
Hi. This is not a question, I had the following problem and I want to share
my solution.
-------
I tried to create a new virtual machine with this command:
$ virt-install --connect qemu:///system -n vmTeste -r 512 -f
/var/lib/libvirt/images/vmTeste.qcow2 -s 2 -c
/media/Data/isos/debian-506-amd64-netinst.iso --vnc --noautoconsole
--accelerate --hvm
And I got this error:
ERROR Unable to
2008 Jan 04
1
Evaluating R expressions from C
I am currently puzzled by a passage in the R Extensions manual, section 5.10:
SEXP lapply(SEXP list, SEXP expr, SEXP rho)
{
R_len_t i, n = length(list);
SEXP ans;
if(!isNewList(list)) error("`list' must be a list");
if(!isEnvironment(rho)) error("`rho' should be an environment");
PROTECT(ans = allocVector(VECSXP, n));
2002 Jan 15
3
problem with --delete if I sync part of a dir
Hi,
I'm using rsync for a couple of things but I am at a point where I could not find a solution for my problem.
this is what I want to do:
rsync only the files i_* from a directory from machine A to machine Bi and delete them from machine B if they on longer exist on machine A.
so I use the command:
rsync -azv --stats -e ssh --delete i_* user@host:/dir/
When using this command the files
2005 Nov 07
3
R thread safe
Dear R-dev,
I would like to accelerate my R computation by using parallel OpenMP compilers
(e.g from Pathscale) on a 2-processor AMD server and I would like to know
whether R is a tread safe library. The main kernel of the OpenMP
parallelization is a C SEXP function that performs the computational routine in
parallel with:
*******************
SEXP example(SEXP list, SEXP expr, SEXP rho)
{
2011 Jan 21
3
complex transformation of data
Dear [R] people
Could you please help with following data transformation.
Any suggestions, hints, references and even guessing on performing any
of the following steps are highly appreciated. Those transformations are
crucial for my work.
(n_, _n, j_, k_ signify numbers)
SOURCE DATA:
id cycle1 cycle2 cycle3 ? cycle_n
1 c c c c
1 m m m m
1 f f f f
2 m m m NA
2 f f f NA
2 c c c NA
3 a a
2011 Jul 11
1
Spectral Coherence
Greetings,
I would like to estimate a spectral coherence between
two timeseries. The stats : spectrum() returns a coh matrix
which estimates coherence (squared).
A basic test which from which i expect near-zero coherence:
x = rnorm(500)
y = rnorm(500)
xts = ts(x, frequency = 10)
yts = ts(y, frequency = 10)
gxy = spectrum( cbind( xts, yts ) )
plot( gxy $ freq, gxy $
2020 Jun 16
1
[External] numericDeriv alters result of eval in R 4.0.1
Dear all
As far as I could trace, looking at the function C function numeric_deriv,
this unwanted behavior comes from the inner most loop in, at the very end
of the function,
for(i = 0, start = 0; i < LENGTH(theta); i++) {
for(j = 0; j < LENGTH(VECTOR_ELT(pars, i)); j++, start += LENGTH(ans)) {
SEXP ans_del;
double origPar, xx, delta;
origPar = REAL(VECTOR_ELT(pars, i))[j];
2009 Sep 03
1
Running an expression 1MN times using embedded R
Hello,
I'm evaluating this expression
expression({ for(x in 1:5){ .Call('rh_status','x') }})
a million times from a program with R embedded in it. I have attached
reproducible code that crashes with
Program received signal SIGSEGV, Segmentation fault.
0x00002b499ca40a6e in R_gc_internal (size_needed=0) at memory.c:1309
1309 FORWARD_NODE(R_PPStack[i]);
Current language:
2014 Mar 04
3
[LLVMdev] [cfe-dev] C++11 reverse iterators (was C++11 is here)
On Mon, Mar 3, 2014 at 12:26 AM, Chris Lattner <sabre at nondot.org> wrote:
>
> On Mar 2, 2014, at 8:53 PM, Renato Golin <renato.golin at linaro.org> wrote:
>
> > On 3 March 2014 12:32, Pete Cooper <peter_cooper at apple.com> wrote:
> >> Would those work with a foreach construct? Perhaps I forgot to mention
> that was what I'm trying to work out
2012 Jan 09
1
reposurgeon progress
This is a consolidated reply to your four most recent emails.
> I am trying to leverage reposurgeon to automate the process of finding merge
> points, and I seem to be spinning my wheels. Can you provide an example of how
> you are searching for merges?
Not a working one, yet. That code is buggy. It's my next thing to work on.
>reposurgeon% merge (apcsmart-dev)
2001 Oct 18
3
Rcmd SHLIB in rw1031 (R for Win)
Thanks for the answers on readme.packages.
I have installed Rw1031 from SetupR.exe including the option
for compiling source files and, following directions in
www.stats.ox.ac.ul/pub/Rtools, have installed:
-tools.zip
-Perl (Active Perl)
-mingw-1.1.tar.gz
-copied sh.exe to c:\bin\sh.exe
After Perl installation, its directory is added to my path. I have also
added the directory where the R
2005 Aug 22
2
RFC: "loop connections"
I've just implemented a generalization of R's text connections, to
also support reading/writing raw binary data. There is very little
new code to speak of. For input connections, I wrote code to populate
the old text connection buffer from a raw vector, and provided a new
raw_read() method. For output connections, I wrote a raw_write() to
append to a raw vector. On input, the mode
2007 Jan 19
5
Problem with C extension
Hello,
I try to write an extension in C, to get a faster functions.
Therefore I have to add an element (vector) to a vector. The command in
R is very simple: x = c(x,a)
But in C I have the problem to reallocate my vector for getting more
space. Everything I tried, I get a "Segmentation fault".
So, how can I combine two vectors in C and give the result back to R
(return(x))?
Thanks
2020 Jun 30
2
Build a R call at C level
Hi All,
I was reading the R extension manual section 5.11 ( Evaluating R expression
from C) and I tried to build a simple call to the sum function. Please see
below.
call_to_sum <- inline::cfunction(
language = "C",
sig = c(x = "SEXP"), body = "
SEXP e = PROTECT(lang2(install(\"sum\"), x));
SEXP ans = PROTECT(eval(e, R_GlobalEnv));
UNPROTECT(2);
return