[Numpy-discussion] How's our broadcasting?
shish at keba.be
Wed Dec 28 14:53:46 EST 2011
2011/12/28 Jordi Gutiérrez Hermoso <jordigh at octave.org>
> On 28 December 2011 13:41, Ralf Gommers <ralf.gommers at googlemail.com>
> > 2011/12/28 Jordi Gutiérrez Hermoso <jordigh at octave.org>
> >> Just FYI, the next stable release of Octave (3.6) will have
> >> broadcasting. I used Numpy as an inspiration.
> >> Here is the WIP manual for it:
> > Is this a departure of maintaining full compatibility with Matlab?
> No, Matlab code will still work in Octave, except in very rare cases,
> but it's a matter of flipping a switch to make those weird cases work
> as well.
> Octave isn't a Matlab clone. The goal is to be source compatible to
> Matlab: code that runs in Matlab should run in Octave, but we don't
> try to limit ourselves to whatever Matlab does, nor do we copy every
> bug unless there's a very good reason to copy its bugs.
> I think I may be missing a few broadcasting behaviours regarding
> assignment. Is something like that possible, to broadcast a vector
> across a matrix during assignment?
> - Jordi G. H.
Numpy does it:
In : x = numpy.zeros((3, 3))
In : x[:] = numpy.arange(3)
In : x
array([[ 0., 1., 2.],
[ 0., 1., 2.],
[ 0., 1., 2.]])
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion