Ticket #13691: trac_13691_Sum.patch

File trac_13691_Sum.patch, 988 bytes (added by vbraun, 8 years ago)

Initial patch

  • sage/numerical/mip.pyx

    # HG changeset patch
    # User Volker Braun <vbraun.name@gmail.com>
    # Date 1353711284 0
    # Node ID ce3f0b5cd53fe83b6f0239068165f5acf8815105
    # Parent  00e09c435e06b44c8f4ce7fbac399245b0a2389b
    Fix bug in the (deprecated) Sum function
    
    diff --git a/sage/numerical/mip.pyx b/sage/numerical/mip.pyx
    a b  
    20742074        sage: Sum([])
    20752075        doctest:...: DeprecationWarning: use MixedIntegerLinearProgram.sum() instead
    20762076        See http://trac.sagemath.org/13646 for details.
     2077
     2078        sage: p = MixedIntegerLinearProgram()
     2079        sage: x = p.new_variable()
     2080        sage: Sum([ x[0]+x[1], x[1]+x[2], x[2]+x[3] ])   # deprecation is only shown once
     2081        x_0 + 2*x_1 + 2*x_2 + x_3
    20772082    """
    20782083    from sage.misc.superseded import deprecation
    20792084    deprecation(13646, 'use MixedIntegerLinearProgram.sum() instead')
    20802085    if not x:
    20812086        return None
    2082     parent = x[0]
     2087    parent = x[0].parent()
    20832088    return parent.sum(x)