#4812: [with patch, needs review] matrix_plot is broken for matrices with
"complicated" base rings
----------------------+-----------------------------------------------------
Reporter: mhansen | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-3.2.2
Component: graphics | Keywords:
----------------------+-----------------------------------------------------
{{{
Hello all,
I'm trying to run the following code:
s = 7
s2 = 2^s
P.<x> = GF(2)[]
M = matrix(parent(x),s2)
for i in range(s2):
p = (1+x)^i
pc = p.coeffs()
a = pc.count(1)
for j in range(a):
idx = pc.index(1)
M[i,idx+j] = pc.pop(idx)
matrixprogram = matrix_plot(M,cmap='Greys')
...but with 3.2.1, it complains:
---------------------------------------------------------------------------
ValueError Traceback (most recent call
last)
/home/drake/.sage/temp/klee/11408/_tmp_foo_sage_2.py in <module>()
16 M[i,idx+j] = pc.pop(idx)
17
---> 18 matrixprogram = matrix_plot(M,cmap='Greys') 19
20
/opt/sage-3.2.1/local/lib/python2.5/site-packages/sage/plot/misc.pyc in
wrapper(*args, **kwds)
279 options['__original_opts'] = kwds
280 options.update(kwds)
--> 281 return func(*args, **options)
282
283
/opt/sage-3.2.1/local/lib/python2.5/site-
packages/sage/plot/matrix_plot.pyc in matrix_plot(mat, **options)
123 xrange = (0, len(mat[0]))
124 yrange = (0, len(mat))
--> 125 xy_data_array = [array(r, dtype=float) for r in mat]
126
127 g = Graphics()
/opt/sage-3.2.1/local/lib/python2.5/site-
packages/numpy/oldnumeric/functions.pyc in array(sequence, typecode, copy,
savespace, dtype)
77 def array(sequence, typecode=None, copy=1, savespace=0,
dtype=None):
78 dtype = convtypecode2(typecode, dtype)
---> 79 return mu.array(sequence, dtype, copy=copy)
80
81 def sarray(a, typecode=None, copy=False, dtype=None):
ValueError: setting an array element with a sequence.
I know this used to work, because the example distributed with SageTeX
has it! See example.{tex,pdf} from
http://tug.ctan.org/tex-archive/macros/latex/contrib/sagetex/. Is the
above code still considered correct, or is there now a problem with
matrix_plot? The matrix M above has all 1's and 0's despite its parent
being GF(2)[x], so perhaps this is a coercion thing?
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4812>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en
-~----------~----~----~----~------~----~------~--~---