本文整理汇总了Python中Matrix.Matrix.data[i][j]方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.data[i][j]方法的具体用法?Python Matrix.data[i][j]怎么用?Python Matrix.data[i][j]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix.Matrix
的用法示例。
在下文中一共展示了Matrix.data[i][j]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processCommand
# 需要导入模块: from Matrix import Matrix [as 别名]
# 或者: from Matrix.Matrix import data[i][j] [as 别名]
def processCommand(mList,line):
"""
@summary: Parsea una linea de comandos y encadena los comandos necesarios para
procesarlos
@param mList: lista de matrices utilizadas en los procesos
@type mList: list(Matrix())
@status: testing
@version: 1
@raise IOException: si el archivo no se consigue
@param linea: linea que posee el comando y sus argumentos
"""
# Separar las partes de la linea
sections = line.split(None,1)
cmd = sections[0]
args = sections[1].split()
if cmd == "READ":
fileName = args[0]
mNum = parseNum(args[1])
try:
iFile = open(fileName)
params = iFile.readline()
(row, col) = [int(s) for s in params.split()]
out = Matrix(row,col)
for i in range(row):
rowElems = iFile.readline().split()
for j in range(col):
out.data[i][j] = int(rowElems[j])
except IOError:
print("IOERROR READ")
sys.exit(-1)
mList[mNum] = out
return out
if cmd == "NEW":
row = int(args[0])
col = int(args[1])
mNum = parseNum(args[2])
out = Matrix(row,col)
mList[mNum] = out
return out
if cmd == "GET":
mNum = parseNum(args[0])
row = int(args[1])
col = int(args[2])
return mList[mNum].get(row,col)
if cmd == "SET":
mNum = parseNum(args[0])
row = int(args[1])
col = int(args[2])
val = int(args[3])
mList[mNum].set(row,col,val)
return mList[mNum]
if cmd == "ADD":
mNum0 = parseNum(args[0])
mNum1 = parseNum(args[1])
mNum2 = parseNum(args[2])
out = mList[mNum0].add(mList[mNum1])
mList[mNum2] = out
return out
if cmd == "SCALAR":
mNum0 = parseNum(args[0])
scalar = int(args[1])
mNum1 = parseNum(args[2])
out = mList[mNum0].mult_scalar(scalar)
mList[mNum1] = out
return out
if cmd == "TRANSPOSE":
mNum0 = parseNum(args[0])
mNum1 = parseNum(args[1])
out = mList[mNum0].transpose()
mList[mNum1] = out
return out
if cmd == "MULTIPLY":
mNum0 = parseNum(args[0])
mNum1 = parseNum(args[1])
mNum2 = parseNum(args[2])
#.........这里部分代码省略.........