Maybe that's already implicit in the broadcasting proposal but it
wouldn't hurt to spell it out:

  A dimension size of 1 should be broadcasted to match that of the
  other operand. So, for example, the following shapes (returned by 
  @#array) are compatible:

   @c     =         @a       *       @b   

  result shape     shape @a        shape @b

  [4,8,5]           [4,1,5]        [4,8,5]
  [5,3,2]           [1,3,2]        [5,1,2]

In that respect it would be nice to have a slicing syntax to introduce
'dummy' dimensions of size 1 (e.g. Yorick uses the concept of a
pseudo-index, [1]; similarly NumPy [2]; PDL has dummy dimensions via '*'
using C<slice>):

  @a = sin @x; # 1D array
  @b = cos @x;

  @twod = @a * @b[-;];

which would be the same as

  @twod[|i;|j] = @a[|i] * @b[|j];

 Christian


[1] ftp://ftp-icf.llnl.gov/pub/Yorick/ydoc/manual/Pseudo-Index.html
[2] http://numpy.sourceforge.net/numdoc/HTML/numdoc.html#pgfId-36371

-- 
Christian Soeller                [EMAIL PROTECTED] x2770
Dept. of Physiology              U. Auckland School of Medicine         
Auckland                         New Zealand

Reply via email to