[SciPy-user] Most Basic of Matrix

quendor at nandor.net quendor at nandor.net
Sat Sep 25 09:22:14 CDT 2004


I forgive in advance what will probably be the lamest of questions. I  
am new to scipy. I can select an element of a matrix, but  seem unable  
to change the element. Am I using the wrong API?

When I run the following code:

#!/usr/bin/python
from scipy import *

A = mat([[1,2],[3,4]])
print A[1,1]
A[1,1] = 100



I get the following output:

4
Traceback (most recent call last):
   File "./test.py", line 6, in ?
     A[1,1] = 100
   File  
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
python2.3/site-packages/Numer\
ic/Matrix.py", line 183, in __setitem__
     value = value[0,0]
IndexError: invalid index 



More information about the SciPy-user mailing list