Ticket #9880: trac_9880_pynac_order.take2.rebased-5.5.rc0.patch

File trac_9880_pynac_order.take2.rebased-5.5.rc0.patch, 2.1 KB (added by burcin, 9 years ago)
  • sage/libs/ginac.pxd

    # HG changeset patch
    # User Jean-Pierre Flori <flori@enst.fr>
    # Date 1298990841 -3600
    # Node ID a91cdf2c0096f4f7db07dacef53469baf76ff647
    # Parent  960df3da463d46c98242b364071cc1aaf35ed8b5
    Trac #9880: Give Sage access to the PyNaC printing order
    
    This allows automated doctests to check the PyNaC printing
    sort order.
    
    diff --git a/sage/libs/ginac.pxd b/sage/libs/ginac.pxd
    a b  
    531531        object (*py_rational_power_parts)(object basis, object exp)
    532532
    533533    py_funcs_struct py_funcs "GiNaC::py_funcs"
     534
     535cdef extern from "pynac/order.h":
     536    bint print_order "GiNaC::print_order()" \
     537            (GEx left, GEx right) except +
     538    bint print_order_mul "GiNaC::print_order_mul()" \
     539            (GEx left, GEx right) except +
  • sage/symbolic/expression.pxd

    diff --git a/sage/symbolic/expression.pxd b/sage/symbolic/expression.pxd
    a b  
    22
    33from sage.structure.element cimport CommutativeRingElement
    44
    5 
    65cdef class Expression(CommutativeRingElement):
    76    cdef GEx _gobj
    87    cdef Expression coerce_in(self, z)
     
    1312    cpdef bint is_infinity(self)
    1413    cpdef object pyobject(self)
    1514    cpdef Expression _subs_expr(self, expr)
     15    cpdef int _cmp_add(left, CommutativeRingElement right) except -2
     16    cpdef int _cmp_mul(left, CommutativeRingElement right) except -2
    1617   
    1718cpdef bint is_Expression(x)
    1819cdef Expression new_Expression_from_GEx(parent, GEx juice)
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    28642864    cdef int _cmp_c_impl(left, Element right) except -2:
    28652865        return left._gobj.compare((<Expression>right)._gobj)
    28662866
     2867    cpdef int _cmp_add(left, CommutativeRingElement right) except -2:
     2868        return print_order(left._gobj,(<Expression>right)._gobj)
     2869
     2870    cpdef int _cmp_mul(left, CommutativeRingElement right) except -2:
     2871        return print_order_mul(left._gobj,(<Expression>right)._gobj)
     2872
    28672873    def __pow__(self, exp, ignored):
    28682874        """
    28692875        Return self raised to the power of exp.