当前位置: 首页>>代码示例>>Python>>正文


Python Matrix.get_item方法代码示例

本文整理汇总了Python中matrix.Matrix.get_item方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.get_item方法的具体用法?Python Matrix.get_item怎么用?Python Matrix.get_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matrix.Matrix的用法示例。


在下文中一共展示了Matrix.get_item方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_should_multiply_itself_by_10x10_matrix

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_multiply_itself_by_10x10_matrix(self):
        matrix = Matrix(10, 10, 2)
        other_matrix = Matrix(10, 10, 1337)

        matrix.multiply(other_matrix)

        self.assertEquals(2 * 1337, matrix.get_item(9, 9))
开发者ID:robinrob,项目名称:flask-hello,代码行数:9,代码来源:test_matrix.py

示例2: test_should_substract_other_10x10_matrix

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_substract_other_10x10_matrix(self):
        matrix = Matrix(10, 10, 1338)
        other_matrix = Matrix(10, 10, 1)

        matrix.subtract(other_matrix)

        self.assertEquals(1337, matrix.get_item(9, 9))
开发者ID:robinrob,项目名称:flask-hello,代码行数:9,代码来源:test_matrix.py

示例3: test_should_multiply_itself_by_1x1_matrix

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_multiply_itself_by_1x1_matrix(self):
        matrix = Matrix(1, 1, 2)
        other_matrix = Matrix(1, 1, 1337)

        matrix.multiply(other_matrix)

        self.assertEquals(2 * 1337, matrix.get_item(0, 0))
开发者ID:robinrob,项目名称:flask-hello,代码行数:9,代码来源:test_matrix.py

示例4: test_should_substract_other_1x1_matrix

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_substract_other_1x1_matrix(self):
        matrix = Matrix(1, 1, 1338)
        other_matrix = Matrix(1, 1, 1)

        matrix.subtract(other_matrix)

        self.assertEquals(1337, matrix.get_item(0, 0))
开发者ID:robinrob,项目名称:flask-hello,代码行数:9,代码来源:test_matrix.py

示例5: test_should_add_itself_to_other_10x10_matrix

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [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))
开发者ID:robinrob,项目名称:flask-hello,代码行数:9,代码来源:test_matrix.py

示例6: test_should_add_itself_to_other_1x1_matrix

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [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))
开发者ID:robinrob,项目名称:flask-hello,代码行数:9,代码来源:test_matrix.py

示例7: test_should_contain_1337_in_last_row_after_transpose

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_contain_1337_in_last_row_after_transpose(self):
        cols = 100
        rows = 1
        matrix = Matrix(cols, rows, 1)
        val = 1337
        matrix.set_item(cols - 1, 0, val)

        matrix.transpose()

        self.assertEquals(val, matrix.get_item(0, cols - 1))
开发者ID:robinrob,项目名称:flask-hello,代码行数:12,代码来源:test_matrix.py

示例8: should_scale_by_factor

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def should_scale_by_factor(self, factor):
        matrix = Matrix(1, 1, 1)

        matrix.scale_by(factor)

        self.assertEquals(factor, matrix.get_item(0, 0))
开发者ID:robinrob,项目名称:flask-hello,代码行数:8,代码来源:test_matrix.py

示例9: test_should_set_and_get_second_row_of_second_column

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_set_and_get_second_row_of_second_column(self):
        matrix = Matrix(2, 2)
        val = 1
        matrix.set_item(1, 1, val)

        self.assertEquals(val, matrix.get_item(1, 1))
开发者ID:robinrob,项目名称:flask-hello,代码行数:8,代码来源:test_matrix.py

示例10: test_should_set_and_get_first_row_of_first_column

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_set_and_get_first_row_of_first_column(self):
        matrix = Matrix(1, 1)
        val = 1
        matrix.set_item(0, 0, val)

        self.assertEquals(val, matrix.get_item(0, 0))
开发者ID:robinrob,项目名称:flask-hello,代码行数:8,代码来源:test_matrix.py

示例11: test_should_transpose_1x1_matrix

# 需要导入模块: from matrix import Matrix [as 别名]
# 或者: from matrix.Matrix import get_item [as 别名]
    def test_should_transpose_1x1_matrix(self):
        matrix = Matrix(1, 1, 1)

        matrix.transpose()

        self.assertEquals(1, matrix.get_item(0, 0))
开发者ID:robinrob,项目名称:flask-hello,代码行数:8,代码来源:test_matrix.py


注:本文中的matrix.Matrix.get_item方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。