Re: [Rd] pcre problems
OK thanks Tomas, but I get OK~ sudo apt-get build-dep r-base Reading package lists... Done E: Unable to find a source package for r-base OK~ hankin.ro...@gmail.com On Fri, Mar 1, 2019 at 8:47 PM Tomas Kalibera wrote: > > On 3/1/19 7:10 AM, robin hankin wrote: > > thanks for this guys. > > > > I only compiled pcre myself as a last resort, because of the > > ./configure failure. But AFAICS apt-get reports correct > > installation: > > > > OK~/Downloads/R-devel sudo apt-get install r-base-dev > > Reading package lists... Done > > Building dependency tree > > Reading state information... Done > > r-base-dev is already the newest version (3.5.2-1cosmic). > > 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. > > OK~/Downloads/R-devel > > I would just run this > > apt-get build-dep r-base > > that will install all packages needed to _build_ r-base, so including PCRE. > > Best > Tomas > > > > > config.log gives me: > > > > configure:42208: $? = 0 > > configure:42208: result: yes > > configure:42208: checking for pcre.h > > configure:42208: result: yes > > configure:42208: checking pcre/pcre.h usability > > configure:42208: gcc -c -g -O2 -I/usr/local/include conftest.c >&5 > > conftest.c:289:10: fatal error: pcre/pcre.h: No such file or directory > > #include > >^ > > compilation terminated. > > configure:42208: $? = 1 > > configure: failed program was: > > | /* confdefs.h */ > > | #define PACKAGE_NAME "R" > > | #define PACKAGE_TARNAME "R" > > | #define PACKAGE_VERSION "3 > > > > and > > > > HAVE_UNISTD_H > > | # include > > | #endif > > | #include > > configure:42208: result: no > > configure:42208: checking pcre/pcre.h presence > > configure:42208: gcc -E -I/usr/local/include conftest.c > > conftest.c:256:10: fatal error: pcre/pcre.h: No such file or directory > > #include > >^ > > compilation terminated. > > configure:42208: $? = 1 > > configure: failed program was: > > | /* confdefs.h */ > > | #define PACKAGE_NAME "R" > > | #define PACKAGE_TARNAME "R" > > | #define PACKAGE_VERSION "3.6.0" > > | #define PACKAGE_STRING "R 3.6.0" > > | #define PACKAGE_BUGREPOR > > > > > > > > hankin.ro...@gmail.com > > > > > > > > > > On Mon, Feb 25, 2019 at 9:39 PM Tomas Kalibera > > wrote: > >> On 2/25/19 6:25 AM, robin hankin wrote: > >>> Hi there, ubuntu 18.04.2, trying to compile R-devel 3.6.0, svn 76155. > >>> > >>> I am having difficulty compiling R. I think I have pcre installed > >>> correctly: > >> You can use > >> > >> apt-get build-dep r-base > >> > >> to install binary Ubuntu packages needed to build R from source, > >> including PCRE, so there should be no need to compile PCRE from source. > >> If you need for some special reason to compile PCRE from source, please > >> see R Admin Manual, section A.1 on how to configure PCRE. The manual > >> also says how to set compilation flags for R to look for headers in > >> other directories. Sometimes it helps to search the config.log when > >> configure fails. If still in trouble, please report how you built PCRE > >> and how you told R where to find it, and the relevant part of > >> config.log, to maximize chances people could offer useful advice. > >> > >> Best, > >> Tomas > >> > >>> OK~/Downloads/R-devel pcretest -C > >>> PCRE version 8.41 2017-07-05 > >>> Compiled with > >>> 8-bit support > >>> UTF-8 support > >>> No Unicode properties support > >>> No just-in-time compiler support > >>> Newline sequence is LF > >>> \R matches all Unicode newlines > >>> Internal link size = 2 > >>> POSIX malloc threshold = 10 > >>> Parentheses nest limit = 250 > >>> Default match limit = 1000 > >>> Default recursion depth limit = 1000 > >>> Match recursion uses stack > >>> OK~/Downloads/R-devel > >>> > >>> > >>> But ./configure gives me this: > >>> > >>> [snip] > >>> checking for pcre.h... yes > >>> checking pcre/pcre.h usability... no > >>> checking pcre/pcre.h presence... no > >>> checking for pcre/pcre.h... no > >>> checking if PCRE version >= 8.20, < 10.0 and has UTF-8 support... no > >>> checking whether PCRE support suffices... configure: error: pcre >= > >>> 8.20 library and headers are required > >>> OK~/Downloads/R-devel > >>> > >>> can anyone advise? > >>> > >>> > >>> > >>> > >>> > >>> > >>> hankin.ro...@gmail.com > >>> > >>> __ > >>> R-devel@r-project.org mailing list > >>> https://stat.ethz.ch/mailman/listinfo/r-devel > >> > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] pcre problems
On 3/1/19 9:03 AM, robin hankin wrote: OK thanks Tomas, but I get OK~ sudo apt-get build-dep r-base Reading package lists... Done E: Unable to find a source package for r-base OK~ It seems you need to enable source code repositories on your system (and then run apt-get update). You can enable them in /etc/apt/sources.list, uncomment all lines starting with deb-src. Best Tomas hankin.ro...@gmail.com On Fri, Mar 1, 2019 at 8:47 PM Tomas Kalibera wrote: On 3/1/19 7:10 AM, robin hankin wrote: thanks for this guys. I only compiled pcre myself as a last resort, because of the ./configure failure. But AFAICS apt-get reports correct installation: OK~/Downloads/R-devel sudo apt-get install r-base-dev Reading package lists... Done Building dependency tree Reading state information... Done r-base-dev is already the newest version (3.5.2-1cosmic). 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. OK~/Downloads/R-devel I would just run this apt-get build-dep r-base that will install all packages needed to _build_ r-base, so including PCRE. Best Tomas config.log gives me: configure:42208: $? = 0 configure:42208: result: yes configure:42208: checking for pcre.h configure:42208: result: yes configure:42208: checking pcre/pcre.h usability configure:42208: gcc -c -g -O2 -I/usr/local/include conftest.c >&5 conftest.c:289:10: fatal error: pcre/pcre.h: No such file or directory #include ^ compilation terminated. configure:42208: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "R" | #define PACKAGE_TARNAME "R" | #define PACKAGE_VERSION "3 and HAVE_UNISTD_H | # include | #endif | #include configure:42208: result: no configure:42208: checking pcre/pcre.h presence configure:42208: gcc -E -I/usr/local/include conftest.c conftest.c:256:10: fatal error: pcre/pcre.h: No such file or directory #include ^ compilation terminated. configure:42208: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "R" | #define PACKAGE_TARNAME "R" | #define PACKAGE_VERSION "3.6.0" | #define PACKAGE_STRING "R 3.6.0" | #define PACKAGE_BUGREPOR hankin.ro...@gmail.com On Mon, Feb 25, 2019 at 9:39 PM Tomas Kalibera wrote: On 2/25/19 6:25 AM, robin hankin wrote: Hi there, ubuntu 18.04.2, trying to compile R-devel 3.6.0, svn 76155. I am having difficulty compiling R. I think I have pcre installed correctly: You can use apt-get build-dep r-base to install binary Ubuntu packages needed to build R from source, including PCRE, so there should be no need to compile PCRE from source. If you need for some special reason to compile PCRE from source, please see R Admin Manual, section A.1 on how to configure PCRE. The manual also says how to set compilation flags for R to look for headers in other directories. Sometimes it helps to search the config.log when configure fails. If still in trouble, please report how you built PCRE and how you told R where to find it, and the relevant part of config.log, to maximize chances people could offer useful advice. Best, Tomas OK~/Downloads/R-devel pcretest -C PCRE version 8.41 2017-07-05 Compiled with 8-bit support UTF-8 support No Unicode properties support No just-in-time compiler support Newline sequence is LF \R matches all Unicode newlines Internal link size = 2 POSIX malloc threshold = 10 Parentheses nest limit = 250 Default match limit = 1000 Default recursion depth limit = 1000 Match recursion uses stack OK~/Downloads/R-devel But ./configure gives me this: [snip] checking for pcre.h... yes checking pcre/pcre.h usability... no checking pcre/pcre.h presence... no checking for pcre/pcre.h... no checking if PCRE version >= 8.20, < 10.0 and has UTF-8 support... no checking whether PCRE support suffices... configure: error: pcre >= 8.20 library and headers are required OK~/Downloads/R-devel can anyone advise? hankin.ro...@gmail.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] pcre problems
Still something wrong. I've uncommented the deb-src lines in sources.list as you suggested (and I thought it couldn't hurt to try --allow-unauthenticated as well) and: root@limpet:/etc/apt# apt-get update --allow-unauthenticated Hit:1 http://nz.archive.ubuntu.com/ubuntu bionic InRelease Hit:2 http://repo.steampowered.com/steam precise InRelease Hit:3 http://nz.archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:4 http://nz.archive.ubuntu.com/ubuntu bionic-backports InRelease Ign:5 http://cran.rstudio.com/bin/linux/ubuntu bionic/ InRelease Err:6 http://cran.rstudio.com/bin/linux/ubuntu bionic/ Release 404 Not Found [IP: 13.35.146.80 80] Hit:7 https://cloud.r-project.org/bin/linux/ubuntu cosmic-cran35/ InRelease Hit:8 http://ppa.launchpad.net/edd/misc/ubuntu bionic InRelease Hit:9 http://security.ubuntu.com/ubuntu bionic-security InRelease Hit:10 http://ppa.launchpad.net/marutter/c2d4u/ubuntu bionic InRelease Ign:11 http://ppa.launchpad.net/marutter/rdev/ubuntu bionic InRelease Hit:12 http://ppa.launchpad.net/marutter/rrutter3.5/ubuntu bionic InRelease Hit:13 http://ppa.launchpad.net/teejee2008/ppa/ubuntu bionic InRelease Err:14 http://ppa.launchpad.net/marutter/rdev/ubuntu bionic Release 404 Not Found [IP: 91.189.95.83 80] Ign:15 http://dl.google.com/linux/chrome/deb stable InRelease Hit:16 http://dl.google.com/linux/chrome/deb stable Release Reading package lists... Done E: The repository 'http://cran.rstudio.com/bin/linux/ubuntu bionic/ Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://ppa.launchpad.net/marutter/rdev/ubuntu bionic Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. root@limpet:/etc/apt# hankin.ro...@gmail.com hankin.ro...@gmail.com On Fri, Mar 1, 2019 at 9:19 PM Tomas Kalibera wrote: > > On 3/1/19 9:03 AM, robin hankin wrote: > > OK thanks Tomas, but I get > > > > > > OK~ sudo apt-get build-dep r-base > > Reading package lists... Done > > E: Unable to find a source package for r-base > > OK~ > > It seems you need to enable source code repositories on your system > (and then run apt-get update). > You can enable them in /etc/apt/sources.list, uncomment all lines > starting with deb-src. > > Best > Tomas > > > > > > > hankin.ro...@gmail.com > > > > > > On Fri, Mar 1, 2019 at 8:47 PM Tomas Kalibera > > wrote: > >> On 3/1/19 7:10 AM, robin hankin wrote: > >>> thanks for this guys. > >>> > >>> I only compiled pcre myself as a last resort, because of the > >>> ./configure failure. But AFAICS apt-get reports correct > >>> installation: > >>> > >>> OK~/Downloads/R-devel sudo apt-get install r-base-dev > >>> Reading package lists... Done > >>> Building dependency tree > >>> Reading state information... Done > >>> r-base-dev is already the newest version (3.5.2-1cosmic). > >>> 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. > >>> OK~/Downloads/R-devel > >> I would just run this > >> > >> apt-get build-dep r-base > >> > >> that will install all packages needed to _build_ r-base, so including PCRE. > >> > >> Best > >> Tomas > >> > >>> config.log gives me: > >>> > >>> configure:42208: $? = 0 > >>> configure:42208: result: yes > >>> configure:42208: checking for pcre.h > >>> configure:42208: result: yes > >>> configure:42208: checking pcre/pcre.h usability > >>> configure:42208: gcc -c -g -O2 -I/usr/local/include conftest.c >&5 > >>> conftest.c:289:10: fatal error: pcre/pcre.h: No such file or directory > >>>#include > >>> ^ > >>> compilation terminated. > >>> configure:42208: $? = 1 > >>> configure: failed program was: > >>> | /* confdefs.h */ > >>> | #define PACKAGE_NAME "R" > >>> | #define PACKAGE_TARNAME "R" > >>> | #define PACKAGE_VERSION "3 > >>> > >>> and > >>> > >>> HAVE_UNISTD_H > >>> | # include > >>> | #endif > >>> | #include > >>> configure:42208: result: no > >>> configure:42208: checking pcre/pcre.h presence > >>> configure:42208: gcc -E -I/usr/local/include conftest.c > >>> conftest.c:256:10: fatal error: pcre/pcre.h: No such file or directory > >>>#include > >>> ^ > >>> compilation terminated. > >>> configure:42208: $? = 1 > >>> configure: failed program was: > >>> | /* confdefs.h */ > >>> | #define PACKAGE_NAME "R" > >>> | #define PACKAGE_TARNAME "R" > >>> | #define PACKAGE_VERSION "3.6.0" > >>> | #define PACKAGE_STRING "R 3.6.0" > >>> | #define PACKAGE_BUGREPOR > >>> > >>> > >>> > >>> hankin.ro...@gmail.com > >>> > >>> > >>> > >>> > >>> On Mon, Feb 25, 2019 at 9:39 PM Tomas Kalibera > >>> wrote: > On 2/25/19 6:25 AM, robin hankin wrote: > > Hi there, ubuntu 18.04.2, trying to compile R-devel 3.6.0, svn 76155.
Re: [Rd] pcre problems
On 3/1/19 9:43 AM, robin hankin wrote: Still something wrong. I've uncommented the deb-src lines in sources.list as you suggested (and I thought it couldn't hurt to try --allow-unauthenticated as well) and: So you can try commenting again the sources that are failing, R should be in universe (and --allow-unauthenticated should not be necessary for that). If you still have problems please take it offline, these are already Ubuntu/Debain topics, not R (you can also try ubuntu-users). Some documentation is here: https://help.ubuntu.com/community/Repositories/CommandLine Best Tomas root@limpet:/etc/apt# apt-get update --allow-unauthenticated Hit:1 http://nz.archive.ubuntu.com/ubuntu bionic InRelease Hit:2 http://repo.steampowered.com/steam precise InRelease Hit:3 http://nz.archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:4 http://nz.archive.ubuntu.com/ubuntu bionic-backports InRelease Ign:5 http://cran.rstudio.com/bin/linux/ubuntu bionic/ InRelease Err:6 http://cran.rstudio.com/bin/linux/ubuntu bionic/ Release 404 Not Found [IP: 13.35.146.80 80] Hit:7 https://cloud.r-project.org/bin/linux/ubuntu cosmic-cran35/ InRelease Hit:8 http://ppa.launchpad.net/edd/misc/ubuntu bionic InRelease Hit:9 http://security.ubuntu.com/ubuntu bionic-security InRelease Hit:10 http://ppa.launchpad.net/marutter/c2d4u/ubuntu bionic InRelease Ign:11 http://ppa.launchpad.net/marutter/rdev/ubuntu bionic InRelease Hit:12 http://ppa.launchpad.net/marutter/rrutter3.5/ubuntu bionic InRelease Hit:13 http://ppa.launchpad.net/teejee2008/ppa/ubuntu bionic InRelease Err:14 http://ppa.launchpad.net/marutter/rdev/ubuntu bionic Release 404 Not Found [IP: 91.189.95.83 80] Ign:15 http://dl.google.com/linux/chrome/deb stable InRelease Hit:16 http://dl.google.com/linux/chrome/deb stable Release Reading package lists... Done E: The repository 'http://cran.rstudio.com/bin/linux/ubuntu bionic/ Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://ppa.launchpad.net/marutter/rdev/ubuntu bionic Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. root@limpet:/etc/apt# hankin.ro...@gmail.com hankin.ro...@gmail.com On Fri, Mar 1, 2019 at 9:19 PM Tomas Kalibera wrote: On 3/1/19 9:03 AM, robin hankin wrote: OK thanks Tomas, but I get OK~ sudo apt-get build-dep r-base Reading package lists... Done E: Unable to find a source package for r-base OK~ It seems you need to enable source code repositories on your system (and then run apt-get update). You can enable them in /etc/apt/sources.list, uncomment all lines starting with deb-src. Best Tomas hankin.ro...@gmail.com On Fri, Mar 1, 2019 at 8:47 PM Tomas Kalibera wrote: On 3/1/19 7:10 AM, robin hankin wrote: thanks for this guys. I only compiled pcre myself as a last resort, because of the ./configure failure. But AFAICS apt-get reports correct installation: OK~/Downloads/R-devel sudo apt-get install r-base-dev Reading package lists... Done Building dependency tree Reading state information... Done r-base-dev is already the newest version (3.5.2-1cosmic). 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. OK~/Downloads/R-devel I would just run this apt-get build-dep r-base that will install all packages needed to _build_ r-base, so including PCRE. Best Tomas config.log gives me: configure:42208: $? = 0 configure:42208: result: yes configure:42208: checking for pcre.h configure:42208: result: yes configure:42208: checking pcre/pcre.h usability configure:42208: gcc -c -g -O2 -I/usr/local/include conftest.c >&5 conftest.c:289:10: fatal error: pcre/pcre.h: No such file or directory #include ^ compilation terminated. configure:42208: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "R" | #define PACKAGE_TARNAME "R" | #define PACKAGE_VERSION "3 and HAVE_UNISTD_H | # include | #endif | #include configure:42208: result: no configure:42208: checking pcre/pcre.h presence configure:42208: gcc -E -I/usr/local/include conftest.c conftest.c:256:10: fatal error: pcre/pcre.h: No such file or directory #include ^ compilation terminated. configure:42208: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "R" | #define PACKAGE_TARNAME "R" | #define PACKAGE_VERSION "3.6.0" | #define PACKAGE_STRING "R 3.6.0" | #define PACKAGE_BUGREPOR hankin.ro...@gmail.com On Mon, Feb 25, 2019 at 9:39 PM Tomas Kalibera wrote: On 2/25/19 6:25 AM, robin hankin wrote: Hi there, ubuntu 18.04.2, trying to compile R-devel 3.6.0, svn 76155. I am having difficulty compiling R. I think I have
[Rd] Package inclusion in R core implementation
Hi, It sometimes happens that some packages get included to R like for example the parallel package. I was wondering if there is a process to decide whether or not to include a package in the core implementation of R? For example, why not include the Rcpp package, which became for a lot of user the main tool to extend R? What is our view on the (not so well known) dotCall64 package which is an interesting alternative for extending R? Thank you Best regards, Morgan [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] stopifnot
> Suharto Anggono Suharto Anggono > on Wed, 27 Feb 2019 22:46:04 + writes: > My points: > - The 'withCallingHandlers' construct that is used in current 'stopifnot' code has no effect. Without it, the warning message is the same. The overridden warning is not raised. The original warning stays. > - Overriding call in error and warning to 'cl.i' doesn't always give better outcome. The original call may be "narrower" than 'cl.i'. I see. Thank you for stating the summary. > I have found these examples. > identity(is.na(log())) > identity(is.na(log("a"))) > Error message from the first contains full call. Error message from the second doesn't. > So, how about being "natural", not using 'withCallingHandlers' and 'tryCatch' in 'stopifnot'? If we can achieve good (or better) messages as before, I entirely agree. Originally, one "design principle" for stopifnot() had been to create a relatively simple "self explaining" (for code readers) function with that functionality. The all.equal() special treatment has really added an extra level of usefulness, and the somewhat recent ensuring of careful sequential eval() is also important. Somewhere there I found I'd need the sophisticated error catching [tryCatch() ..], but if turns that it is unneeded, I think we'd all be more than happy. > Another thing: currently, > stopifnot(exprs=TRUE) > fails. good catch - indeed! I've started to carefully test and try the interesting nice patch you've provided below. Thank you very much for your careful and constructive suggestions! I'll get back after some testing {and fulfilling quite a few other jobs/duties I've got these days ...} Martin > A patch: > --- stop.R2019-02-27 16:15:45.324167577 + > +++ stop_new.R2019-02-27 16:22:15.936203541 + > @@ -1,7 +1,7 @@ > # File src/library/base/R/stop.R > # Part of the R package, https://www.R-project.org > # > -# Copyright (C) 1995-2018 The R Core Team > +# Copyright (C) 1995-2019 The R Core Team > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > @@ -33,25 +33,27 @@ > stopifnot <- function(..., exprs, local = TRUE) > { > +n <- ...length() > missE <- missing(exprs) > -cl <- > if(missE) { ## use '...' instead of exprs > - match.call(expand.dots=FALSE)$... > } else { > - if(...length()) > + if(n) > stop("Must use 'exprs' or unnamed expressions, but not both") > envir <- if (isTRUE(local)) parent.frame() > else if(isFALSE(local)) .GlobalEnv > else if (is.environment(local)) local > else stop("'local' must be TRUE, FALSE or an environment") > exprs <- substitute(exprs) # protect from evaluation > - E1 <- exprs[[1]] > + E1 <- if(is.call(exprs)) exprs[[1]] > + cl <- > if(identical(quote(`{`), E1)) # { ... } > - do.call(expression, as.list(exprs[-1])) > + exprs[-1] > else if(identical(quote(expression), E1)) > eval(exprs, envir=envir) > else > as.expression(exprs) # or fail .. > + if(!is.null(names(cl))) names(cl) <- NULL > + return(eval(as.call(c(sys.call()[[1]], as.list(cl))), envir=envir)) > } > Dparse <- function(call, cutoff = 60L) { > ch <- deparse(call, width.cutoff = cutoff) > @@ -62,14 +64,10 @@ > abbrev <- function(ae, n = 3L) > paste(c(head(ae, n), if(length(ae) > n) ""), collapse="\n ") > ## > -for (i in seq_along(cl)) { > - cl.i <- cl[[i]] > - ## r <- eval(cl.i, ..) # with correct warn/err messages: > - r <- withCallingHandlers( > - tryCatch(if(missE) ...elt(i) else eval(cl.i, envir=envir), > - error = function(e) { e$call <- cl.i; stop(e) }), > - warning = function(w) { w$call <- cl.i; w }) > +for (i in seq_len(n)) { > + r <- ...elt(i) > if (!(is.logical(r) && !anyNA(r) && all(r))) { > + cl.i <- match.call(expand.dots=FALSE)$...[[i]] > msg <- ## special case for decently written 'all.equal(*)': > if(is.call(cl.i) && identical(cl.i[[1]], quote(all.equal)) && > (is.null(ni <- names(cl.i)) || length(cl.i) == 3L || > @@ -84,7 +82,11 @@ > "%s are not all TRUE"), > Dparse(cl.i)) > - stop(simpleError(msg, call = sys.call(-1))) > + p <- sys.parent() > + if(p && identical(sys.function(p), stopifnot) && > +!eval(expression(missE), p)) # originally stopifnot(exprs=*) > + p <- sys.parent(2) > + stop(simpleError(msg, call = if(p) sys.call(p))) > } > } > invisible() > > On Wed, 27/2/19, Martin Maechler wrote: > Subject: Re: [Rd] stopifnot > To: "Suharto Anggono Suharto Anggono" > Cc: r-devel
[Rd] Surprising results from INTEGER_GET_REGION with ALTREP object
Dear Listmembers, wanting to learn more about ALTREP I wrote the following function to extract a subsequence from an integer vector: #include SEXP integer_get_region(SEXP _x, SEXP _i, SEXP _n) { int i = INTEGER(_i)[0]; int n = INTEGER(_n)[0]; SEXP result = PROTECT(Rf_allocVector(INTSXP, n)); INTEGER_GET_REGION(_x, i, n, INTEGER(result)); UNPROTECT(1); return result; } For "shorter" vectors, the result is as expected: > dyn.load("altrep_int_region.so") > .Call("integer_get_region", 1:1e9, 0L, 10L) [1] 1 2 3 4 5 6 7 8 9 10 But not for "longer" vectors: > .Call("integer_get_region", 1:1e10, 0L, 10L) [1] 0 1072693248 0 1073741824 0 1074266112 [7] 0 1074790400 0 1075052544 Am I doing something wrong or is this a bug? I am using > R.version.string [1] "R version 3.5.2 (2018-12-20)" Thanks Ralf -- Ralf Stubner Senior Software Engineer / Trainer daqana GmbH Dortustraße 48 14467 Potsdam T: +49 331 23 61 93 11 F: +49 331 23 61 93 90 M: +49 162 20 91 196 Mail: ralf.stub...@daqana.com Sitz: Potsdam Register: AG Potsdam HRB 27966 Ust.-IdNr.: DE300072622 Geschäftsführer: Dr.-Ing. Stefan Knirsch, Prof. Dr. Dr. Karl-Kuno Kunze signature.asc Description: OpenPGP digital signature __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Surprising results from INTEGER_GET_REGION with ALTREP object
On 3/1/19 1:52 PM, Ralf Stubner wrote: > Dear Listmembers, > > wanting to learn more about ALTREP I wrote the following function to > extract a subsequence from an integer vector: > > #include > > SEXP integer_get_region(SEXP _x, SEXP _i, SEXP _n) { >int i = INTEGER(_i)[0]; >int n = INTEGER(_n)[0]; >SEXP result = PROTECT(Rf_allocVector(INTSXP, n)); >INTEGER_GET_REGION(_x, i, n, INTEGER(result)); >UNPROTECT(1); >return result; > } > > For "shorter" vectors, the result is as expected: > >> dyn.load("altrep_int_region.so") >> .Call("integer_get_region", 1:1e9, 0L, 10L) > [1] 1 2 3 4 5 6 7 8 9 10 > > But not for "longer" vectors: > >> .Call("integer_get_region", 1:1e10, 0L, 10L) > [1] 0 1072693248 0 1073741824 0 1074266112 > [7] 0 1074790400 0 1075052544 > > > Am I doing something wrong or is this a bug? I am using The problem is that 1:1e10 is a vector of doubles, not integers. See ?colon " For numeric arguments, a numeric vector. This will be of type ‘integer’ if ‘from’ is integer-valued and the result is representable in the R integer type, otherwise of type ‘"double"’ (aka ‘mode’ ‘"numeric"’). " Best Tomas > >> R.version.string > [1] "R version 3.5.2 (2018-12-20)" > > Thanks > Ralf > > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] issue with sample in R 3.6.0.
Hello, I think there is an issue in the sampling rejection algorithm in R 3.6.0. The do_sample2 function in src/main/unique.c still has 4.5e15 as an upper limit, implying that numbers greater than INT_MAX are still to be supported by sample in base R. Please review the examples below: set.seed(123) max(sample(2^31, 1e5)) [1] 2147430096 set.seed(123) max(sample(2^31 + 1, 1e5)) [1] 1 set.seed(123) max(sample(2^32, 1e5)) [1] 1 set.seed(123) max(sample(2^35, 1e5)) [1] 8 set.seed(123) max(sample(2^38, 1e5)) [1] 64 set.seed(123) max(sample(2^38, 1e5)) [1] 64 set.seed(123) max(sample(2^42, 1e5)) [1] 1024 >From the above, we see that if N is greater than 2^31, then N is bounded by (2^(ceiling(log2(N)) – 32)). Looking at the source code to src/main/RNG.c, we have the following: static double rbits(int bits) { int_least64_t v = 0; for (int n = 0; n <= bits; n += 16) { int v1 = (int) floor(unif_rand() * 65536); v = 65536 * v + v1; } // mask out the bits in the result that are not needed return (double) (v & ((1L << bits) - 1)); } The last line has (v & ((1L << bits) - 1)) where v is declared as int_least64_t. If you notice, we are operating on v with the long integer literal 1L. I’m pretty sure this is the source of the issue. By changing 1L to at least a 64 bit integer, it appears that we correct the problem: double rbits(int bits) { int_least64_t v = 0; for (int n = 0; n <= bits; n += 16) { int v1 = (int) floor(unif_rand() * 65536); v = 65536 * v + v1; } int_least64_t one64 = 1L; // mask out the bits in the result that are not needed return (double) (v & ((one64 << bits) - 1)); } Regards, Joseph Wood __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Problem with compiling OpenBLAS to work with R
Yay! I re-installed everything and got through "Make distribution"! I have one more question, please: I am running the make check-all. I have an error at reg-1d. It stops the process. However, the mean difference (as per the file) is 2.0e-12. I'm ok with that. How do I bypass this, please? Thanks, Erin Erin Hodgess, PhD mailto: erinm.hodg...@gmail.com On Wed, Feb 27, 2019 at 10:22 PM Avraham Adler wrote: > I believe that repo just follows the directions on my blog. Without seeing > Dr. Hodges’s code, my initial concern is the many references to Cygwin. My > method specifically does not use Cygwin but MSYS2 and Mingw64/Rtools35. > That will likely change to solely Rtools40 once R3.6 is released due to the > Msys system being built in to it. > > There may be some library conflicts between Cygwin and msys2/mingw64. If > possible, my suggestion would be uninstall everything and then just install > msys2 (and add in make after you to the first msys update) and rtools35. > Then there should be no conflicting libraries. > > Thanks, > > Avi > > On Thu, Feb 28, 2019 at 12:11 AM Kenny Bell wrote: > >> This person has had apparent success - you could follow what they did or >> just download their product (with appropriate caution downloading a random >> .exe). >> >> https://github.com/thequackdaddy/R-OpenBLAS >> >> On Thu, Feb 28, 2019 at 6:28 AM Erin Hodgess >> wrote: >> >> > Hello! >> > >> > I'm not sure if this is the right place to post this, so apologies >> > in advance if I'm not in the right list. >> > >> > I downloaded the OpenBLAS and am following Avraham Adler's great >> > instructions. However, when I run make, things go well to a certain >> point, >> > and then go bad: >> > >> > make >> > [snip] >> > >> > touch cygopenblas_haswellp-r0.3.5.a >> > make -j 1 -C test all >> > make[1]: Entering directory >> > '/home/erinm/OPB_HOME/xianyi-OpenBLAS-eebc189/test' >> > gfortran -O2 -Wall -frecursive -m64 -mavx2 -o sblat1 sblat1.o >> > ../cygopenblas_haswellp-r0.3.5.a -L/usr/lib/gcc/x86_64-pc-msys/7.3.0 >> > >> -L/usr/lib/gcc/x86_64-pc-msys/7.3.0/../../../../x86_64-pc-msys/lib/../lib >> > -L/usr/lib/../lib >> > -L/usr/lib/gcc/x86_64-pc-msys/7.3.0/../../../../x86_64-pc-msys/lib >> > -L/usr/lib/w32api -lmsys-2.0 >> > D:/msys64/usr/lib/../lib/libpthread.a(t-d001088.o):fake:(.text+0x2): >> > undefined reference to `__imp_pthread_mutex_destroy' >> > D:/msys64/usr/lib/../lib/libpthread.a(t-d001090.o):fake:(.text+0x2): >> > undefined reference to `__imp_pthread_mutex_init' >> > D:/msys64/usr/lib/../lib/libpthread.a(t-d001091.o):fake:(.text+0x2): >> > undefined reference to `__imp_pthread_mutex_lock' >> > D:/msys64/usr/lib/../lib/libpthread.a(t-d001094.o):fake:(.text+0x2): >> > undefined reference to `__imp_pthread_mutex_trylock' >> > D:/msys64/usr/lib/../lib/libpthread.a(t-d001095.o):fake:(.text+0x2): >> > undefined reference to `__imp_pthread_mutex_unlock' >> > collect2.exe: error: ld returned 1 exit status >> > make[1]: *** [Makefile:134: sblat1] Error 1 >> > make[1]: Leaving directory >> > '/home/erinm/OPB_HOME/xianyi-OpenBLAS-eebc189/test' >> > make: *** [Makefile:124: tests] Error 2 >> > >> > >> > I think it has something to do with the threads/pthreads but am not sure >> > how to fix it. Any suggestions much appreciated. >> > >> > Thanks, >> > Sincerely, >> > Erin >> > >> > Erin Hodgess, PhD >> > mailto: erinm.hodg...@gmail.com >> > >> > [[alternative HTML version deleted]] >> > >> > __ >> > R-devel@r-project.org mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-devel >> > >> >> [[alternative HTML version deleted]] >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> > -- > Sent from Gmail Mobile > [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] issue with sample in R 3.6.0.
Thanks; fixed now in R-devel. Not an issue on Linux/Mac OS but is on 64-bit Windows, where sizeof(long) is 4. Best, luke On Fri, 1 Mar 2019, Joseph Wood wrote: > Hello, > > I think there is an issue in the sampling rejection algorithm in R 3.6.0. > > The do_sample2 function in src/main/unique.c still has 4.5e15 as an > upper limit, implying that numbers greater than INT_MAX are still to > be supported by sample in base R. > > Please review the examples below: > > set.seed(123) > max(sample(2^31, 1e5)) > [1] 2147430096 > > set.seed(123) > max(sample(2^31 + 1, 1e5)) > [1] 1 > > set.seed(123) > max(sample(2^32, 1e5)) > [1] 1 > > set.seed(123) > max(sample(2^35, 1e5)) > [1] 8 > > set.seed(123) > max(sample(2^38, 1e5)) > [1] 64 > > set.seed(123) > max(sample(2^38, 1e5)) > [1] 64 > > set.seed(123) > max(sample(2^42, 1e5)) > [1] 1024 > > From the above, we see that if N is greater than 2^31, then N is > bounded by (2^(ceiling(log2(N)) – 32)). > > Looking at the source code to src/main/RNG.c, we have the following: > > static double rbits(int bits) > { >int_least64_t v = 0; >for (int n = 0; n <= bits; n += 16) { >int v1 = (int) floor(unif_rand() * 65536); >v = 65536 * v + v1; >} >// mask out the bits in the result that are not needed >return (double) (v & ((1L << bits) - 1)); > } > > The last line has (v & ((1L << bits) - 1)) where v is declared as > int_least64_t. If you notice, we are operating on v with the long > integer literal 1L. I’m pretty sure this is the source of the issue. > By changing 1L to at least a 64 bit integer, it appears that we > correct the problem: > > double rbits(int bits) > { >int_least64_t v = 0; >for (int n = 0; n <= bits; n += 16) { >int v1 = (int) floor(unif_rand() * 65536); >v = 65536 * v + v1; >} > >int_least64_t one64 = 1L; >// mask out the bits in the result that are not needed >return (double) (v & ((one64 << bits) - 1)); > } > > Regards, > Joseph Wood > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Luke Tierney Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke-tier...@uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel