Re: R-beta: matrix multiplication not Fortran

Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
07 Apr 1998 12:17:07 +0200


To: Douglas Bates <bates@stat.wisc.edu>
Subject: Re: R-beta: matrix multiplication not Fortran
From: Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk>
Date: 07 Apr 1998 12:17:07 +0200
In-Reply-To: Douglas Bates's message of 06 Apr 1998 09:31:46 -0500

Douglas Bates <bates@stat.wisc.edu> writes:

> 
> Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:
> 
> > Anyone checked this with Debian-pre2.0?
> 
> Both problems ( 1 %o% 1 crashing and ctrl^C not interrupting on second
> and subsequent uses ) also occur on a Debian-2.0 system using 0.61.2.

The ^C problem is not there in RedHat4.2. It must be glibc-related.
Perhaps one should dig deeper into it and report is as a bug in Debian
before it gets released? Or at least check whether it has already been
reported? It should be fairly easy to write a generic test program to
see whether this kind of signal handling works at all.

The 1%o%1 problem boils down to

m<-matrix(1)
m*m
....segfault

apparently, the $dim attribute on scalars can get lost somewhere
before the matrices are tested for conformability. Now, the
conformable() function uses the LENGTH macro to extract the length of
its arguments, but this doesn't work on NULL where you get random
garbage instead of zero! A passable workaround seems to be to replace
"LENGTH" with "length", which is a function that knows about NULL. 

I'm not sure whether that is a correct fix ($dim is still lost on the
result) but it doesn't crash anymore:

> m<-matrix(1)
> m*m
[1] 1
> m%o%m
     [,1]
[1,]    1

I'm too lazy to make a true patch, but line 316 of src/main/util.c
should read:

           if ((n = length(x)) != length(y))


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._