[Rd] zero-extent matrices (PR#958)
Prof Brian D Ripley
Thu, 31 May 2001 07:36:02 +0100 (BST)
On Wed, 30 May 2001, Thomas Lumley wrote:
> On 30 May 2001, Peter Dalgaard BSA wrote:
> > firstname.lastname@example.org 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
It's a 10x0 matrix times a 0x1 matrix. A length-n vector gets promoted to
a nx1 matrix, and that applies for n=0 too:
 0 1
Brian D. Ripley, email@example.com
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
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: firstname.lastname@example.org