Ticket #9880: trac_9880-stable_operands.patch

File trac_9880-stable_operands.patch, 1.9 KB (added by burcin, 9 years ago)
  • sage/libs/ginac/decl.pxi

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1308253420 -7200
    # Node ID 0bd7d20ad78bf93f430efc09fa35df173240cd65
    # Parent  abecb7795b7b0b63f44c5bbc5a25450a493cb9dd
    Use printing order for operands access and comparison of symbolic expressions.
    
    diff --git a/sage/libs/ginac/decl.pxi b/sage/libs/ginac/decl.pxi
    a b  
    7575        GEx rhs()                     except +
    7676        GEx lhs()                     except +
    7777        int nops()                    except +
    78         GEx op(int i)                 except +
     78        GEx op "sorted_op" (int i)    except +
    7979        GEx eval(int level)           except +
    8080        GEx evalf(int level, object parent) except +
    8181        GEx conjugate()               except +
     
    507507    py_funcs_struct py_funcs "GiNaC::py_funcs"
    508508
    509509cdef extern from "pynac/order.h":
     510    bint print_order_compare "GiNaC::print_order().compare" \
     511            (GEx left, GEx right) except +
    510512    bint print_order "GiNaC::print_order()" \
    511513            (GEx left, GEx right) except +
    512514    bint print_order_mul "GiNaC::print_order_mul()" \
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    24042404        return (<Element>left)._cmp(right)
    24052405
    24062406    cdef int _cmp_c_impl(left, Element right) except -2:
    2407         return left._gobj.compare((<Expression>right)._gobj)
     2407        return -print_order_compare((<Expression>right)._gobj,left._gobj)
    24082408
    24092409    cpdef int _cmp_add(left, CommutativeRingElement right) except -2:
    24102410        return print_order(left._gobj,(<Expression>right)._gobj)
     
    35613561        while itr.is_not_equal(sym_set.end()):
    35623562            res.append(new_Expression_from_GEx(SR, itr.obj()))
    35633563            itr.inc()
     3564        res.sort(cmp=lambda x,y: cmp(x,y))
    35643565        return tuple(res)
    35653566
    35663567    def arguments(self):