search for: rf_duplicate

Displaying 20 results from an estimated 30 matches for "rf_duplicate".

2007 May 29
1
Use of Rf_duplicate
First, thanks to those of you who responded to my previous post about my code that was taking longer and longer to process. After following your suggestions, and I now thinking that the problem was some calls to Rf_duplicate in my C code. So I'm hoping I could get some clarification on what Rf_duplicate actually does. What is the real difference between PROTECT(y=x); and PROTECT (y = duplicate(x)); ? I do use duplicate on the list objects that are passed directly from R, since in the passed, I got some odd re...
2004 Aug 24
1
Need help debugging R.
...s worth a sample trace below: (gdb) where #0 0x00a22096 in _int_free () from /lib/tls/libc.so.6 #1 0x00a2101b in free () from /lib/tls/libc.so.6 #2 0x080d632a in R_SetPPSize () #3 0x080d7d13 in do_regFinaliz () #4 0x080d9503 in do_gctime () #5 0x080d8fcb in Rf_allocVector () #6 0x080a9f7f in Rf_duplicate () #7 0x080aa18c in Rf_duplicate () #8 0x080b7b28 in R_execMethod () #9 0x080b8a0f in do_function () #10 0x080b8bf9 in do_function () #11 0x080b70b7 in Rf_eval () #12 0x080b87a5 in do_begin () #13 0x080b70b7 in Rf_eval () #14 0x080b80b1 in do_for () #15 0x080b70b7 in Rf_eval () #16 0x080b87a5 in...
2007 Jun 21
2
segfault during cbind
...D848: ReleaseLargeFreeVectors (memory.c:760) ==25398== by 0x4F359E9: RunGenCollect (memory.c:1378) ==25398== by 0x4F38938: R_gc_internal (memory.c:2171) ==25398== by 0x4F38046: Rf_allocVector (memory.c:1961) ==25398== by 0x4EDE779: duplicate1 (duplicate.c:221) ==25398== by 0x4EDD698: Rf_duplicate (duplicate.c:115) ==25398== by 0x4E7BB34: cbind (bind.c:1258) ==25398== by 0x4E7B430: do_bind (bind.c:1113) ==25398== by 0x4F42A1B: do_internal (names.c:1116) ==25398== by 0x4EF959B: Rf_eval (eval.c:463) ==25398== by 0x4EF9F91: Rf_applyClosure (eval.c:666) gdb says (gdb) backtrace...
2000 Dec 18
1
1.2.0 segfault
...tation fault. 0x763cc in Rf_allocVector (type=14, length=2) at memory.c:1551 1551 CLASS_GET_FREE_NODE(node_class, s); (gdb) bactrace Undefined command: "bactrace". Try "help". (gdb) backtrace #0 0x763cc in Rf_allocVector (type=14, length=2) at memory.c:1551 #1 0x5561c in Rf_duplicate (s=0xbcd6f0) at duplicate.c:140 #2 0x55518 in Rf_duplicate (s=0x99c508) at duplicate.c:133 #3 0x55518 in Rf_duplicate (s=0xc63468) at duplicate.c:133 #4 0x5b958 in do_set (call=0xb72804, op=0x1c6304, args=0xb727cc, rho=0x499a38) at eval.c:1012 #5 0x5a114 in Rf_eval (e=0xb72804, rho=0x499a38...
2004 Sep 13
6
Spare some CPU cycles for testing lme?
If anyone has a few extra CPU cycles to spare, I'd appreciate it if you could verify a problem that I have encountered. Run the code below and tell me if it crashes your R before completion. library(lme4) data(bdf) dump<-sapply( 1:50000, function(i) { fm <- lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, data = bdf, random = ~ IQ.ver.cen | schoolNR); cat("
2016 Feb 26
2
[patch] Support many columns in model.matrix
Generating a model matrix with very large numbers of columns overflows the stack and/or runs very slowly, due to the implementation of TrimRepeats(). This patch modifies it to use Rf_duplicated() to find the duplicates. This makes the running time linear in the number of columns and eliminates the recursive function calls. Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: stats_model.patch Type: text/x-patch Size: 2182 bytes Desc: not available U...
2010 Mar 11
1
Shrinking a List
...new VECSXP B of length M and /duplicate/ the elements of A. Since I do this often, it appears to be wasteful, so can I a) is there a resize function for a VECSXP? if not b) can i just do something like SET_VECTOR_ELT(B,i, VECTOR_ELT(A,i)) instead of wrapping VECTOR_ELT(A,i) inside a call to Rf_duplicate (i will be UNPROTECTING A and B, though I will return B) I suppose I can do (b), since B (since it is being returned) is automatically protected and therefore all its elements will also be protected, correct? Thank you Saptarshi
2007 May 22
2
inline C/C++ in R: question and suggestion
...t it quite obvious. After installing "inline" the example should just work by copy-pasting. Best and thanks in advance, Oleg code <- character(17) code[1] <- " SEXP res;" code[2] <- " int nprotect = 0, nx, ny, nz, x, y;" code[3] <- " PROTECT(res = Rf_duplicate(a)); nprotect++;" code[4] <- " nx = INTEGER(GET_DIM(a))[0];" code[5] <- " ny = INTEGER(GET_DIM(a))[1];" code[6] <- " nz = INTEGER(GET_DIM(a))[2];" code[7] <- " double sigma2 = REAL(s)[0] * REAL(s)[0], d2 ;" code[8] <- " double cx...
2004 Jan 09
2
debugging strange segfault
...arabid[,1], ntree=100) > predict(fit, arabid[,-1]) Done! Program received signal SIGSEGV, Segmentation fault. 0x40152a48 in malloc () from /lib/libc.so.6 [If I change the DUP=FALSE in the .C() call to TRUE, I get the following: Program received signal SIGSEGV, Segmentation fault. 0x080b412b in Rf_duplicate (s=0x1) at duplicate.c:75 75 switch (TYPEOF(s)) { ] At this point I'm clueless as to what to do next, and would very much appreciate any help! Best, Andy Andy Liaw, PhD Biometrics Research PO Box 2000, RY33-300 Merck Research Labs Rahway, NJ 07065 mailto:andy_lia...
2008 Feb 12
4
assigning NULLs to elements of a list
...und? Thanks for help, Oleg Sklyar Here goes an example, the inline C-code does exactly what I would prefer R were doing, but both R examples do remove the element 'b': x = list(a=c(1L,2L), b=matrix(runif(4),2,2), c=LETTERS[1:3]) library(inline) code=" SEXP res; PROTECT(res = Rf_duplicate(x)); SET_VECTOR_ELT(res,1,R_NilValue); UNPROTECT(1); return res; " setnull = cfunction(signature(x="list"),code) setnull(x) # $a # [1] 1 2 # $b # NULL # $c # [1] "A" "B" "C" y = x x[[2]] = NULL x # $a # [1] 1 2 # $c # [1] "A" "B...
2016 Feb 29
1
[patch] Support many columns in model.matrix
...t;> on Fri, 26 Feb 2016 15:58:20 -0800 writes: > > > Generating a model matrix with very large numbers of > > columns overflows the stack and/or runs very slowly, due > > to the implementation of TrimRepeats(). > > > This patch modifies it to use Rf_duplicated() to find the > > duplicates. This makes the running time linear in the > > number of columns and eliminates the recursive function > > calls. > > Thank you, Karl. > I've committed this (very slightly modified) to R-devel, > > (also after looking f...
2001 Jul 02
0
ReleaseLargeFreeVectors SIGSEGV (?) (PR#1008)
...at malloc.c:3023 #2 0x80a6b60 in ReleaseLargeFreeVectors () at memory.c:673 #3 0x80a82b2 in RunGenCollect (size_needed=2000) at memory.c:1079 #4 0x80a9365 in R_gc_internal (size_needed=2000) at memory.c:1669 #5 0x80a9027 in Rf_allocVector (type=14, length=2000) at memory.c:1541 #6 0x808cb58 in Rf_duplicate (s=0x9548498) at duplicate.c:140 #7 0x80660fa in do_makelist (call=0x8a3f7c0, op=0x81a7c00, args=0x8239258, rho=0x824e510) at builtin.c:367 #8 0x809136f in Rf_eval (e=0x8a3f7c0, rho=0x824e510) at eval.c:424 #9 0x8092cf1 in Rf_evalList (el=0x8a3ee30, rho=0x824e510) at eval.c:1171 #10 0x80912...
2007 Feb 13
2
anyone has C++ STL classes stability issue if used with R
...xel> PixelPrQueue; SEXP lib_filterInvWS (SEXP x) { SEXP res; int i, j, index; double val; PixelPrQueue pq; int nx = INTEGER ( GET_DIM(x) )[0]; int ny = INTEGER ( GET_DIM(x) )[1]; int nz = INTEGER ( GET_DIM(x) )[2]; int nprotect = 0; PROTECT ( res = Rf_duplicate(x) ); nprotect++; // Pixel px; for (int im = 0; im < nz; im++ ) { double * src = &( REAL(x)[ im * nx * ny ] ); double * tgt = &( REAL(res)[ im * nx * ny ] ); for ( j = 0; j < ny; j++ ) for ( i = 0; i < nx; i++ ) {...
2019 Nov 04
2
Questions on the R C API
Hi All, I have some questions regarding the R C API. Let's assume I have a function which is defined as follows: R file: myfunc <- function(a, b, ...) .External(Cfun, a, b, ...) C file: SEXP Cfun(SEXP args) { args = CDR(args); SEXP a = CAR(args); args = CDR(args); SEXP b = CAR(args); args = CDR(args); /* continue to do something with remaining arguments in "..."
2016 Feb 29
0
[patch] Support many columns in model.matrix
...oject.org> >>>>> on Fri, 26 Feb 2016 15:58:20 -0800 writes: > Generating a model matrix with very large numbers of > columns overflows the stack and/or runs very slowly, due > to the implementation of TrimRepeats(). > This patch modifies it to use Rf_duplicated() to find the > duplicates. This makes the running time linear in the > number of columns and eliminates the recursive function > calls. Thank you, Karl. I've committed this (very slightly modified) to R-devel, (also after looking for a an example that runs on a non-hug...
2007 Oct 05
1
Sklyar's inline package: how to return a list?
....5 -5.5 -8.5 [3,] -3.5 -6.5 -9.5 > # -------------------------------------------------------------------------------------------------------------------------- library( inline ) c.code <- " SEXP res; int nprotect = 0, nx, ny, x, y; double *dptr, *resptr, sum; PROTECT(res = Rf_duplicate(a)); nprotect++; nx = INTEGER(GET_DIM(a))[0]; ny = INTEGER(GET_DIM(a))[1]; dptr = REAL(a); resptr = REAL( res ); sum = 0.0; for (x = 0; x < nx; x++) for (y = 0; y < ny; y++) { resptr[ x + y*nx ] = -dptr[ x + y*nx ]; sum += -dptr[ x + y*nx ]; } UNPROTECT...
2013 Jul 14
1
unmapped memory core dump with pure R program?
...know. alas (gdb) bt #0 0x00007ff956be3857 in ?? () from /usr/lib/R/lib/libR.so #1 0x00007ff956be67d3 in Rf_allocVector () from /usr/lib/R/lib/libR.so #2 0x00007ff956b90338 in ?? () from /usr/lib/R/lib/libR.so #3 0x00007ff956b8fcfa in ?? () from /usr/lib/R/lib/libR.so #4 0x00007ff956b90875 in Rf_duplicate () from /usr/lib/R/lib/libR.so #5 0x00007ff956b48e98 in ?? () from /usr/lib/R/lib/libR.so #6 0x00007ff956bb56da in ?? () from /usr/lib/R/lib/libR.so #7 0x00007ff956bba9a8 in Rf_eval () from /usr/lib/R/lib/libR.so #8 0x00007ff956bbec39 in Rf_applyClosure () from /usr/lib/R/lib/libR.so #9 0x0000...
2002 Jan 02
1
Building R-1.4 on Tru64
...bug.report() from R-1.3.1 at the end.) The relevant part of the log is below. Any ideas? gcc -shared -o methods.so do_substitute_direct.o methods_list_dispatch.o method_meta_data.o slot.o -L/usr/local/lib /usr/ucb/ld: Warning: Unresolved: TYPEOF Rf_error Rf_protect Rf_substitute Rf_unprotect Rf_duplicate Rf_VectorToPairList R_NilValue Rf_NewEnvironment R_set_standardGeneric_ptr R_GlobalEnv R_set_quick_method_check Rf_install Rf_allocVector LOGICAL R_PreserveObject Rf_mkChar SET_STRING_ELT Rf_findVar R_UnboundValue VECTOR_ELT R_NamesSymbol Rf_getAttrib Rf_length STRING_ELT R_CHAR R_do_slot Rf_asChar...
2019 Nov 04
0
Questions on the R C API
Hi Morgan, My solutions might not be the best one(I believe it's not), but it should work for your question. 1. Have you considered Rf_duplicate function? If you want to change the value of `a` and reset it later, you have to have a duplication somewhere for resetting it. Instead of changing the value of `a` directly, why not changing the value of a duplicated `a`? So you do not have to reset it. 2. I think a pairlist behaves like a linked...
2003 Sep 07
3
bug in crossprod? (PR#4092)
# Your mailer is set to "none" (default on Windows), # hence we cannot send the bug report directly from R. # Please copy the bug report (after finishing it) to # your favorite email program and send it to # # r-bugs@r-project.org # ###################################################### # The last line of following code produces a segmentation fault: x <- 1:10 f <- gl(5,2)