本文整理汇总了Python中symengine.lib.symengine_wrapper.DenseMatrix.get方法的典型用法代码示例。如果您正苦于以下问题:Python DenseMatrix.get方法的具体用法?Python DenseMatrix.get怎么用?Python DenseMatrix.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类symengine.lib.symengine_wrapper.DenseMatrix
的用法示例。
在下文中一共展示了DenseMatrix.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set
# 需要导入模块: from symengine.lib.symengine_wrapper import DenseMatrix [as 别名]
# 或者: from symengine.lib.symengine_wrapper.DenseMatrix import get [as 别名]
def test_set():
i7 = Integer(7)
y = Symbol("y")
g = function_symbol("g", y)
c = 2*I + 3
A = DenseMatrix(2, 2,
[Integer(5), Symbol("x"), function_symbol("f", Symbol("x")), 1 + I])
A.set(0, 0, i7)
assert A.get(0, 0) == i7
A.set(0, 1, y)
assert A.get(0, 1) == y
A.set(1, 0, g)
assert A.get(1, 0) == g
A.set(1, 1, c)
assert A.get(1, 1) == c
示例2: test_get
# 需要导入模块: from symengine.lib.symengine_wrapper import DenseMatrix [as 别名]
# 或者: from symengine.lib.symengine_wrapper.DenseMatrix import get [as 别名]
def test_get():
A = DenseMatrix(2, 2, [1, 2, 3, 4])
assert A.get(0, 0) == 1
assert A.get(0, 1) == 2
assert A.get(1, 1) == 4
a = Symbol("a")
b = Symbol("b")
c = Symbol("c")
d = Symbol("d")
A = DenseMatrix(2, 2, [a, b, c, d])
assert A.get(0, 0) == a
assert A.get(1, 0) == c
assert A.get(1, 1) == d
示例3: test_DenseMatrix_symbols
# 需要导入模块: from symengine.lib.symengine_wrapper import DenseMatrix [as 别名]
# 或者: from symengine.lib.symengine_wrapper.DenseMatrix import get [as 别名]
def test_DenseMatrix_symbols():
x, y, z = symbols("x y z")
D = DenseMatrix(4, 4,
[1, 0, 1, 0,
0, z, y, 0,
z, 1, x, 1,
1, 1, 0, 0])
assert D.get(1, 2) == y
示例4: test_get
# 需要导入模块: from symengine.lib.symengine_wrapper import DenseMatrix [as 别名]
# 或者: from symengine.lib.symengine_wrapper.DenseMatrix import get [as 别名]
def test_get():
A = DenseMatrix([[1, 2], [3, 4]])
assert A.get(0, 0) == 1
assert A.get(0, 1) == 2
assert A.get(1, 1) == 4
a = Symbol("a")
b = Symbol("b")
c = Symbol("c")
d = Symbol("d")
A = DenseMatrix(2, 2, [a, b, c, d])
assert A.get(0, 0) == a
assert A.get(1, 0) == c
assert A.get(1, 1) == d
assert A.get(-1, 0) == c
assert A.get(-1, -1) == d
raises(IndexError, lambda: A.get(2, 0))
raises(IndexError, lambda: A.get(0, 2))
raises(IndexError, lambda: A.get(-3, 0))