Ticket #9717: polybori-0.6.4.p2.patch

File polybori-0.6.4.p2.patch, 1.6 KB (added by malb, 11 years ago)

Sage library patch fixing an issue with substitute_variable()

  • sage/rings/polynomial/pbori.pyx

    # HG changeset patch
    # User Martin Albrecht <martinralbrecht@googlemail.com>
    # Date 1281444370 -3600
    # Node ID a46f9f3374608411e8b4fb5940444833d06b1173
    # Parent  848eec53713fb713902dc549ae5cd9575578c5d5
    #9717 fixing parent ring in substitute_variable() (fix due to Alexander Dreyer)
    
    diff -r 848eec53713f -r a46f9f337460 sage/rings/polynomial/pbori.pyx
    a b  
    70857085    ``var(i)`` is replaced by ``vec[i]`` in ``poly``.
    70867086
    70877087    EXAMPLE::
     7088
    70887089        sage: B.<a,b,c> = BooleanPolynomialRing()
    70897090        sage: f = a*b + c + 1
    70907091        sage: from polybori import substitute_variables
     
    70967097        a*b + a + b + c
    70977098        sage: substitute_variables([a+1,b+1,B(0)],f)
    70987099        a*b + a + b
     7100
     7101    Substitution is also allowed with different rings::
     7102
     7103        sage: B.<a,b,c> = BooleanPolynomialRing()
     7104        sage: f = a*b + c + 1
     7105        sage: B.<w,x,y,z> = BooleanPolynomialRing(order='deglex')
     7106
     7107        sage: from polybori import substitute_variables
     7108        sage: substitute_variables([x,y,z], f) * w
     7109        w*x*y + w*z + w
     7110
    70997111    """
    71007112    cdef BooleanPolynomialVector _vec
    71017113
     
    71057117        _vec = BooleanPolynomialVector()
    71067118        for f in vec:
    71077119            _vec.append(f)
    7108     return new_BP_from_PBPoly((<BooleanPolynomialRing>poly._parent), pb_substitute_variables(_vec._vec, poly._pbpoly))
     7120    return new_BP_from_PBPoly((<BooleanPolynomialRing>_vec._parent), pb_substitute_variables(_vec._vec, poly._pbpoly))
    71097121
    71107122
    71117123def set_random_seed(seed):