Re: [Rcpp-devel] Rcpp Module: Expecting an external pointer: [type=environment]

2025-03-11 Thread Dirk Eddelbuettel
Hi Stefan, On 11 March 2025 at 17:32, Stefan Boehringer wrote: | with a standard Rcpp module I get the error "Expecting an external pointer: | [type=environment]." from x$.self$finalize() |  which is an internal wrapper around modules from Rcpp. Would you have a complete example, say in a repo?

Re: [Rcpp-devel] memory not mapped with Rcpp on Ubuntu

2025-02-14 Thread Dirk Eddelbuettel
On 14 February 2025 at 15:09, John Clarke wrote: | Thank you! This didn't directly solve my problem, but it got me looking in | the right direction. I ended up connecting to a docker container through VS | Code on my host machine (Windows). I didn't wire up the debugger UI (which is | really conv

Re: [Rcpp-devel] Using Rcpp::Function in parallel with TBB mutex lock & a reference.

2025-02-08 Thread Dirk Eddelbuettel
On 7 February 2025 at 14:01, Kumar MS wrote: | Thank you Dirk. Your observation is correct. I am left with two questions. As | always, I appreciate your answers. | | 1. Except for this single step of calling an R function (model matrix-like | objects that are being created by an external library

Re: [Rcpp-devel] Using Rcpp::Function in parallel with TBB mutex lock & a reference.

2025-02-07 Thread Dirk Eddelbuettel
Hi Kumar, >From a quick look you borrow the 'Worker' object from RcppParallel. But where (as far as I recall) all posted examples of RcppParallel do _not_ put any R objects inside a Worker instance, you put some there. That violates the recommendation in Writing R Extensions. So I think the outc

Re: [Rcpp-devel] Operating on sparse matrices in a list.

2024-12-11 Thread Dirk Eddelbuettel
On 11 December 2024 at 10:40, Kumar MS wrote: | # -- The function in question -- | cppFunction( | "arma::mat accessEntries(Rcpp::List x){ | for(int i=0; i(x[i]); //similar to : https://gallery.rcpp.org/articles/dynamic-dispatch-for-sparse-matrices/ | } | }", You say you return an

Re: [Rcpp-devel] for loop and random draws

2024-10-25 Thread Dirk Eddelbuettel
On 25 October 2024 at 15:42, Denis Haine wrote: | I'm totally puzzled on why I've got these results. How can I get the same | output with Rcpp + regression as with the R loop +/- regression? I think you continue to gloss over the fact there "is a contract": we call C++ code from R, Rcpp helps, R

Re: [Rcpp-devel] Inverting a triangular matrix appears slow using Armadillo and openblas

2024-10-18 Thread Dirk Eddelbuettel
On 18 October 2024 at 09:39, Robin Liu wrote: | Dear all, | | Computing the Cholesky factor of a matrix is on the order of n^3 while | inverting a triangular system is n^2. However, it appears that these two | operations take roughly the same time using armadillo. | | Unit: milliseconds |      

Re: [Rcpp-devel] rcmdcheck() failing on "Undocumented S4 class" with RCPP_Module

2024-10-04 Thread Dirk Eddelbuettel
On 4 October 2024 at 17:21, John Clarke wrote: | Indeed roxygen2 docs will help with a workaround, I think. I've temporarily | added a Rcpp_MyClass-class.RD based on promptClass("Rcpp_MyClass") and that | seems to satisfy the R CMD check. Nice, and I think that is about as it good as you will ge

Re: [Rcpp-devel] rcmdcheck() failing on "Undocumented S4 class" with RCPP_Module

2024-10-04 Thread Dirk Eddelbuettel
John, As an aside, Rcpp has been spelled as 'Rcpp' (uppercase R, lowercase cpp, just as one often does for file extenions) for the roughly 20 years of its existence. Cheers, Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ___ Rcpp-de

Re: [Rcpp-devel] rcmdcheck() failing on "Undocumented S4 class" with RCPP_Module

2024-10-04 Thread Dirk Eddelbuettel
Hi John, That looks like a limitation in roxygen2 which appears to fully documented (as you desire) an S4 class. As you may know, you prod roxygen2 with 'NULL' blocks to add extra documentation -- that is likely what you need here. The roxygen2 docs will have more on this. Cheers, Dirk -- di

Re: [Rcpp-devel] for loop and random draws

2024-10-01 Thread Dirk Eddelbuettel
On 1 October 2024 at 11:57, Denis Haine wrote: | But adding the regression to define_e1() (as define_e2() in previous email) | does not give the same. The first iteration in the loop is identical in both, | but not the subsequent ones. That's why I was thinking it could be linked to | the seed, b

Re: [Rcpp-devel] for loop and random draws

2024-10-01 Thread Dirk Eddelbuettel
On 1 October 2024 at 09:59, Dirk Eddelbuettel wrote: | This is not reproducible. You show two functions, they both take arguments, | you do not supply those. We cannot run this, so we cannot really help you. I missed the lines at the bottom past your signature, so I was wrong. My bad. I would

Re: [Rcpp-devel] for loop and random draws

2024-10-01 Thread Dirk Eddelbuettel
Denis, This is not reproducible. You show two functions, they both take arguments, you do not supply those. We cannot run this, so we cannot really help you. Please try rephrasing this as a _self-contained_ example. Now, it is always possibly that while the RNG seeds get reset properly on 'nor

Re: [Rcpp-devel] Using formula

2024-09-04 Thread Dirk Eddelbuettel
On 4 September 2024 at 15:37, Denis Haine wrote: | Hi, | | Sorry for a beginner's question. I'm trying to call an R function (glm()) | inside my cpp code. The code compiles with no problem, but when I'm running it, | it cannot find the second element of the formula, i.e. the x in y~x. The error

Re: [Rcpp-devel] Error installing 1.0.13

2024-07-24 Thread Dirk Eddelbuettel
On 24 July 2024 at 20:02, Avraham Adler wrote: | Let me rebuild R from scratch and I'll try again. I'll report back (in | a day or so) if that helped. Feel free to also check with r-release as a baseline. That said, on Linux I keep reasonably current (rebuild a week or two) r-devel around. Dirk

Re: [Rcpp-devel] Error installing 1.0.13

2024-07-24 Thread Dirk Eddelbuettel
On 24 July 2024 at 19:21, Avraham Adler wrote: | I get the following error when trying to install. | | Thanks, | | Avi | | * installing *source* package 'Rcpp' ... | ** package 'Rcpp' successfully unpacked and MD5 sums checked | ** using staged installation | ** libs | using C++ compiler: 'G__

Re: [Rcpp-devel] CRAN submission with NOTE about STRING_PTR

2024-06-30 Thread Dirk Eddelbuettel
Juan, Rcpp has over 2800 reverse dependencies. We cannot check errors on all of them, but you could spot check a few more than the one mentioned. The tools::package_depencencies() function can give you all (straight or reverse) dependencies of a package, or you can just glance at the CRAN page.

Re: [Rcpp-devel] CRAN submission with NOTE about STRING_PTR

2024-06-23 Thread Dirk Eddelbuettel
Hi Patrik, On 23 June 2024 at 21:37, Patrik Schilter wrote: | Dear all, | | First of all: Thank you very much for creating and also maintaining Rcpp so | diligently! Thanks for the kind words. | I am a co-maintainer of the package REndo which depends on Rcpp & RcppEigen. | Last week, we submit

Re: [Rcpp-devel] segfault on exit CRAN+Intel only

2024-03-03 Thread Dirk Eddelbuettel
Hi Murray, On 4 March 2024 at 07:03, Murray Efford wrote: | Dirk | Thanks for a very helpful reply. I'll simplify my return values. | | I mentioned Intel with rhub2 in my earlier post here, but I'm sorry | that was somewhat buried. Debugging is somewhere between painful and | impossible when my

Re: [Rcpp-devel] segfault on exit CRAN+Intel only

2024-03-03 Thread Dirk Eddelbuettel
And "beauty" (ahem) of discussion scattered over two mailing lists: I now see you have a testbed via rhub2 (good) even though it does not reproduce (hm...). So you could still try the suggested simplication. Cheers, Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _

Re: [Rcpp-devel] segfault on exit CRAN+Intel only

2024-03-03 Thread Dirk Eddelbuettel
On 3 March 2024 at 20:47, Murray Efford wrote: | A couple of days ago I posted on R-package-devel about a mysterious | segfault from R CMD checks of my package secrdesign (see | https://CRAN.R-project.org/package=secrdesign, and | https://github.com/MurrayEfford/secrdesign) The issue rises only o

Re: [Rcpp-devel] RcppArmadillo with -fopenmp: Not using all available cores

2024-03-02 Thread Dirk Eddelbuettel
the following: | | > extSoftVersion()["BLAS"] Ah yes -- I keep forgetting about that one. Good reminder! | Thanks for your help! Always a pleasure. Glad you are all set. Dirk | On Sat, Feb 24, 2024 at 9:17 AM Dirk Eddelbuettel wrote: | | | On 24 February 2024 at 11:44, Ro

Re: [Rcpp-devel] Segfault in wrapping code in Rcpp

2024-03-02 Thread Dirk Eddelbuettel
Hi Nikhil, Don't post images. I read in a text-based reader. The mailing list software also scrubs html (I think). I would simplify. Start with the simplest Rcpp Modules setup. Then add. Check checking. Eventually on your way towards what you are doing now you may spot the error. Hope this hel

Re: [Rcpp-devel] RcppArmadillo with -fopenmp: Not using all available cores

2024-02-24 Thread Dirk Eddelbuettel
c getEigenValues(arma::mat M) { |   return arma::eig_sym(M); | })" | | size <- 1 | m <- matrix(rnorm(size^2), size, size) | m <- m * t(m) | | # This line compiles the above code with the -fopenmp flag. | sourceCpp(code = src, verbose = TRUE, rebuild = TRUE) | result <- getEigenValues(m) |

Re: [Rcpp-devel] RcppArmadillo with -fopenmp: Not using all available cores

2024-02-23 Thread Dirk Eddelbuettel
On 23 February 2024 at 09:35, Robin Liu wrote: | Hi all, | | Here is an R script that uses Armadillo to decompose a large matrix and print | the first 10 eigenvalues. | | library(RcppArmadillo) | library(Rcpp) | | src <- | r"(#include | | // [[Rcpp::depends(RcppArmadillo)]] | | // [[Rcpp::e

Re: [Rcpp-devel] Wrapping a c++ class with singleton using RCPP Module

2024-02-21 Thread Dirk Eddelbuettel
On 21 February 2024 at 09:21, Iñaki Ucar wrote: | Could you please provide more details about what you tried so far and what are | the issues you found? A link to a public repo with a test case would be even | better. Seconded! I think I also did something like that 'way early' and 'way simply'

Re: [Rcpp-devel] Numerical precision in rotations with Eigen

2024-01-10 Thread Dirk Eddelbuettel
On 10 January 2024 at 09:52, Rafael Ayala Hernandez wrote: | Hi, | | I have implemented a function to rotate a 3D vector a given angle around a given axis (basically wrapping the functionality provided by Eigen::AngleAxis) as an Rcpp function. | Below is an extract from the source file: | | #

Re: [Rcpp-devel] Rf_error() format string

2023-11-28 Thread Dirk Eddelbuettel
Sorry for being slow to respond (very busy morning at work and play, got five such emails myself) but as Inaki and Georgi helpfully pointed out already the issue is _known_ and has a _fix_ at either the default branch of the Rcpp repo, or, if you prefer, via the Rcpp drat repo as detailed in this

Re: [Rcpp-devel] Life-cycle of Rcpp::XPtr

2023-09-23 Thread Dirk Eddelbuettel
PS There is another neat use case where a shared_ptr is allocated. Now we cannot wrap a shared_ptr in an XPtr but ... we can stick the shared_ptr into a struct, and allocate that with new and then make_xptr. You are then back to well-understood C++ semantics. Dirk -- dirk.eddelbuettel.com |

Re: [Rcpp-devel] Life-cycle of Rcpp::XPtr

2023-09-23 Thread Dirk Eddelbuettel
Hi Ralf, On 23 September 2023 at 08:28, Ralf Stubner wrote: | I have a question concerning the file-cycle of Rcpp::XPtr: Consider a | XPtr with the default delete finalizer wrapping some pointer. If I use | the copy constructor to create another XPtr, this is pointing at the | same underlying ob

Re: [Rcpp-devel] Rcpp::sourceCpp Problem with R 4.3 update

2023-05-30 Thread Dirk Eddelbuettel
On 30 May 2023 at 14:27, Dominick Samperi wrote: | Looks like the recent update to R 4.3 broke Rcpp::sourceCpp. | | Here is a simple example... | | library(Rcpp) | Rcpp::sourceCpp(code=' |   #include |   using namespace Rcpp; |   // [[Rcpp::export()]] |   SEXP cpptest(NumericVector v) { |    

Re: [Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-28 Thread Dirk Eddelbuettel
objection seems inappropriate | to | >> me. | >> | >> On March 24, 2023 10:43:34 AM PDT, Dirk Eddelbuettel | >> wrote: | >> > | >> >On 24 March 2023 at 13:08, Matthew Supernaw - NOAA Federal wrote: | >> >| I'm s

Re: [Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-24 Thread Dirk Eddelbuettel
On 24 March 2023 at 13:08, Matthew Supernaw - NOAA Federal wrote: | I'm sure it's possible to do from the R side, however, the requirement is to | hide this from the end user and set the reference objects name to the declared | name from the R environment. If I view the environment in RStudio, the

Re: [Rcpp-devel] Locating an Instance of a Reference Class in the Environment

2023-03-23 Thread Dirk Eddelbuettel
On 22 March 2023 at 13:31, Matthew Supernaw - NOAA Federal wrote: | I'm trying to get an instance of a reference class (vonBertalanffyInterface) | from the R environment with the following code: | | void SetName(vonBertalanffyInterface& v) { | |     Rcpp::Environment env = Rcpp::Environment::glo

Re: [Rcpp-devel] Problem with RCPP Paralell

2023-02-23 Thread Dirk Eddelbuettel
Hi Roberto, Very briefly: 1) We spell it Rcpp. Capital R, lowercase cpp. 2) The package you inquire about is called RcppParallel. 3) You didn't list the repo making it harder for us to help you. As a little bit of GitHub searching reveals, it is here https://github.com/OVVO-Financial/N

Re: [Rcpp-devel] CRAN note about std::cout in shared library

2023-02-07 Thread Dirk Eddelbuettel
Hi Kassel, On 7 February 2023 at 02:57, Kassel Hingee wrote: | I'm running into CRAN check notes about std::cout being present in the Cpp code of a library I'm using. | | Found ‘_ZSt4cout’, possibly from ‘std::cout’ (C++) | | It looks like Rcpp is automatically redirecting the std::cout st

Re: [Rcpp-devel] RInline::repl() issues

2023-02-03 Thread Dirk Eddelbuettel
Dominick, On 3 February 2023 at 20:02, Dominick Samperi wrote: | I'm sorry to say that the RInline::repl() issues are not resolved, and to | resolve them would likely require help from R core. | | Here's the test case: | library(sphereplot) | rgl.sphgrid(longtype="D") | | Under Linux there is n

Re: [Rcpp-devel] R_Interactive vs R_NoEcho

2023-02-01 Thread Dirk Eddelbuettel
On 2 February 2023 at 16:02, Simon Urbanek wrote: | > On Feb 2, 2023, at 11:41 AM, Dirk Eddelbuettel wrote: | > Sounds like an r-devel question to me. Nothing Rcpp related here. Simon and | > Tomas both hang out here so if you are lucky they may see it. Else I'd try

Re: [Rcpp-devel] R_Interactive vs R_NoEcho

2023-02-01 Thread Dirk Eddelbuettel
On 1 February 2023 at 17:23, Dominick Samperi wrote: | Since I am not aware of an R-internals mailing list, and since this AFAIK there is no such mailing list. There is a manual of that name: https://rstudio.github.io/r-manuals/r-ints/ (nicer quarto rendered version) Or did you mean the r-devel

Re: [Rcpp-devel] Package RMD check warning

2023-01-30 Thread Dirk Eddelbuettel
On 30 January 2023 at 18:11, Zheng, Binghan wrote: | I’m preparing a package to be released through CRAN for Dr. Jacob Montgomery at WUSTL and I’m running into a warning that I can’t seem to resolve. | | The RCMD check is being run in R 4.2.2 on MacOS. | After running devtools::check() on the la

Re: [Rcpp-devel] Rcpp_precious_remove again (Windows)

2023-01-23 Thread Dirk Eddelbuettel
Maintainer of affected package here: On 23 January 2023 at 12:20, Dominick Samperi wrote: | On the changes for R 4.2.0, it is not clear how to distinguish | R API functions from R internal functions (and this probably | doesn't matter for Rcpp), but you are correct, | on closer inspection these c

Re: [Rcpp-devel] Rcpp_precious_remove again (Windows)

2023-01-21 Thread Dirk Eddelbuettel
On 21 January 2023 at 10:53, Dominick Samperi wrote: | I've attached a version of RInside.cpp with my changes. The | _MSC_VER ifdefs are for Video Studio, which I am using for | debugging. I had some problems with gdb. We would love to take advantage of your hard and diligent work in trying to im

Re: [Rcpp-devel] Rcpp_precious_remove again (Windows)

2023-01-20 Thread Dirk Eddelbuettel
On 20 January 2023 at 19:11, Dominick Samperi wrote: | You are right Dirk, RInside overrides what is specified because the function | myAskYesNo doesn't actually ask, so this explains why there is to | termination | prompt under Windows. This does not change what happens under Linux | because this

Re: [Rcpp-devel] Rcpp_precious_remove again (Windows)

2023-01-20 Thread Dirk Eddelbuettel
On 20 January 2023 at 10:28, Tomas Kalibera wrote: | Executing then without R_LIBS set gave this error: | | " | Error: function 'Rcpp_precious_remove' not provided by package 'Rcpp' | In addition: Warning message: | In library(package, lib.loc = lib.loc, character.only = TRUE, | logical.return =

Re: [Rcpp-devel] Rcpp_precious_remove again (Windows)

2023-01-19 Thread Dirk Eddelbuettel
On 19 January 2023 at 19:41, Dominick Samperi wrote: | I narrowed the problem down to the call to R_ReplDLLdo1() in RInside, and I | built R-4.3.0 pre-release version for Windows from source to investigate | further (online instructions by Tomas Kalibera were very helpful). Yes Tomas is a master

Re: [Rcpp-devel] Rcpp_precious_remove again (Windows)

2023-01-17 Thread Dirk Eddelbuettel
Hi Dominick, First reflex: uh-oh as 'Rcpp_precious_remove' created some headaches for some people when mixing Rcpp and packages built with Rcpp but not the current one. We think all this got squared away an Rcpp release or two ago so as a first step please make sure _all_ involved packaes are cur

Re: [Rcpp-devel] Printing intermediate values in C++ code used in Rcpp

2022-12-17 Thread Dirk Eddelbuettel
Good -- but next time you ask _when you already are N messages in on another help list_ have the courtesy to cross-reference the other thread. Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ___ Rcpp-devel mailing list Rcpp-devel@lists

Re: [Rcpp-devel] Printing intermediate values in C++ code used in Rcpp

2022-12-17 Thread Dirk Eddelbuettel
On 17 December 2022 at 17:29, Christofer Bogaso wrote: | Hi, | | I am working with a package called | | https://cran.r-project.org/src/contrib/GCPM_1.2.2.tar.gz | | The source code contains C++ codes which are available in the src folder. | | In this folder, the C++ codes are available in cppl

Re: [Rcpp-devel] C++ issue only spotted by CRAN and not locally or via rhub

2022-12-05 Thread Dirk Eddelbuettel
On 5 December 2022 at 16:34, Martyn Plummer wrote: | That's the good news. The bad news is that you have a lot of memory leaks, | so this is still not going to pass R CMD check with ASAN. You're going to | need Dirk's container. Yes, and I was actually pointing at Winston's container, and it too

Re: [Rcpp-devel] C++ issue only spotted by CRAN and not locally or via rhub

2022-12-05 Thread Dirk Eddelbuettel
On 5 December 2022 at 11:32, Sokol Serguei wrote: | I don't know what the exact source of this problem is but I can suggest | to use Armadillo which has a reputation to be better suited for | matrix/vector operation than plain Rcpp. I second that. Rcpp is great for what it does (easy integratio

Re: [Rcpp-devel] Rcpp equivalent for Python?

2022-12-03 Thread Dirk Eddelbuettel
On 3 December 2022 at 15:08, Sparapani, Rodney wrote: | I have a tangential question. We have several R packages | based on Rcpp to call C++ code. Rcpp makes it so easy! | However, I am often asked by Python users: can we make | similar packages for that platform? I’m a newb with | respect to P

Re: [Rcpp-devel] Unaligned access [Was: Report of CRAN compilation problem and solution with architecture arm64]

2022-11-27 Thread Dirk Eddelbuettel
Juan, Further to Simon's comment, why is this on the rcpp-devel list? We have exactly zero choice over compiler and architecture use at CRAN. Maybe try r-devel and/or CRAN and/or R Core, but as Simon hinted that may be an uphill battle too. Best, Dirk -- dirk.eddelbuettel.com | @eddelbuettel

Re: [Rcpp-devel] Something strange with the package check and calls to C abort

2022-10-31 Thread Dirk Eddelbuettel
On 31 October 2022 at 11:01, Kevin Ushey wrote: | For posterity, what machine are you compiling the package on? If you're | using a modern Linux system, it's possible the default compilation flags | are including stack protection code during compilation that might call | abort on error. See e.g. |

Re: [Rcpp-devel] Something strange with the package check and calls to C abort

2022-10-29 Thread Dirk Eddelbuettel
On 29 October 2022 at 20:41, Juan Domingo Esteve wrote: | I am new to this list and I am using Rcpp for my first large and serious package, so No worries. "By construction" we all were at that point at some point in the past. | I apologize if probably this is a naive question, but I have bro

Re: [Rcpp-devel] thread safety RNG

2022-10-21 Thread Dirk Eddelbuettel
Hi Konrad, I have been meaning to look at ast2ast for some time now but alas no time yet... On 21 October 2022 at 12:15, konrad wrote: | my package ast2ast includes currently some random number generation | functions (e.g. R::dunif) within the C++ code. | | So my question is whether the RNG fu

Re: [Rcpp-devel] sourceCpp with RcppEigen?

2022-10-10 Thread Dirk Eddelbuettel
On 10 October 2022 at 09:16, Dirk Eddelbuettel wrote: | | On 10 October 2022 at 14:02, Sparapani, Rodney wrote: | | I’m wondering what it would take to make RcppEigen functions | | work wth sourceCpp? Please let me know. Thanks | | The standard one line: add`// [[Rcpp::depends(RcppEigen

Re: [Rcpp-devel] sourceCpp with RcppEigen?

2022-10-10 Thread Dirk Eddelbuettel
On 10 October 2022 at 14:02, Sparapani, Rodney wrote: | I’m wondering what it would take to make RcppEigen functions | work wth sourceCpp? Please let me know. Thanks The standard one line: add`// [[Rcpp::depends(RcppEigen)]]` We have been doing this in that very documented and visible way

Re: [Rcpp-devel] Use cholmod modify module in an Rcpp / RcppEigen package

2022-10-06 Thread Dirk Eddelbuettel
Salut Etienne, Sorry for missing this email yesterday. On 5 October 2022 at 12:35, etienne.c...@univ-eiffel.fr wrote: | I want to use the cholmod functions from the modify module https://github.com/PetterS/SuiteSparse/tree/master/CHOLMOD/Modify inside an Rcpp/RcppEigen R package. | | >From m

Re: [Rcpp-devel] cost of .Call

2022-08-10 Thread Dirk Eddelbuettel
Hi Konrad, On 10 August 2022 at 08:22, konrad wrote: | I have a question regarding the cost of .Call. If I implement the | rosenbrock function in R and in Rcpp. The R version is substentially | faster then the C++ version. The Rcpp function is basically an R | function which calls the C++ func

Re: [Rcpp-devel] Help reading libzma file

2022-06-23 Thread Dirk Eddelbuettel
recall if LZMA is part of that set. Portable development is hard for a reason. Operating systems are idiosyncratic. Dirk | | Em qui., 23 de jun. de 2022 às 07:59, Dirk Eddelbuettel | escreveu: | | > | > On 23 June 2022 at 10:05, Serguei Sokol wrote: | > | Le 23/06/2022 à 04:07, Rober

Re: [Rcpp-devel] Rcpp shared libraries (?)

2022-06-23 Thread Dirk Eddelbuettel
One belated follow-up: one can in general control visibility so - a function can be in C(++) and used by other C(++) functions (and we have examples) - a function can be exported to R easily via [[Rcpp::export()]] thanks to magic of Rcpp::compileAttributes() - a function can also be "priva

Re: [Rcpp-devel] Help reading libzma file

2022-06-23 Thread Dirk Eddelbuettel
On 23 June 2022 at 10:05, Serguei Sokol wrote: | Le 23/06/2022 à 04:07, Roberto Spadim a écrit : | > Hi folks | > | > I have a .xz file and need to read it and "convert" to a DataFrame using | > Rcpp if possible. | > | > But... I'm with a problem (first time testing this) using liblzma with |

Re: [Rcpp-devel] Assertion error in ud_ep.c, when running with MPI

2022-06-14 Thread Dirk Eddelbuettel
On 14 June 2022 at 09:38, Serguei Sokol wrote: | Hi, | | Probably, this issue would be better posted here | https://github.com/openucx/ucx/issues Seconded. I don't have much to add: these MPI examples are ten years old, worked all the time as far as we know, and haven't changed. Maybe some base

Re: [Rcpp-devel] [R-pkg-devel] moving from C to C++ with Rcpp in R package

2022-06-03 Thread Dirk Eddelbuettel
rt]] rcppsimdjson/src/simdjson_example.cpp:// [[Rcpp::export(.cppVersion)]] rcppsimdjson/src/simdjson_example.cpp:// [[Rcpp::export(.unsupportedArchitecture)]] edd@rob:~/git$ Hope this helps, Dirk | Thanks | Jean | | | > Le 2 juin 2022 à 15:49, Dirk Eddelbuettel a écrit : | &g

Re: [Rcpp-devel] [R-pkg-devel] moving from C to C++ with Rcpp in R package

2022-06-02 Thread Dirk Eddelbuettel
On 2 June 2022 at 08:32, Dirk Eddelbuettel wrote: | | (Removed CC to r-package-devel) | | On 2 June 2022 at 16:24, Ivan Krylov wrote: | | Unfortunately, this means editing RcppExports.R, which (I think) | | prevents you from enjoying the way Rcpp::compileAttributes() sets | | everything up for

Re: [Rcpp-devel] [R-pkg-devel] moving from C to C++ with Rcpp in R package

2022-06-02 Thread Dirk Eddelbuettel
(Removed CC to r-package-devel) On 2 June 2022 at 16:24, Ivan Krylov wrote: | Unfortunately, this means editing RcppExports.R, which (I think) | prevents you from enjoying the way Rcpp::compileAttributes() sets | everything up for you. Yes. I think that is the best I came up with once too in a t

Re: [Rcpp-devel] Doubt about best pratices

2022-04-30 Thread Dirk Eddelbuettel
This is not a well-posed Rcpp question as - matrix and data.frame are _fundamentally_ two different data types - matrix being _one_ and only one storage type, or class, stored as one vector with dimension attribute of size two for rows and cols; this makes it _efficient_ and you will see a m

Re: [Rcpp-devel] help with data.frame and numericvector

2022-04-27 Thread Dirk Eddelbuettel
On 27 April 2022 at 20:58, Roberto Spadim wrote: | Hello folks, | I'm converting some R functions to RCpp at | https://github.com/OVVO-Financial/NNS/ | | My problem is with a R "cast" function | | https://github.com/OVVO-Financial/NNS/blob/d3f37c6f217a41ce15b31f7a840b6b1ad63e5f36/R/Partial_Mome

Re: [Rcpp-devel] RCPP_USE_UNWIND_PROTECT by default

2022-02-06 Thread Dirk Eddelbuettel
On 7 February 2022 at 00:12, Jeroen Ooms wrote: | I have pushed a new version of V8 to CRAN that wraps the R callbacks | in another tryCatch() such that we do not make any assumptions on the | sort of exception handing provided by Rcpp. This should unblock you if | you want to move forward on this

Re: [Rcpp-devel] RCPP_USE_UNWIND_PROTECT by default

2022-02-06 Thread Dirk Eddelbuettel
To sum up: ¯\_(ツ)_/¯ I have no bone in this fight. Leaving it as is works for me too. Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forg

Re: [Rcpp-devel] RCPP_USE_UNWIND_PROTECT by default

2022-02-06 Thread Dirk Eddelbuettel
On 6 February 2022 at 18:18, Jeroen Ooms wrote: | Well not really, this kind of misses my point that it the | unwind-protect makes it impossible to meaningfully catch the R error | in C++, handle it, and continue running the C++ code, without aborting | the entire mission and throwing the user bac

Re: [Rcpp-devel] RCPP_USE_UNWIND_PROTECT by default

2022-02-06 Thread Dirk Eddelbuettel
On 6 February 2022 at 17:40, Jeroen Ooms wrote: | We can try to take V8 out of the equation, and see what actually | causes the change. V8 uses (and tests!) the Rcpp feature to call an R | function from C++. This behaves quite differently when using | RCPP_UNWIND_PROTECT. | | Here is a dummy pack

Re: [Rcpp-devel] RCPP_USE_UNWIND_PROTECT by default

2022-02-01 Thread Dirk Eddelbuettel
Lionel, Thanks a bunch for the prompt and detailed reply. CCing Jeroen now, I think I had poked him over DM on this but not followed. Easy for us to delegate to V8 :) That is of course a complicated (and toolchain-dependent) package too so we shall see what we can do there. But the good news on

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-31 Thread Dirk Eddelbuettel
On 31 January 2022 at 11:25, Alex Ilich wrote: | Thank you Zé and Dirk! That helped clarify exactly what solve is doing | which I was having trouble tracking down in just the standard docs page. The `solve()` function in Armadillo does exactly what it sets out to do. Yet what Prof Bates has been

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-30 Thread Dirk Eddelbuettel
On 31 January 2022 at 09:13, Zé Vinícius wrote: | Yes, quoting the paper on which ‘solve’ is based on ( | http://arma.sourceforge.net/armadillo_solver_2020.pdf): | | “The SVD-based solver uses the xGELSD set of functions, which find a | minimum-norm solution to a linear least squares problem.” Y

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-28 Thread Dirk Eddelbuettel
On 28 January 2022 at 13:25, Alex Ilich wrote: | Thank you Neal and Dirk. Based on these comments I think using arma::rcond Ah, yes, of course. Should have remembered arma::rcond. | to get the reciprocal of the condition factor, and checking if that is zero | rather than the determinant may be t

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-28 Thread Dirk Eddelbuettel
On 28 January 2022 at 09:16, Neal Fultz wrote: | There's an R object that has the machine precision, which could be a | reasonable threshold. | | .Machine$double.eps | | I believe there is a similar constant in the C++ standard library. | | You might also try checking the condition of the matri

Re: [Rcpp-devel] violates the C++ One Definition Rule ?

2022-01-25 Thread Dirk Eddelbuettel
Jan 24, 2022 at 1:14 PM Dirk Eddelbuettel wrote: | | > | > On 24 January 2022 at 12:55, Toby Hocking wrote: | > | Hi Rcpp Devs, | > | Does anyone know how to fix this warning in a package with LinkingTo: | > | RcppArmadillo? My package plotHMM | > | https://www.stats.ox.ac.uk/pu

Re: [Rcpp-devel] violates the C++ One Definition Rule ?

2022-01-24 Thread Dirk Eddelbuettel
On 24 January 2022 at 12:55, Toby Hocking wrote: | Hi Rcpp Devs, | Does anyone know how to fix this warning in a package with LinkingTo: | RcppArmadillo? My package plotHMM | https://www.stats.ox.ac.uk/pub/bdr/LTO/plotHMM.out got this message on CRAN Worth stressing that this happens under link-t

[Rcpp-devel] RcppArmadillo 0.10.8.0.0

2022-01-02 Thread Dirk Eddelbuettel
Happy New Year to all! Conrad released version 10.8 Armadillo (and I had prepared two pre-releases which passed reverse dependency checks just fine so not expecting surprises). Given that 0.10.7.5.0, the final RcppRelease for the 10.7.* series with his last release 10.7.5, only got to CRAN on De

Re: [Rcpp-devel] Limit of 20

2021-12-16 Thread Dirk Eddelbuettel
On 16 December 2021 at 06:38, Joseph Park wrote: | As R itself has no practical limit, and, large, ugly parameter lists are | sometimes unavoidable in API's, I respectfully request consideration to | relax the limit as design and resources allow. Please keep in mind that this project is provided

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Dirk Eddelbuettel
On 15 December 2021 at 12:30, Robert J. Hijmans wrote: | Dirk thanks very much for the help. And sorry, Alex, I misspoke. I meant to | say that Rcpp will coerce a R "numeric" (vector) to an | "Rcpp::IntegerVector" if you ask it to do so (and that is what happened in | the context we were discussin

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Dirk Eddelbuettel
On 15 December 2021 at 20:10, Balamuta, James Joseph wrote: | For those interested, the few other instances can be found by looking under the inst/include/Rcpp/generated/ folder: | | https://github.com/RcppCore/Rcpp/tree/master/inst/include/Rcpp/generated Yup, I mentioned the dir, but thanks f

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Dirk Eddelbuettel
On 15 December 2021 at 10:19, Kevin Ushey wrote: | I assume we're talking about Vector::create()? Anyone curious poking at it | can start by looking here: | | https://github.com/RcppCore/Rcpp/blob/940fb23868bf442e587994451e85263baa302d9c/inst/include/Rcpp/vector/Vector.h#L1122-L1126 There is mo

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Dirk Eddelbuettel
Joseph, Sorry, can't quote your message as whatever you used confused my mail handler. (Maybe try text-only next time if you remeber? I have had this before, albeit very rarely.) But it is a good idea. Someone with a bit of time should sit down and could do this as we now have C++11 / C++14 as

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Dirk Eddelbuettel
algrind with the command line: | >>> $ R --quiet --no-save --debugger=valgrind | >>> --debugger-args="--track-origins=yes --vgdb=full --vgdb-error=0" | >>> then in another window start a debugger process with | >>> $ gdb RHOME/bin/exec/R | >&

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Dirk Eddelbuettel
On 13 December 2021 at 09:15, Bill Dunlap wrote: | I ran your example under valgrind on Linux (Ubuntu 20.04) Excellent call, as usual! Thanks for doing that. R actually makes is so easy to run with valgrind by calling R CMD check --use-valgrind somePkg_1.2-3.tar.gz that I started to add it

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Dirk Eddelbuettel
On 13 December 2021 at 11:14, Alexander Ilich wrote: | Hi, I'm upgrading one of my R packages to rely on the terra package instead | of the raster package for the handling of spatial raster data. Previously | when relying on the raster package I had to convert the data to a matrix | and send it to

Re: [Rcpp-devel] Rcpp::plugins - Unwinding protection

2021-12-03 Thread Dirk Eddelbuettel
On 3 December 2021 at 12:06, Kevin Ushey wrote: | I'm a fan. I think we could just have a single header RcppLite.h which | would turn off the "heaviest" pieces of Rcpp; that is, modules + sugar | + (maybe?) RTTI. Yep. That's where I started. I may make that a PR then. But I also still lean to al

Re: [Rcpp-devel] Rcpp::plugins - Unwinding protection

2021-12-03 Thread Dirk Eddelbuettel
On 3 December 2021 at 19:47, Iñaki Ucar wrote: | Mmmh, no strong opinions here. I think it doesn't matter much whether | it's an include or a define. What matters most is whether this is | discoverable and the user understands what it does. That was my motivation -- by pointing to such a top-leve

Re: [Rcpp-devel] Rcpp::plugins - Unwinding protection

2021-12-03 Thread Dirk Eddelbuettel
On 3 December 2021 at 17:03, Iñaki Ucar wrote: | On Fri, 3 Dec 2021 at 15:44, Víthor Rosa wrote: | > | > Thank you for your response. Adding my functions to an R package and changing the Makevars file as suggested reduced the runtime by half. Excited for Rcpp 1.0.8! :) | | Excellent! Glad it h

Re: [Rcpp-devel] Rcpp::plugins - Unwinding protection

2021-12-02 Thread Dirk Eddelbuettel
On 2 December 2021 at 17:48, Iñaki Ucar wrote: | My simulation package makes heavy use of calls to R user functions from a | C++ simulation loop, and therefore greatly benefits from this feature too, | which I think we should promote to default. I agree and believe I looked into it once before --

Re: [Rcpp-devel] Package does not compile on MAC when running R-CMD-check github action

2021-11-07 Thread Dirk Eddelbuettel
Simon, Your Makevars [1] is very standard so I would suspect it may be the actions setup for macOS. Rcpp is still used by a large number of packages all of which appear to build just fine on macOS (as eg evidenced by the CRAN checks) if and when everything is setup correctly. Dirk [1] https://

Re: [Rcpp-devel] Any recent change that would remove Rcpp_precious_remove?

2021-10-01 Thread Dirk Eddelbuettel
Howdy, Somone (on r-help which I don't really follow for lack of time) called [3] this a 'quasi-FAQ': This problem is pratically a StackOverflow FAQ [1], with link to the Rcpp-devel mailing list [2]. [1] https://stackoverflow.com/questions/68416435/rcpp-package-doesnt-include-rcpp-preci

Re: [Rcpp-devel] Rcpp function results are different on different systems

2021-08-19 Thread Dirk Eddelbuettel
On 19 August 2021 at 10:04, Naeem Khoshnevis wrote: | Thank you so much, everyone, for responding to this email. Thanks for circling back! This was a pretty impressive thread as you got three distinct answers that all added some value :) Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel |

Re: [Rcpp-devel] Rcpp function results are different on different systems

2021-08-18 Thread Dirk Eddelbuettel
Naeem, I would simplify, simplify, simplify -- as 'Rcpp FAQ 7.31' reminds us all, testing _equality_ of doubles is challenging anyway. Besides, it may make sense to would ascertain first you get what you want in _purely serial modes_ and then move to OpenMP. Dirk -- https://dirk.eddelbuettel.

Re: [Rcpp-devel] Using Rcpp with results in "shared object 'nloptC.so' not found"

2021-08-18 Thread Dirk Eddelbuettel
On 18 August 2021 at 16:36, Simon Zehnder wrote: | I am using R 4.0.5 on a Fedora 34 System, Rcpp 1.0.6 and nloptr 1.2.2.2. Works here (Ubuntu 21.04, Rcpp 1.0.7) (see [1] below) Works at CRAN (see [2] below) Works at universe (see [3] below) I would suspect the error is at your end. Dirk [1]

Re: [Rcpp-devel] Apply Defined Rcpp Functions In Parallel

2021-08-17 Thread Dirk Eddelbuettel
On 18 August 2021 at 01:26, Dillon Hammill wrote: | Thanks for your help Dirk, I think I have everything I need to get things working now. I just needed a push in the right direction to discover wrap and as from Rcpp - they are awesome! They are indeed. (And, if I may, feature prominently in t

Re: [Rcpp-devel] Apply Defined Rcpp Functions In Parallel

2021-08-17 Thread Dirk Eddelbuettel
On 17 August 2021 at 19:19, Dillon Hammill wrote: | What is the easiest way to perform this conversion (say for vector to RVector or vector of vectors to matrix)? I always find that the existing RcppParallel that JJ and Kevin set up years ago excels there. Study them, they do it right, they wor

Re: [Rcpp-devel] Apply Defined Rcpp Functions In Parallel

2021-08-17 Thread Dirk Eddelbuettel
Dillon, The point of RMatrix and RVector in RcppParallel is to shield objects inside the RcppParallel blocks using Intel TBB from any interaction with the outer R process which may, or may not, run a gc() to rearrange its memory. Where they work, you should not use Rcpp's own NumericMatrix and a

  1   2   3   4   5   6   7   8   9   10   >