search for: r_isnan

Displaying 13 results from an estimated 13 matches for "r_isnan".

Did you mean: __isnan
2019 Sep 29
2
speed up R_IsNA, R_IsNaN for vector input
Dear R developers, I spotted that R_isNA and R_IsNaN could be improved when applied on a vector where we could take out small part of their logic, run it once, and then reuse inside the loop. I setup tiny plain-C experiment. Taking R_IsNA, R_IsNaN from R's arithmetic.c, and building R_vIsNA and R_vIsNaN accordingly. For double input of size 1e9 (...
2019 Sep 30
0
speed up R_IsNA, R_IsNaN for vector input
On 9/29/19 1:09 PM, Jan Gorecki wrote: > Dear R developers, > > I spotted that R_isNA and R_IsNaN could be improved when applied on a > vector where we could take out small part of their logic, run it once, > and then reuse inside the loop. Dear Jan, Looking at your examples, I just see you have hand-inlined R_IsNA/R_IsNaN, or is there anything more? In principle we could put R_IsNA,...
2020 Jan 01
2
New R function is.nana = is.na & !is.nan
...Ushey made a nice summary of current R C api in: https://stackoverflow.com/a/26262984/2490497 Pasting related part below, extra row added by me is a requested feature. +---------------------+ | C fun | NaN | NA | R fun +---------------------+ | ISNAN | t | t | is.na | R_IsNaN | t | f | is.nan | ISNA | f | t | is.na && !is.nan | R_IsNA | f | t | is.na && !is.nan +---------------------+ +---------------------+ | R fun | NaN | NA | C fun +---------------------+ | is.na | t | t | ISNAN | is.nan | t...
2011 Dec 02
1
1.6x speedup for requal() function (in R/src/main/unique.c)
.../main/unique.c */ static int requal(SEXP x, int i, SEXP y, int j) { if (i < 0 || j < 0) return 0; if (!ISNAN(REAL(x)[i]) && !ISNAN(REAL(y)[j])) return (REAL(x)[i] == REAL(y)[j]); else if (R_IsNA(REAL(x)[i]) && R_IsNA(REAL(y)[j])) return 1; else if (R_IsNaN(REAL(x)[i]) && R_IsNaN(REAL(y)[j])) return 1; else return 0; } /* Between 1.34x and 1.37x faster on my 64-bit Ubuntu laptop */ static int requal2(SEXP x, int i, SEXP y, int j) { double xi, yj; if (i < 0 || j < 0) return 0; xi = REAL(x)[i]; yj = REAL(y)[j];...
2020 Jan 02
1
New R function is.nana = is.na & !is.nan
...LUHKlw_nh2Q4o&e= > > Pasting related part below, extra row added by me is a requested feature. > > > > +---------------------+ > > | C fun | NaN | NA | R fun > > +---------------------+ > > | ISNAN | t | t | is.na > > | R_IsNaN | t | f | is.nan > > | ISNA | f | t | is.na && !is.nan > > | R_IsNA | f | t | is.na && !is.nan > > +---------------------+ > > +---------------------+ > > | R fun | NaN | NA | C fun > > +-----------...
2008 Aug 16
1
unique.default problem (PR#12551)
...equal(=requal) to return 0. static int requal(SEXP x, int i, SEXP y, int j) { if (i < 0 || j < 0) return 0; if (!ISNAN(REAL(x)[i]) && !ISNAN(REAL(y)[j])) return (REAL(x)[i] == REAL(y)[j]); else if (R_IsNA(REAL(x)[i]) && R_IsNA(REAL(y)[j])) return 1; else if (R_IsNaN(REAL(x)[i]) && R_IsNaN(REAL(y)[j])) return 1; else return 0; } I do not claim that the situation above is frequent or even meaningful, however it should not cause a crash of R. Sincerely yours Vilmos Prokaj
2020 Jan 01
0
New R function is.nana = is.na & !is.nan
...p;s=zFj3lh-N_YlNBRlDKeO-aTs0Bf2qtWLUHKlw_nh2Q4o&e= > Pasting related part below, extra row added by me is a requested feature. > > +---------------------+ > | C fun | NaN | NA | R fun > +---------------------+ > | ISNAN | t | t | is.na > | R_IsNaN | t | f | is.nan > | ISNA | f | t | is.na && !is.nan > | R_IsNA | f | t | is.na && !is.nan > +---------------------+ > +---------------------+ > | R fun | NaN | NA | C fun > +---------------------+ > | is.na...
2004 Oct 22
1
Incompatibility between R-2.0.0 and Rggobi_1.0-0.
Hello, I was trying to install Rggobi in the latest version of R and it gave me a compilation error for R CMD INSTALL Rggobi_1.0-0.tar.gz RSGGobi.C: In function RS_GGOBI_init (R_IsNaNorNA) undeclared (line 77) I searched for this function in R src files and it was abandoned in ~/R-2.0.0/src/include/R_ext/Arith.h file. Only functions int R_IsNA(double); /* True for R's NA only */ int R_IsNaN(double); /* True for special NaN, *not* for NA */ are declared le...
2005 Jan 05
1
Standalone Mathlib, C++ and ISNAN()
...ns can be called from from C++ programs, and the API includes the special values ISNAN() and R_FINITE() and the missing test ISNA(). R_FINITE is no problem. It is defined as R_finite, which is declared in Rmath.h and included in libRmath. ISNAN() however is broken. In R 1.9 it was defined as R_IsNaNorNA unless IEEE_754 was defined which was not done in the standalone libRmath/Rmath.h. R_IsNaNorNA was declared in Rmath and included in libRmath. So it would work, although probably not when built against an installed R library because R.h would likely define IEEE_754. In R2.0 ISNAN() is de...
2014 Feb 10
1
Question re: NA, NaNs in R
...nt R_IsNA(double x) { if (isnan(x)) { ieee_double y; y.value = x; return (y.word[lw] == 1954); } return 0; } ieee_double is just used for type punning so we can check the final bits and see if they're equal to 1954; if they are, x is NA, if they're not, x is NaN (as defined for R_IsNaN). My question is -- I can see a substantial increase in speed (on my computer, in certain cases) if I replace this check with int R_IsNA(double x) { return memcmp( (char*)(&x), (char*)(&NA_REAL), sizeof(double) ) == 0; } IIUC, there is only one bit pattern...
2009 Jul 14
1
Incorrect comment about ISNA(x) in Arith.h (PR#13826)
R-2.9.0/include/R_ext/Arith.h has: int R_IsNA(double); /* True for R's NA only */ int R_IsNaN(double); /* True for special NaN, *not* for NA */ int R_finite(double); /* True if none of NA, NaN, +/-Inf */ #define ISNA(x) R_IsNA(x) /* True for *both* NA and NaN. The first and last lines are contradictory - if R_IsNA is true only for NA, not NaN, then ISNA should be the same. Venab...
2010 Jan 22
2
Optimizing C code
Hi the list, I need to write some efficient distances function, so I read the code for the Euclidean distance. I do not understand the purpose of the line 11 : if x[i] and y[i] are not NA (line 9), can dev be NA ? Christophe #define both_FINITE(a,b) (R_FINITE(a) && R_FINITE(b)) #define both_non_NA(a,b) (!ISNAN(a) && !ISNAN(b)) 1. static double R_euclidean2(double *x, double
1999 Sep 13
5
axis() produces junk on DEC alpha (PR#274)
Full_Name: Albrecht Gebhardt Version: 0.65.0 OS: Digital Unix 4.0E Submission from: (NULL) (212.17.104.62) Plottimg on the Alpha stopped working with 0.65.0. The tickmarks have a length of -Inf and go across the whole plot. A first solution is the following patch: --- src/main/plot.c.alpha-patch Mon Sep 13 01:37:11 1999 +++ src/main/plot.c Mon Sep 13 01:58:16 1999 @@ -832,7 +832,7 @@