本文整理汇总了Python中matrix.Matrix.add方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.add方法的具体用法?Python Matrix.add怎么用?Python Matrix.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matrix.Matrix
的用法示例。
在下文中一共展示了Matrix.add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_add_itself_to_other_10x10_matrix
# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import add [as 别名]
def test_should_add_itself_to_other_10x10_matrix(self):
matrix = Matrix(10, 10, 1)
other_matrix = Matrix(10, 10, 1336)
matrix.add(other_matrix)
self.assertEquals(1337, matrix.get_item(9, 9))
示例2: test_should_add_itself_to_other_1x1_matrix
# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import add [as 别名]
def test_should_add_itself_to_other_1x1_matrix(self):
matrix = Matrix(1, 1, 1)
other_matrix = Matrix(1, 1, 1336)
matrix.add(other_matrix)
self.assertEquals(1337, matrix.get_item(0, 0))
示例3: parse
# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import add [as 别名]
def parse(string):
if string in name_space:
value = name_space.get(string)
print value
else:
mat = Matrix()
l = string.replace(' ', '')
if l.find('=') != -1:
if l[2:] not in name_space and l.find('zeros') != -1:
zer = mat.matrix_creation_using_zeros(l[2:])
name_space[str(l[0])] = zer
elif l[3] not in name_space:
matr = mat.matrix_creation(l[2:])
name_space[str(l[0])] = matr
elif l[3] and l[5] in name_space:
if (l.find(',') != -1) or (l.find(';') != -1):
conc = mat.concat(l[2:])
name_space[str(l[0])] = conc
if l.find('+') != -1:
add = mat.add(l)
print add
if l.find("\'") != -1:
tr = mat.transposer(l)
print tr
if l.find('inv') != -1:
inv = mat.inverser(l[-2])
print inv