Hi John!

On Oct 6, 9:30 am, John Cremona <[email protected]> wrote:
> A second point: if Simon is right then whenever a dense matrix is
> compared to a sparse one, the sparse one is first converted to a dense
> equivalent.  That does not look very efficient to me,  though it is
> true that when both are of size mxn then all m*n entries of the dense
> one might need to be looked at.

I was slightly mistaken: There is no _cmp_ with single underscores.

In sage.structure.element, you will find the following comment.
 
####################################################################
    # For a derived Cython class, you **must** put the following in
    # your subclasses, in order for it to take advantage of the
    # above generic comparison code.  You must also define
    # either _cmp_c_impl (if your subclass is totally ordered),
    # _richcmp_c_impl (if your subclass is partially ordered), or both
    # (if your class has both a total order and a partial order;
    # then the total order will be available with cmp(), and the
partial
    # order will be available with the relation operators; in this
case
    # you must also define __cmp__ in your subclass).
    # This is simply how Python works.
    #
    # For a *Python* class just define __cmp__ as always.
    # But note that when this gets called you can assume that
    # both inputs have identical parents.
    #
    # If your __cmp__ methods are not getting called, verify that the
    # canonical_coercion(x,y) is not throwing errors.
    #
 
####################################################################

So, the things are a little complicated, in the sense that the
behaviour for Cython and Python is different.

Moreover, if __cmp__ is implemented then it is called *after*
coercion.

Cheers,
Simon

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to