Displaying 20 results from an estimated 6000 matches similar to: "dist() {"mva" package} bug: treats +/- Inf as NA"
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as
sum(|x_i - y_i| / |x_i + y_i|)
Obviously this is undefined for cases where both x_i and y_i are zeros. Since
double zeros are common in many data sets, this is a nuisance. In our field
(from which the distance is coming), it is customary to remove double zeros:
contribution to distance is zero when both x_i
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as
sum(|x_i - y_i| / |x_i + y_i|)
Obviously this is undefined for cases where both x_i and y_i are zeros. Since
double zeros are common in many data sets, this is a nuisance. In our field
(from which the distance is coming), it is customary to remove double zeros:
contribution to distance is zero when both x_i
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
2019 Dec 08
2
What should dnorm(0, 0, -Inf) return?
Yes, that looks like a bug and an easily fixable one too.
However, I spy another issue: Why do we check the !R_FINITE(x) && mu == x before checking for sd < 0 ? The difference is whether we
return ML_NAN;
or
ML_ERR_return_NAN;
but surely negative sd should always be an error?
I'd be inclined to do
if (sigma < 0) ML_ERR_return_NAN;
if(!R_FINITE(sigma)) return R_D__0;
2019 Dec 07
2
What should dnorm(0, 0, -Inf) return?
Hi,
Apropos of a recent Inf question, I've previously wondered if dnorm "does the right thing" with
dnorm(0, 0, -Inf)
which gives zero. Should that be zero or NaN (or NA)?
The help says "'sd < 0' is an error and returns 'NaN'" and since -Inf < 0 is TRUE, then... is this a bug?
Thank you,
Stephen
Rochester, MN USA
2005 Jan 04
2
ISNAN() broken? in ver 2.x on MacOS X
I have a problem building an extension using ISNAN() on R version 2.0.x.
In R 1.9.1 Arith.h and Rmath.h contained code like
#ifdef IEEE_754
# define ISNAN(x) (isnan(x)!=0)
#else
# define ISNAN(x) R_IsNaNorNA(x)
#endif
#define R_FINITE(x) R_finite(x)
int R_IsNaNorNA(double);
int R_finite(double);
which works.
R 2.0.x has
# define ISNAN(x) (isnan(x)!=0)
unconditionally.
This breaks
2005 Jan 04
2
ISNAN() broken? in ver 2.x on MacOS X
I have a problem building an extension using ISNAN() on R version 2.0.x.
In R 1.9.1 Arith.h and Rmath.h contained code like
#ifdef IEEE_754
# define ISNAN(x) (isnan(x)!=0)
#else
# define ISNAN(x) R_IsNaNorNA(x)
#endif
#define R_FINITE(x) R_finite(x)
int R_IsNaNorNA(double);
int R_finite(double);
which works.
R 2.0.x has
# define ISNAN(x) (isnan(x)!=0)
unconditionally.
This breaks
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 @@
2019 Dec 09
0
What should dnorm(0, 0, -Inf) return?
>>>>> peter dalgaard
>>>>> on Sun, 8 Dec 2019 12:11:50 +0100 writes:
> Yes, that looks like a bug and an easily fixable one too.
agreed.
> However, I spy another issue: Why do we check the
> !R_FINITE(x) && mu == x before checking for sd < 0 ? The
> difference is whether we
> return ML_NAN; or ML_ERR_return_NAN;
2017 Feb 09
3
Ancient C /Fortran code linpack error
> > On 9 Feb 2017, at 16:00, G?ran Brostr?m <goran.brostrom at umu.se> wrote:
> >
> > In my package 'glmmML' I'm using old C code and linpack in the optimizing procedure. Specifically, one part of the code looks like this:
> >
> > F77_CALL(dpoco)(*hessian, &bdim, &bdim, &rcond, work, info);
> > if (*info == 0){
> >
2019 Dec 07
0
What should dnorm(0, 0, -Inf) return?
Good question, I cannot speak for R's developers but I would like to
provide some information on the problem. Here are the first few lines of
the dnorm function located at src\nmath\dnorm.c:
```
double dnorm4(double x, double mu, double sigma, int give_log)
{
#ifdef IEEE_754
if (ISNAN(x) || ISNAN(mu) || ISNAN(sigma))
return x + mu + sigma;
#endif
if(!R_FINITE(sigma)) return R_D__0;
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.
1999 Jan 20
2
dist function suggestion
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---559023410-162216788-916833047=:29339
Content-Type: TEXT/PLAIN; charset=US-ASCII
On my R installation (0.62.4) there is no dist() function, so I attach one
possibility. It provides
2005 Apr 02
2
Solaris10/amd64 + SunSutio Compile (PR#7767)
Full_Name: Teru KAMOGASHRIA
Version: 2.0.1
OS: SunOS sun 5.10 Generic i86pc i386 i86pc
Submission from: (NULL) (219.5.176.24)
rbinom.c cannot be compiled because of the casting problem.
/opt/SUNWspro/bin/cc -I. -I../../src/include -I../../src/include
-I/usr/local/include -DHAVE_CONFIG_H -D__NO_MATH_INLINES -g -c rbinom.c -o
rbinom.o
"rbinom.c", line 60: operand must have real
2010 Oct 19
2
[LLVMdev] Structure memory layout
Hi Renato,
Firstly, I have been removing target specific information from struct type on bitcode.
Target specific information are type size, type alignment, merged bitfields and so on.
For example
1 struct test {
2 char a:3;
3 char b:4;
4 char c:3;
5 char d:2;
6 };
7
8 struct test vm = {1, 2, 3, 1};
9
10 int main(void)
11 {
12 int a;
13 vm.d = 1;
14 }
Above
1999 Jan 20
0
dist(*, "euclidean") [was "dist function suggestion"]
> BDR> You will need to call it something else: dist is a clone of an S
> BDR> function, and dist(X, "manhattan") is well-established usage.
>
> one could still imagine an extra Y argument such that
> dist(X, Y=myY, method="euclidean")
> and dist(X, "euclidean", Y=myY)
> would work
> one could even make it such that
> both
2017 Feb 10
1
Ancient C /Fortran code linpack error
> On 10 Feb 2017, at 14:53, G?ran Brostr?m <goran.brostrom at umu.se> wrote:
>
> Thanks to all who answered my third question. I learned something, but:
>
> On 2017-02-09 17:44, Martin Maechler wrote:
>>
>>>> On 9 Feb 2017, at 16:00, G?ran Brostr?m <goran.brostrom at umu.se> wrote:
>>>>
>>>> In my package 'glmmML'
2006 Dec 16
1
max.col oddity
I've noticed that the max.col function with the default "random"
option often gives unexpected results. For instance, in this test, it
seems clear what the answer should be:
> # second col should always be max
> x1 = cbind(1:10, 2:11, -Inf)
>
> # this works fine
> max.col(x1, "first")
[1] 2 2 2 2 2 2 2 2 2 2
>
> # this gives random answers
>
2007 Dec 05
4
Java parser for R data file?
Hi everyone,
Has anyone written a parser in Java for either the ASCII or binary format
produced by save()? I need to parse a single large 2D array that is
structured like this:
list(
"32609_1" = c(-9549.39231289146, -9574.07159324482, ... ),
"32610_2" = c(-6369.12526971635, -6403.99620977124, ... ),
"32618_2" = c(-2138.29095689061, -2057.9229403233, ... ),
2005 Jan 05
1
Standalone Mathlib, C++ and ISNAN()
In the hope of some meaningful response and ignoring the risk of
further abuse, let me try to clarify the issue here.
I have re-read the 'Writing R Extensions' manual. It seems to me that
it clearly says R API functions 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