---------- Forwarded message ----------
From: Christian Szegedy <christian.szeg...@gmail.com>
Date: Thu, Dec 17, 2009 at 12:26 AM
Subject: sage bug report
To: William Stein <wst...@gmail.com>


Simple 8X8 matrix determinant computation makes sage hang:

load x.py
test()

On the other hand if m.det() is replaced m.inverse(), it runs through
in no time.

The determinant of the matrix is a sum of two monomials:
x1*x4*x5*x6 + x0*x2*x3*x7, but even the most primitive implementation
(summing all 8! permutations,most of them zero) should run through in
much less than minute.



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
def genVar(i):
    return "x%i"%i

def matrix_from_hash(h):
    R=FractionField(PolynomialRing(GF(2),",".join(map(genVar,range(0,10)))))
    h2 = {}
    for p in h:
        x=R.zero_element()
        for v in h[p]:
            x=x+R.gens()[v]
        h2[p] = x
        h2[p[1],p[0]] = x
    return matrix(h2,sparse=False)

def test():
    m = matrix_from_hash({(0, 1): [0, 5], (1, 2): [0], (5, 6): [2], (6, 7): [1], (4, 5): [4], (0, 7): [1, 7], (0, 6): [2, 1], (0, 5): [4, 2], (0, 4): [3, 4], (2, 3): [6], (0, 3): [6, 3], (3, 4): [3], (0, 2): [0, 6]})
    print m
    print(m.inverse())


            

Reply via email to