[Rd] Inconsistencies (PR#550)

Berwin Turlach berwin@maths.uwa.edu.au
Mon, 22 May 2000 16:45:51 +0800 (WST)


>>>>> "BDR" == Prof Brian D Ripley <ripley@stats.ox.ac.uk> writes:

  BDR> On Mon, 22 May 2000 berwin@maths.uwa.edu.au wrote:
  >> Dear all,
  >> 
  >> I was playing around with some C-code that I dynamically linked to R
  >> and noticed the following inconsistency:

  BDR> I can find no inconsistency.  [...]
  BDR> For example, if printit.c is

  BDR> void printit(double *x, int *n)
  BDR> {
  BDR>     int i;
    
  BDR>     for(i = 0; i < *n; i++) printf("[%d] %f\n", i, x[i]);
  BDR> }

  >> dat <- matrix(1,3,3)
  >> is.double(dat)
  BDR> [1] TRUE
  >> invisible(.C("printit", dat, as.integer(9)))
  BDR> [0] 1.000000 [...]
Sorry, mea culpa.  My C-code was a bit more complicated and I know
realise that I had screwed up within the C-routine.  By the time the
C-code was fixed, I had an `as.double(dat)' in my call to .C but was
still under the impression that the problems where due to the fact
that R past a matrix that it claimed to be in storage mode double as
an integer matrix to the C-routine....  

  BDR> I think the moral is that you cannot assume the storage mode of
  BDR> expressions returned by R (or by S).
I guess the moral is rather that I should believe that I found a bug
in R when I am fooling around with some code around midnight ;-/  Or
that I should check better for the sources of my alleged bugs.....

Cheers,

        Berwin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._