On 5/22/07, Martin Albrecht <[EMAIL PROTECTED]> wrote:
>
> > There might be something simpler though.
>
> How about if we overload Python's built-in map function such that it also
> works for matrices and falls back to the built-in one for the rest? Or if
> that is an issue because it might be confusing for Python users, we could
> call it smap/sage_map?
>
> So for example:
> sage: A = random_matrix(GF(127),2,2)
> sage: B = smap(lambda x: x + 1, A)
>
> Thoughts?

Something like this is a really good idea.  I don't think it's the
best solution for conjugate transpose (see below).  Here
is a slight alternative to your proposal.  What do people think?

sage: A = random_matrix(GF(127),2,2)
sage: B = A.map( lambda x : x+1 )
sage: B = A.apply( lambda x : x+1 )

Of course the input to map or apply is any callable function.

-----

In this particular case -- e.g., conjugate transpose, the only reasonable
answer is that this has to be implemented as a compiled sagex function
for that type of matrix.   I suspect Josh Kantor will just post a patch,
since he maintains that code.  I.e., there should be a method

  def conjugate_transpose(self):
        do some sagex stuff

Any iteration, etc., type thing will be way too slow.

-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org

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

Reply via email to