On Tue, Jun 22, 2010 at 8:25 AM, Rajeev <[email protected]> wrote:
> Hi,
>
> I think following is a bug -
>
> sage: from scipy import sparse
> sage: a = sparse.lil_matrix((10,10))
> sage: a[1,2] = 1
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call
> last)
>
> /home/rajeev/programs/sitabhra/beads/FN_chain/<ipython console> in
> <module>()
>
> /home/rajeev/bin/sage/local/lib/python2.6/site-packages/scipy/sparse/
> lil.pyc in __setitem__(self, index, x)
> 320 self._insertat3(row, data, j, xx)
> 321 else:
> --> 322 raise ValueError('invalid index value: %s' %
> str((i, j)))
> 323
> 324 def _mul_scalar(self, other):
>
> ValueError: invalid index value: (1, 2)
>
> It works in the python shell.
Use Python ints instead of Sage ints:
sage: sage: from scipy import sparse
sage: a = sparse.lil_matrix((10,10))
sage: a[1,2] = 1
sage: sage: a = sparse.lil_matrix((10,10))
sage: sage: a[1,2] = 1
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/wstein/<ipython console> in <module>()
/Users/wstein/sage/build/sage/local/lib/python2.6/site-packages/scipy/sparse/lil.pyc
in __setitem__(self, index, x)
320 self._insertat3(row, data, j, xx)
321 else:
--> 322 raise ValueError('invalid index value: %s' % str((i, j)))
323
324 def _mul_scalar(self, other):
ValueError: invalid index value: (1, 2)
sage: sage: a[1r,2r] = 1
sage: sage: a[int(1),int(2)] = 1
sage: preparser(False)
sage: sage: a[1,2] = 1
------------------------------------------------------------
File "<ipython console>", line 1
sage: a[1,2] = 1
^
SyntaxError: invalid syntax
sage: a[1,2] = 1
....:
sage: a[1,2] = 1
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
--
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