From thomas@biostat.washington.edu  Tue Apr 14 02:04:40 1998
From: thomas@biostat.washington.edu (Thomas Lumley)
Date: Mon, 13 Apr 1998 18:04:40 -0700 (PDT)
Subject: 0-extent matrices?
In-Reply-To: <13616.54878.596955.835572@aragorn.ci.tuwien.ac.at>
Message-ID: <Pine.SUN.3.95.980413175740.28284D-100000@chekov>

On Sun, 12 Apr 1998, Kurt Hornik wrote:
> 
> Sounds very much like going the Octave/MATLAB way.  I thought we'd
> eventually have a `Matrix' class for such things?

Not really -- this applies to arrays as well and is basically a
programming issue similar to using drop=F when subscripting.  If you
subscript an array and it turns out that the result is empty you still
want as much as possible of the same code to work.  The most important
things are cbind, rbind and t, but it is useful that %*%, chol, solve, and
qr all give sensible results with empty matrices.  I went with m+2 giving
NA, for consistency with real(0)+2, so you do have to explicitly do
m+array(2,dim=dim(m)) or some such if you want elementwise arithmetic
operations on a possibly empty array.  This means very little special case
work is need to handle possibly empty arrays


Thomas Lumley
------------------------
Biostatistics		
Uni of Washington	
Box 357232		
Seattle WA 98195-7232	
------------------------

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


0-extent matrices?
Thomas Lumley