"William Stein" <[EMAIL PROTECTED]> writes:

> Naive question: what exactly is broadcasting, and how might it be
> useful in the context of SAGE?

Joshua Kantor explained in more detail, but simply being able
to do a[:,1:3] += 2 to add 2 to a portion of an array is already
an illustration.  Note that this also requires the view semantics.

Here's another example that came up the very first time I tried to
do something serious with sage.  I was doing some row manipulations
to a matrix a, and wanted to do something like

  a[i] += 5*a[j]

While sage does currently interpret a[i] as a row vector, since it
isn't a view, this doesn't do the right thing.

For each example, it would be easy to cook up a function like
add_scalar_multiple_of_one_row_to_another, but the combination
of broadcasting and view semantics gives a wide class of
array operations all in one go.  As a bonus, you get speed
(because loops get pushed down to carefully written loops)
and memory efficiency.

I realize though that this could interact badly with other aspects of
the way sage works.

Dan


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to