Ticket #9880: trac_9880-stable_operands.rebased-5.5.rc0.patch

File trac_9880-stable_operands.rebased-5.5.rc0.patch, 1.9 KB (added by burcin, 8 years ago)
  • sage/libs/ginac.pxd

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1308253420 -7200
    # Node ID 654539ac75fb05f46dcf318d2887c4faba46542a
    # Parent  efb39ad24731582fa9a0179bfb4aa3a8cb806e1f
    Use printing order for operands access and comparison of symbolic expressions.
    
    diff --git a/sage/libs/ginac.pxd b/sage/libs/ginac.pxd
    a b  
    9292        GEx rhs()                     except +
    9393        GEx lhs()                     except +
    9494        int nops()                    except +
    95         GEx op(int i)                 except +
     95        GEx op "sorted_op" (int i)    except +
    9696        GEx eval(int level)           except +
    9797        GEx evalf(int level, object parent) except +
    9898        GEx conjugate()               except +
     
    533533    py_funcs_struct py_funcs "GiNaC::py_funcs"
    534534
    535535cdef extern from "pynac/order.h":
     536    bint print_order_compare "GiNaC::print_order().compare" \
     537            (GEx left, GEx right) except +
    536538    bint print_order "GiNaC::print_order()" \
    537539            (GEx left, GEx right) except +
    538540    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  
    28622862        return (<Element>left)._cmp(right)
    28632863
    28642864    cdef int _cmp_c_impl(left, Element right) except -2:
    2865         return left._gobj.compare((<Expression>right)._gobj)
     2865        return -print_order_compare((<Expression>right)._gobj,left._gobj)
    28662866
    28672867    cpdef int _cmp_add(left, CommutativeRingElement right) except -2:
    28682868        return print_order(left._gobj,(<Expression>right)._gobj)
     
    40874087        while itr.is_not_equal(sym_set.end()):
    40884088            res.append(new_Expression_from_GEx(SR, itr.obj()))
    40894089            itr.inc()
     4090        res.sort(cmp=lambda x,y: cmp(x,y))
    40904091        return tuple(res)
    40914092
    40924093    def arguments(self):