本文整理汇总了Python中sympy.Matrix.is_lower方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.is_lower方法的具体用法?Python Matrix.is_lower怎么用?Python Matrix.is_lower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Matrix
的用法示例。
在下文中一共展示了Matrix.is_lower方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_LUdecomp
# 需要导入模块: from sympy import Matrix [as 别名]
# 或者: from sympy.Matrix import is_lower [as 别名]
def test_LUdecomp():
testmat = Matrix([[0,2,5,3],
[3,3,7,4],
[8,4,0,2],
[-2,6,3,4]])
L,U,p = testmat.LUdecomposition()
assert L.is_lower()
assert U.is_upper()
assert (L*U).permuteBkwd(p)-testmat == zeros(4)
testmat = Matrix([[6,-2,7,4],
[0,3,6,7],
[1,-2,7,4],
[-9,2,6,3]])
L,U,p = testmat.LUdecomposition()
assert L.is_lower()
assert U.is_upper()
assert (L*U).permuteBkwd(p)-testmat == zeros(4)
x, y, z = Symbol('x'), Symbol('y'), Symbol('z')
M = Matrix(((1, x, 1), (2, y, 0), (y, 0, z)))
L, U, p = M.LUdecomposition()
assert L.is_lower()
assert U.is_upper()
assert (L*U).permuteBkwd(p)-M == zeros(3)
mL = Matrix((
(1,0,0),
(2,3,0),
))
assert mL.is_lower() == True
assert mL.is_upper() == False
mU = Matrix((
(1,2,3),
(0,4,5),
))
assert mU.is_lower() == False
assert mU.is_upper() == True
# test FF LUdecomp
M = Matrix([[1, 3, 3],
[3, 2, 6],
[3, 2, 2]])
P, L, Dee, U = M.LUdecompositionFF()
assert P*M == L*Dee.inv()*U
M = Matrix([[1, 2, 3, 4],
[3, -1, 2, 3],
[3, 1, 3, -2],
[6, -1, 0, 2]])
P, L, Dee, U = M.LUdecompositionFF()
assert P*M == L*Dee.inv()*U
M = Matrix([[0, 0, 1],
[2,3,0],
[3, 1, 4]])
P, L, Dee, U = M.LUdecompositionFF()
assert P*M == L*Dee.inv()*U
示例2: test_is_lower
# 需要导入模块: from sympy import Matrix [as 别名]
# 或者: from sympy.Matrix import is_lower [as 别名]
def test_is_lower():
a = Matrix([[1,2,3]])
assert a.is_lower() == False
a = Matrix([[1],[2],[3]])
assert a.is_lower() == True