Ask Your Question
1

large matrices

asked 2013-05-08 15:09:06 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

when I write

matrix(CDF,dim)

with dim <=19 the result is a dim times dim matrix with all zero elements. If on the other hand dim is equal or larger then 20 then, in the command line I get the outout

20 x 20 dense matrix over Complex Double Field

in the browser with the the Typeset button selected I obtain a large matrix with all zero elements in the pretty_print style, but in the browser without the Typeset selected I get the following error message

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_31.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGltPTIwCm1hdHJpeChDREYsZGltKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/private/var/folders/Xg/Xg29Zoq9FceX+ITv5eX+u++++TU/-Tmp-/tmptw3cJO/___code___.py", line 4, in <module>
exec compile(u'matrix(CDF,dim)
  File "", line 1, in <module>

  File "matrix0.pyx", line 1729, in sage.matrix.matrix0.Matrix.__repr__ (sage/matrix/matrix0.c:9374)
  File "/Applications/sage/local/lib/python2.7/site-packages/sage/misc/sageinspect.py", line 1915, in sage_getvariablename
for frame in inspect.stack():
  File "/Applications/sage/local/lib/python/inspect.py", line 1054, in stack
return getouterframes(sys._getframe(1), context)
  File "/Applications/sage/local/lib/python/inspect.py", line 1032, in getouterframes
framelist.append((frame,) + getframeinfo(frame, context))
  File "/Applications/sage/local/lib/python/inspect.py", line 1007, in getframeinfo
lines, lnum = findsource(frame)
  File "/Applications/sage/local/lib/python/inspect.py", line 528, in findsource
if not sourcefile and file[0] + file[-1] != '<>':
IndexError: string index out of range

Is it only my problem?

('Sage Version 5.9, Release Date: 2013-04-30', Firefox 20.0/Safari 5.1.8, osx 10.6.8)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-05-08 16:46:20 +0100

tmonteil gravatar image

updated 2013-05-08 16:48:29 +0100

Concerning your first remark, even if Sage answers

20 x 20 dense matrix over Complex Double Field

you get a true 20 x 20 matrix with zero entries in the Complex Double Field, as you can check by typing:

sage: dim = 20
sage: matrix(CDF,dim)[2,3]
0.0

What you see, is just a representation of the object: actually Sage gives you the result of the method matrix(CDF,dim).__repr__(). If you want to see all the entries of your matrix, you can type:

sage: print matrix(CDF,dim).str()
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]
[0.0 0.0 0.0 0 ...
(more)
edit flag offensive delete link more

Comments

Yep, I was working with some "big matrix" (some 50x50) and I have the same bug (sage 5.8 on a windows Mozilla firefox)... Seems SAGE is not happy to print a matrix bigger than a 19x19 (but has no problem if is just a list).

gvdr gravatar imagegvdr ( 2013-05-28 19:40:41 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-08 15:09:06 +0100

Seen: 1,958 times

Last updated: May 08 '13