File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,22 @@ def __getattr__(self, name):
205
205
206
206
def __delattr__ (self , name ):
207
207
del self .__dict__ [name ]
208
+
209
+ def __getitem__ (self ,key ):
210
+ if (isinstance (key , int )):
211
+ return self .matrix .data [key ]
212
+ if (isinstance (key ,(list ,tuple )) and len (key )== 2 ):
213
+ return self .matrix .data [key [0 ]][key [1 ]]
214
+ else :
215
+ print ("MultiDimensional Matrix in Works" )
216
+
217
+ def __setitem__ (self ,key ,value ):
218
+ if (isinstance (key , int )):
219
+ self .matrix .data [key ]= value
220
+ if (isinstance (key ,(list ,tuple )) and len (key )== 2 ):
221
+ self .matrix .data [key [0 ]][key [1 ]]= value
222
+ else :
223
+ print ("MultiDimensional Matrix in Works" )
208
224
# *------- Basic Operations on Matrices -----------------------------------*
209
225
210
226
# *------- Add Matrix -----------------------------------------------------*
You can’t perform that action at this time.
0 commit comments