On Oct 17, 7:19 am, Eric <[email protected]> wrote:
> > What are the coefficients of the matrix? In which ring do they live?
>
> > If m is the matrix, please post the result of m.parent()
>
> Every element in the 9x9 determinant is a polynomial in some variable
> x with integer coefficients. Doing print m.parent() gives
>
> Full MatrixSpace of 5 by 5 dense matrices over Symbolic Ring

In that case you almost certainly get better performance by using

P.<x>=PolynomialRing(ZZ)

or

P.<x>=PolynomialRing(QQ)

because the "symbolic ring" code is not going to be particularly
optimized for polynomials over Z or linear algebra. I can confirm your
error, by the way. The following code triggers it:

def rp(d,B):
    return sum([ZZ.random_element(-B,B+1)*x^i for i in xrange(d+1)])
M=matrix(9,9,[rp(10,50) for i in range(81)])
M.determinant()

In the same session doing:

P.<x>=PolynomialRing(ZZ)
M=matrix(9,9,[rp(10,50) for i in range(81)])
M.determinant()

finishes within 0.01 second.

The traceback for symbolic matrix is suspect: It looks like it's
trying to compute the characteristic polynomial of the matrix in order
to find the determinant. That seems like a rather silly approach, but
it is special-cased, so someone must have thought it's good/efficient/
convenient to do so.

By the way, ending up with the "Available restarts" prompt is
definitely an error and I cannot reproduce that. Does that always
happen for you? Can you give more details on how that happens?

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to