Re: [Rd] Another issue using multi-processing linear algebra libraries

2024-08-07 Thread Dipterix Wang
I also have this questions for this. I wonder if R initiates a system environment or options to instruct the packages on the number of cores to use? It doesn't have to be mandatory for now, but at least package maintainers can have shared consensus and start to adopt this humble settings rather

Re: [Rd] Choices to remove `srcref` (and its buddies) when serializing objects

2024-01-17 Thread Dipterix Wang
> > We have one in vctrs but it's not exported: > https://github.com/r-lib/vctrs/blob/main/src/hash.c > > The main use is vectorised hashing: > Thanks for showing me this function. I have read the source code. That's a great idea. However, I think I might have missed something. When I trie

Re: [Rd] Choices to remove `srcref` (and its buddies) when serializing objects

2024-01-16 Thread Dipterix Wang
` but that package uses `serialize` (see discussion https://github.com/eddelbuettel/digest/issues/200#issuecomment-1894289875) > On Jan 12, 2024, at 11:33 AM, Tomas Kalibera wrote: > > > On 1/12/24 06:11, Dipterix Wang wrote: >> Dear R devs, >> >> I was digging i

[Rd] Choices to remove `srcref` (and its buddies) when serializing objects

2024-01-11 Thread Dipterix Wang
Dear R devs, I was digging into a package issue today when I realized R serialize function not always generate the same results on equivalent objects when users choose to run differently. For example, the following code serialize(with(new.env(), { function(){} }), NULL, TRUE) generates differe

[Rd] numeric_version doesn't like numeric versions anymore?

2023-07-05 Thread Dipterix Wang
Dear R devs, I installed the recent devel R to test a package error when I intercept this warning when loading packages: ``` Warning in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) : invalid non-character version specification 'x' (type: double) ``` After a lon

Re: [Rd] dir.exists returns FALSE on Symlink directory

2023-06-26 Thread Dipterix Wang
Thanks! I think Sys.readlink resolved my issue. Indeed I found a permission issue. I will post my questions to r-help next time. Best, Dipterix > On Jun 26, 2023, at 11:17 AM, Serguei Sokol wrote: > > Le 26/06/2023 à 16:26, Dipterix Wang a écrit : >> I hope I'm not aski

[Rd] dir.exists returns FALSE on Symlink directory

2023-06-26 Thread Dipterix Wang
I hope I'm not asking a stupid question... If I symlink a directory, is symlink considered as directory in R? If so, why `dir.exists` returns FALSE on directory? I understand symlink is essentially a file, but functionally a symlink to directory is no different to the directory itself, but a di

[Rd] make file.rename return invisible

2023-03-23 Thread Dipterix Wang
Dear R Core devs, I wonder if it makes sense to make function file.rename return invisible? This is not a big issue, but when running in RMarkdown or knitr, this function will print results. I have to manually call invisible to hide the output from showing in the final document: ```r invisible

Re: [Rd] Lazy-evaluate elements wrapped with invisible

2022-10-29 Thread Dipterix Wang
me. Do you mean a 'delayed' component of a list should be considered > garbage if not 'immediately' extracted from a list? Could you show a few > usage cases? > > -Bill > > On Fri, Oct 28, 2022 at 7:41 PM Dipterix Wang <mailto:dipterix.w...@gmail.

Re: [Rd] Lazy-evaluate elements wrapped with invisible

2022-10-28 Thread Dipterix Wang
> This is not quite true. The value, even when invisible, is captured by > .Last.value, and > > > f <- function() invisible(5) > > f() > > .Last.value > [1] 5 I understand .Last.value will capture the function returns, but that only happens in the top-level... I guess? In the followings co

[Rd] Lazy-evaluate elements wrapped with invisible

2022-10-28 Thread Dipterix Wang
Hi, I was wondering if it is a good idea to delay the evaluation of expression within invisible(), just like data()/delayedAssign()? The idea is a function might return an invisible object. This object might not be used by the users if the function returns are not assigned nor passed to anothe

[Rd] How can a package be aware of whether it's on CRAN

2021-11-23 Thread Dipterix Wang
Dear R wizards, I recently received an email from Prof. Ripley. He pointed out that my package seriously violates the CRAN policy: "using 8 threads is a serious violation of the CRAN policy”. By default the number of cores my package uses is determined from system CPU cores. After carefully rea

Re: [Rd] stats::fft produces inconsistent results

2021-10-21 Thread Dipterix Wang
) when a longjmp is triggered. Non-memory resources (e.g. a socket) > returned to R should use the R_MakeExternalPtr() mechanism to make sure that, > when the memory is freed by the garbage collector, the resource is also freed. > > "Writing R extensions" con

Re: [Rd] stats::fft produces inconsistent results

2021-10-20 Thread Dipterix Wang
often confused about when to PROTECT and when not. >>>> ... but then ravetools is not even a CRAN package, so why should you dare >>>> to use it for anything serious ? Haha, thanks : ) I guess I will probably be grouchy too if seeing so many people making the same mist

[Rd] stats::fft produces inconsistent results

2021-10-19 Thread Dipterix Wang
Dear R-devel Team, I'm developing a neuroscience signal pipeline package in R (https://github.com/dipterix/ravetools) and I noticed a weird issue that failed my unit test. Basically I was trying to use `fftw3` library to implement fast multivariate fft function in C++. When I tried to compare

Re: [Rd] Double to uint64_t on M1

2021-08-11 Thread Dipterix Wang
Thank you, I guess I should convert double to uint64_t instead of int64_t... The reason why I asked is because bit64 package `bit64::as.integer64(2^63)` produces different results on my machine vs. another server. This package converts double to int64_t directly. Looks like this is a bug in the

[Rd] Double to uint64_t on M1

2021-08-11 Thread Dipterix Wang
Hi, I was trying to convert REALSXP to int64_t in C, then found that converting 2^63 is inconsistent across platforms: On M1 ARM osx, 2^63 (double) bit converting to `int64_t` becomes 9223372036854775807 On x86_64 ubuntu server, 2^63 (double) bit converting to `int64_t` is -92233720368547758