search for: r_isna

Displaying 14 results from an estimated 14 matches for "r_isna".

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 o...
2011 Dec 02
1
1.6x speedup for requal() function (in R/src/main/unique.c)
Hi, FWIW: /* Taken from R/src/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...
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 p...
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...
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...
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 > > +----------...
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 l...
2008 Aug 16
1
unique.default problem (PR#12551)
...0; } In this case h contains only one negative value, which causes d->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
2014 Feb 10
1
Question re: NA, NaNs in R
Hi R-devel, I have a question about the differentiation between NA and NaN values as implemented in R. In arithmetic.c, we have int 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)....
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...
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 Mar 12
1
R 68.3 on OSF V4.0 problems
...in' : 'line 131 of file src/main/arithmetic.c : "R_NaN = 0.0/R_Zero_Hack;".' : 'Note that without IEEE_754, I get -1.797693e+308 for both 0/0 and 1/0.' perl -i.bak -pe 's/#define IEEE_754/#undef IEEE_754/' src/include/Platform.h : 'Need non-IEEE754 routine R_IsNA (wonder if it is correct...)' perl -i.bak -pe 's/^(.*Arithmetic )(Initialization.*)$/int R_IsNA(double x) { return (x != x); }\n\n$1zz $2/' src/main/arithmetic.c : 'Use cc, not f77, for linking (otherwise get "main multiply defined")' perl -i.bak -pe 's/..LDCMD./c...
2000 Mar 03
1
compiling R-1.0.0 on dec alpha (digital Unix 4.0)
I have tried compiling R on a dec alpha running digital unix 4.0 and got the following: f77 -shared -o ts.so PPsum.o burg.o eureka.o filter.o pacf.o starma.o stl.o carray.o mburg.o myw.o qr.o -lUfor -lfor -lFutil -lm -lots -lm ld: Warning: Unresolved: R_alloc R_NaReal R_IsNA R_IsNaNorNA R_chk_calloc R_chk_free Rf_error vmaxget vmaxset dqrdc2_ dqrcf_ mkdir ../../../../library/ts/libs gmake[4]: Leaving directory `/home/ming/R-1.0.0/src/library/ts/src' gmake[3]: Leaving directory `/home/ming/R-1.0.0/src/library/ts' gmake[3]: Entering directory `/home/ming/R-1.0.0/...
2002 Jul 11
1
dyn.load tcl/tk (PR#1774)
...cc -shared -L/soft/readline/v4.2.1/lib -o ts.so HoltWinters.o PPsum.o arima.o burg.o carray.o filter.o init.o mburg.o myw.o pacf.o qr.o starma.o eureka.o stl.o -L/soft/readline/v4.2.1/lib -lreadline -ltermcap -lm -lUfor -lfor -lFutil -lots -lm_c32 -lmld -lexc ld: Warning: Unresolved: R_NaReal R_IsNaNorNA Rf_error R_alloc R_NilValue Rf_coerceVector Rf_allocMatrix Rf_allocVector Rf_asInteger Rf_asLogical Rf_asReal Rf_duplicate Rf_protect Rf_unprotect TYPEOF LENGTH SET_VECTOR_ELT INTEGER REAL vmaxget vmaxset R_IsNA R_registerRoutines R_NaInt R_chk_calloc R_chk_free Rf_install R_MakeExternalPtr R_...