本文整理汇总了Python中sympy.Q.orthogonal方法的典型用法代码示例。如果您正苦于以下问题:Python Q.orthogonal方法的具体用法?Python Q.orthogonal怎么用?Python Q.orthogonal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Q
的用法示例。
在下文中一共展示了Q.orthogonal方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_MatrixSlice
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_MatrixSlice():
X = MatrixSymbol('X', 4, 4)
B = MatrixSlice(X, (1, 3), (1, 3))
C = MatrixSlice(X, (0, 3), (1, 3))
assert ask(Q.symmetric(B), Q.symmetric(X))
assert ask(Q.invertible(B), Q.invertible(X))
assert ask(Q.diagonal(B), Q.diagonal(X))
assert ask(Q.orthogonal(B), Q.orthogonal(X))
assert ask(Q.upper_triangular(B), Q.upper_triangular(X))
assert not ask(Q.symmetric(C), Q.symmetric(X))
assert not ask(Q.invertible(C), Q.invertible(X))
assert not ask(Q.diagonal(C), Q.diagonal(X))
assert not ask(Q.orthogonal(C), Q.orthogonal(X))
assert not ask(Q.upper_triangular(C), Q.upper_triangular(X))
示例2: test_positive_definite
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_positive_definite():
assert ask(Q.positive_definite(X), Q.positive_definite(X))
assert ask(Q.positive_definite(X.T), Q.positive_definite(X)) is True
assert ask(Q.positive_definite(X.I), Q.positive_definite(X)) is True
assert ask(Q.positive_definite(Y)) is False
assert ask(Q.positive_definite(X)) is None
assert ask(Q.positive_definite(X*Z*X),
Q.positive_definite(X) & Q.positive_definite(Z)) is True
assert ask(Q.positive_definite(X), Q.orthogonal(X))
assert ask(Q.positive_definite(Y.T*X*Y),
Q.positive_definite(X) & Q.orthogonal(Y)) is True
assert ask(Q.positive_definite(Identity(3))) is True
assert ask(Q.positive_definite(ZeroMatrix(3, 3))) is False
assert ask(Q.positive_definite(X+Z), Q.positive_definite(X) &
Q.positive_definite(Z)) is True
assert not ask(Q.positive_definite(-X), Q.positive_definite(X))
示例3: test_refine
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_refine():
assert refine(C*C.T*D, Q.orthogonal(C)).doit() == D
kC = k*C
assert refine(kC*C.T, Q.orthogonal(C)).doit() == k*Identity(n)
assert refine(kC* kC.T, Q.orthogonal(C)).doit() == (k**2)*Identity(n)
示例4: test_orthogonal
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_orthogonal():
assert ask(Q.orthogonal(X), Q.orthogonal(X))
assert ask(Q.orthogonal(X.T), Q.orthogonal(X)) is True
assert ask(Q.orthogonal(X.I), Q.orthogonal(X)) is True
assert ask(Q.orthogonal(Y)) is False
assert ask(Q.orthogonal(X)) is None
assert ask(Q.orthogonal(X*Z*X), Q.orthogonal(X) & Q.orthogonal(Z)) is True
assert ask(Q.orthogonal(Identity(3))) is True
assert ask(Q.orthogonal(ZeroMatrix(3, 3))) is False
assert ask(Q.invertible(X), Q.orthogonal(X))
assert not ask(Q.orthogonal(X+Z), Q.orthogonal(X) & Q.orthogonal(Z))
示例5: test_unitary
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_unitary():
_test_orthogonal_unitary(Q.unitary)
assert ask(Q.unitary(X), Q.orthogonal(X))
示例6: test_refine
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_refine():
assert refine(det(A), Q.orthogonal(A)) == 1
assert refine(det(A), Q.singular(A)) == 0
示例7: test_refine
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_refine():
assert refine(C*C.T*D, Q.orthogonal(C)).doit() == D
示例8: test_refine
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_refine():
assert refine(C.I, Q.orthogonal(C)) == C.T
示例9: MatrixSymbol
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
# sympy
q = MatrixSymbol('q', 1, low_dim) # updated position
p_i = MatrixSymbol('p_i', 1, high_dim) # selected point (high_dim) (P[thisID])
E = MatrixSymbol('E', high_dim,high_dim) # = (e1 e2 e0 0 ...) : 縦ベクトルの列
A_inputEs = MatrixSymbol('A_inputEs', low_dim + 1, low_dim) # ei' の係数行列
A_inputRs = MatrixSymbol('A_inputRs', low_dim, low_dim - 1) # Ri の係数行列
var = (q, p_i, E, A_inputEs, A_inputRs) # 変数のリスト
A = Matrix(np.zeros(high_dim*high_dim).reshape(high_dim,high_dim))
A[0:low_dim + 1, 0:low_dim] = Matrix(A_inputEs)
A[0:low_dim, low_dim:low_dim + 1] = Matrix(A_inputRs)
_E = E * A # = (e1' e2' R1 0 ...) : 更新後の射影ベクトルは縦ベクトルで格納
# 制約解消における前計算
constraints1 = (refine(_E.T * _E, Q.orthogonal(E))).doit()
constraints2 = (refine(E.T * _E, Q.orthogonal(E))).doit()
constraints3 = p_i * _E
# ei' * ej' = δij (クロネッカーのデルタ)
bases_e = Matrix(constraints1[0:low_dim, 0:low_dim] - Matrix(Identity(low_dim)))
_bases_e = bases_e[0,0]**2 + bases_e[0,1]**2 + bases_e[1,1]**2
# Ri * Rj = δij (クロネッカーのデルタ)
bases_r = Matrix(constraints1[low_dim:2 * low_dim - 1, low_dim:2 * low_dim - 1] - Matrix(Identity(low_dim - 1)))
_bases_r = bases_r[0,0]**2
# _Ei.dot(Rj) - sp.Matrix(Ei).dot(Rj),
eMulR = Matrix(constraints1[0:low_dim, low_dim:2 * low_dim - 1] - constraints2[0:low_dim, low_dim:2 * low_dim - 1])
_eMulR = eMulR[0,0]**2 + eMulR[1,0]**2
示例10: test_svd
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_svd():
U, S, V = svd(X)
assert U.shape == S.shape == V.shape == X.shape
assert ask(Q.orthogonal(U))
assert ask(Q.orthogonal(V))
assert ask(Q.diagonal(S))
示例11: test_QR
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import orthogonal [as 别名]
def test_QR():
Q_, R = qr(X)
assert Q_.shape == R.shape == X.shape
assert ask(Q.orthogonal(Q_))
assert ask(Q.upper_triangular(R))