On Wednesday, December 5, 2012 1:56:55 PM UTC, Jason Grout wrote:
>
> On 12/5/12 7:46 AM, John Cremona wrote: 
> > I don't know why this takes so long: 
> > 
> > I have a field F (a snumber field of high degree, 288 in fact) and 
> > want to create a 100x100 matrix over F from a list of 100 lists of 100 
> > elements of F, while I will call "entries".  If I do 
> > 
> > M = Matrix(entries) 
> > 
> > which certainly works fine with smaller examples, then I get tired of 
> > waiting (after 10 or 15 minutes) and cannot even interrupt with 
> > Ctrl-C.  But if I do 
> > 
> > M = copy(MatrixSpace(F,100).zero_matrix()) 
> > for i in range(100): 
> >     for j in range(100): 
> >        M[i,j] = entries[i,j] 
> > 
> > it works in a few seconds.  So what is going wrong with the first 
> (simpler) way? 
>
> If you just do Matrix(entries), it tries to guess the right base ring 
> (using the Sequence() command, IIRC).  In the second example, you are 
> explicitly telling Sage the base ring.  I wonder if that is what is 
> going on.  To check, can you try doing: 
>
> matrix(F, entries) 
>
>
That is slow too.  Try


Q1092.<z>=CyclotomicField(1092)
entries = [[Q1092.zero_element() for i in range(100)] for j in range(100)]
M=Matrix(Q1092,entries)

which takes a long time (*) and cannot be interrupted with Ctrl-C.

John

(*) I have not yet had the patience to wait until it completes!

 

> Thanks, 
>
> Jason 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to