[Rd] zero-extent matrices (PR#958)

Thomas Lumley tlumley@u.washington.edu
Wed, 30 May 2001 12:36:56 -0700 (PDT)


On 30 May 2001, Peter Dalgaard BSA wrote:

> tlumley@u.washington.edu writes:
>
> > In 1.2.3
> >   matrix(nrow=10,ncol=0)%*%numeric(0)
> > returns a 10x1 matrix of 0s
> >
> > In todays 1.3 it returns a 10x1 matrix of miscellaneous junk.
> >
> > While both are probably wrong the latter is causing problems for survival.
>
> Acutally, I'd say that the 1.2.3 version is correct (sums over empty
> sets being zero is a standard convention).

I was thinking that a 10x0 matrix times a 0x0 matrix should be a 10x0
matrix

>
> Hmm, 1.3.0 as of yesterday gives 10 zeros for me as does the one
> updated and compiled about 18:00 CET...

Initially it will give zero. The two operands contain pointers to the R
heap and the BLAS call is treating the objects pointed to as length 10 and
length 1 respectively and multiplying whatever happens to be there.
Initially this will be zeros.


	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._