search for: lglsxp

Displaying 20 results from an estimated 48 matches for "lglsxp".

2012 Sep 03
1
Possible page inefficiency in do_matrix in array.c
In do_matrix in src/array.c there is a type switch containing : case LGLSXP : for (i = 0; i < nr; i++) for (j = 0; j < nc; j++) LOGICAL(ans)[i + j * NR] = NA_LOGICAL; That seems page inefficient, iiuc. Think it should be : case LGLSXP : for (j = 0; j < nc; j++) for (i = 0; i < nr; i++) LOGICAL(ans)[i + j * NR] = NA_LOGICAL; or...
2003 Dec 16
1
Memory issues in "aggregate" (PR#5829)
...rigger (Mb) Ncells 701188 18.8 2683553 71.7 Vcells 1447712 11.1 8201413 62.6 > memory.profile() NILSXP SYMSXP LISTSXP CLOSXP ENVSXP PROMSXP LANGSXP 1 7228 244243 3949 495 773 113819 SPECIALSXP BUILTINSXP CHARSXP LGLSXP INTSXP 207 1177 283663 4661 0 0 49 REALSXP CPLXSXP STRSXP DOTSXP ANYSXP VECSXP EXPRSXP 13383 9 24870 0 0 2598 2 BCODESXP EXTPTRSXP WEAKREFSX...
2006 Nov 21
2
packBits (PR#9374)
.../character.c do_packBits rutin one can find the following checking if (TYPEOF(x) != RAWSXP && TYPEOF(x) != RAWSXP && TYPEOF(x) != INTSXP) errorcall(call, _("argument 'x' must be raw, integer or logical")); It's obvious that some of the RAWSXP should be LGLSXP
2001 Dec 07
2
Memory problem
Dear all, I have written a little R program to convert images. See below. Within the loop over j (the filenames) memory consumption grows constantly. rm( ... ) inside the loop did not help. Memory does not grow if I remove the writeBin statements between the two #-------- marks. But obviously this is not solution I want... Thanks for any advice. Manfred Baumstark P.S. As I'm new to R:
2016 Sep 16
1
getGraphicsEvent() questions, minor feature/tweak request, and patch(es).
...ng with asChar() and only comparing against R_NaString causes NULL values, functions, expression objects and potentially others to become valid prompt values as well, so I'm using TYPEOF() to restrict accepted values further. I've found manually entered NA values are interpreted as being of LGLSXP, so that's the only type I'm accepting NA values for. Is there a better way? There's an isna() in library/utils/src/io.c, but that module doesn't seem to be available to the linker in the current build script for gevents.c's module, which would make it a more invasive patch to u...
2014 Oct 31
3
ScalarLogical and setAttrib
Is it expected that attributes set on a LGLSXP created by ScalarLogical will apply to all future objects created by ScalarLogical as well? For example: the 'test1' function below returns FALSE and 'test2' returns FALSE with an attribute: library(inline) test1 <- cfunction(body = 'return ScalarLogical(0);') test...
2002 Oct 14
1
R 1.6.0 Solaris crash with xmalloc: out of virtual memory
...- gc() returns: used (Mb) gc trigger (Mb) Ncells 254150 6.8 467875 12.5 Vcells 408499 3.2 886807 6.8 --- memory.profile() returns: NilSXP SymSXP ListSXP CloSXP EnvSXP PromSXP LangSXP SpecialSXP 1 4919 128880 1440 13 18 63607 59 BUILTINSXP CHARSXP LGLSXP - - INTSXP REALSXP CPLXSXP STRSXP 513 37178 1712 0 0 237 9047 8 10201 DOTSXP ANYSXP VECSXP EXPRSXP - EXTPTRSXP WEAKREFSXP 1 0 341 2 0 0 0 ---------------- Just before the crash ------------ --- gc() returns: used (Mb) gc t...
2012 Feb 06
1
Segfault on ".C" registration via R_CMethodDef according to 'Writing R Extensions'.
...ing R Extensions' of version 2.14.1 an example is given that specifies to use the fourth field (type information) for definitions of C routines that use the ".C" calling convention: R_CMethodDef cMethods[] = { {"myC", (DL_FUNC) &myC, 4, {REALSXP, INTSXP, STRSXP, LGLSXP}}, /* segfault! */ {NULL, NULL, 0} }; If I follow this example I get compiler warnings or errors (whether I use C or C++, respectively) and a segmentation fault (in the case of C) when doing R CMD INSTALL, which seem to happen during testing. See build log at the end of this e-mail. When...
2004 Apr 26
1
Segfault: .Call and classes with logical slots
...at a class containing a logical slot segfaults under R-1.9.0 when `gctorture(on = TRUE)' is used: Code code (dummy.c): #include <Rdefines.h> SEXP foo() { SEXP ans; PROTECT(ans = NEW_OBJECT(MAKE_CLASS("test"))); SET_SLOT(ans, install("lgl"), allocVector(LGLSXP, 1)); LOGICAL(GET_SLOT(ans, install("lgl")))[0] = TRUE; UNPROTECT(1); return(ans); } R code (dummy.R): dyn.load("dummy.so") setClass("test", representation = representation(lgl = "logical")) a = .Call("foo") a # OK gctorture(on = TR...
2019 Jan 21
0
orderVector1 (sort.c): Tiny improvement concerning nalast
...o avoid the loop of line 1105. Best regards, Emilio *** /home/emilio/Descargas/R-3.5.2/src/main/sort.c 2018-11-07 00:15:02.000000000 +0100 --- /home/emilio/Descargas/R-3.5.2/src/main/sort2.c 2019-01-21 11:13:07.414332755 +0100 *************** *** 1079,1099 **** switch (TYPEOF(key)) { case LGLSXP: case INTSXP: ! for (i = 0; i < n; i++) isna[i] = (ix[i] == NA_INTEGER); ! break; case REALSXP: ! for (i = 0; i < n; i++) isna[i] = ISNAN(x[i]); ! break; case STRSXP: ! for (i = 0; i < n; i++) isna[i] = (sx[i] == NA_STRING); ! break; case CPLXSXP:...
2005 May 12
0
Patch to address (PR#7853) -- tested briefly, seems to
...n = LENGTH(s); > + rawptr = RAW(s); > + if (dup) { > + rawptr = (unsigned char *) R_alloc(n, sizeof(unsigned char)); > + for (i = 0; i < n; i++) > + rawptr[i] = RAW(s)[i]; > + } > + return (void *) rawptr; > + break; > case LGLSXP: > case INTSXP: > n = LENGTH(s); > @@ -329,6 +340,7 @@ > > static SEXP CPtrToRObj(void *p, SEXP arg, int Fort, > R_NativePrimitiveArgType type) > { > + unsigned char *rawptr; > int *iptr, n=length(arg); > float *sptr; > double *rptr; > @@ -...
2012 Oct 04
1
identical() fails to compare isS4(<S4 instance>) to TRUE
> setClass("A", "integer") > isS4(new("A")) [1] TRUE > identical(isS4(new("A")), TRUE) [1] FALSE > sessionInfo() R Under development (unstable) (2012-10-04 r60876) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5]
2003 Oct 22
1
Windows RConsole Focus
...(RConsole); return 0; } src/gnuwin32/rui.h ------------------ int winconsolefocus(void); src/gnuwin32/extra.c -------------------- SEXP do_winconsolefocus(SEXP call, SEXP op, SEXP args, SEXP rho) { SEXP ans; Rboolean success = TRUE; winconsolefocus(); PROTECT(ans = allocVector(LGLSXP, 1)); LOGICAL(ans)[0] = success; UNPROTECT(1); return ans; } src/main/names.c ---------------- {"winConsoleFocus",do_winconsolefocus,0,11, 0, {PP_FUNCALL, PREC_FN, 0}}, src/include/Internal.h ---------------------- SEXP do_winconsolefocus(SEXP, SEXP, SEXP, SEXP);...
2012 Jun 19
1
R and C pointers
...to extract individual values)? I tried: pdimx = REAL(dimx); This is where R complains that: REAL() can only be applied to a 'numeric', not a 'integer' Much in the same line, what would be the procedure to create pointers to a logical vector y? I tried: PROTECT(y = coerceVector(y, LGLSXP)); py = REAL(y); where R throws a similar error. Thanks very much in advance, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel.:+40 21 3126618 \ ? ? ? ?+40 21 3120210 / int.101 Fax: +40 21 3158391
2010 Sep 08
0
Correction to vec-subset speed patch
...=========================================== --- src/main/subset.c (revision 52822) +++ src/main/subset.c (working copy) @@ -59,73 +59,77 @@ if (x == R_NilValue) return x; - for (i = 0; i < n; i++) { - ii = INTEGER(indx)[i]; - if (ii != NA_INTEGER) - ii--; - switch (mode) { - case LGLSXP: - if (0 <= ii && ii < nx && ii != NA_LOGICAL) - LOGICAL(result)[i] = LOGICAL(x)[ii]; - else - LOGICAL(result)[i] = NA_INTEGER; - break; - case INTSXP: - if (0 <= ii && ii < nx && ii != NA_INTEGER) - INTEGER(result)[i] = INTEGER(x)[ii];...
2017 Oct 20
1
Illegal Logical Values
I'm wondering if WRE Section 5.2 should be a little more explicit about misuse of integer values other than NA, 0, and 1 in LGLSXPs.? I'm thinking of this passage: > Logical values are sent as 0 (FALSE), 1 (TRUE) or INT_MIN = -2147483648 (NA, but only if NAOK is true), and the compiled code should return one of these three values. (Non-zero values other than INT_MIN are mapped to TRUE.) The parenthetical seems to sug...
2010 Aug 26
2
Speeding up transpose
...dividing by 1.) I've appended below the new version of the modified part of the do_transpose function in src/main/array.c. Radford Neal ---------------------------------------------------------------------- PROTECT(r = allocVector(TYPEOF(a), len)); switch (TYPEOF(a)) { case LGLSXP: case INTSXP: for (i = 0, j = 0; i<len; i += 1, j += nrow) { if (j>=len) j -= (len-1); INTEGER(r)[i] = INTEGER(a)[j]; } case REALSXP: for (i = 0, j = 0; i<len; i += 1, j += nrow) { if (j>=len) j -= (len-1);...
2009 Jan 30
2
Problem installing RMySQL ("S4R.h:40:17: error: S.h: No such file or directory"?)
...In function 'RS_na_set': RS-DBI.c:1218: error: 'type' undeclared (first use in this function) RS-DBI.c:1219: error: 'INTSXP' undeclared (first use in this function) RS-DBI.c:1221: error: 'NA_INTEGER' undeclared (first use in this function) RS-DBI.c:1223: error: 'LGLSXP' undeclared (first use in this function) RS-DBI.c:1225: error: 'NA_LOGICAL' undeclared (first use in this function) RS-DBI.c:1227: error: 'REALSXP' undeclared (first use in this function) RS-DBI.c:1229: error: 'NA_REAL' undeclared (first use in this function) RS-DBI.c:12...
2005 Jan 03
2
Memory problem ... Again
...4.3 ... > mem.limits() nsize vsize NA NA > object.size(Data) [1] 608355664 > memory.profile() NILSXP SYMSXP LISTSXP CLOSXP ENVSXP PROMSXP LANGSXP 1 30484 372383 4845 420 180 127274 SPECIALSXP BUILTINSXP CHARSXP LGLSXP INTSXP 203 1168 111430 5296 0 0 44650 REALSXP CPLXSXP STRSXP DOTSXP ANYSXP VECSXP EXPRSXP 13382 9 60170 0 0 26003 0 BCODESXP EXTPTRSXP WEAKREFSXP...
2004 Mar 26
4
cbind/rbind fail on matrixes containing lists (PR#6702)
Today's R 1.9.0 beta: > m1 [,1] [,2] [,3] [,4] [1,] NA NA NA NA [2,] NA NA NA NA [3,] NA NA NA NA [4,] NA NA NA NA > class(m1[1,1]) [1] "list" > cbind(m1,m1) Error in cbind(...) : cannot create a matrix from these types > rbind(m1,m1) Error in rbind(...) : cannot create a matrix from these types > version _