本文整理汇总了Python中sympy.Q.fullrank方法的典型用法代码示例。如果您正苦于以下问题:Python Q.fullrank方法的具体用法?Python Q.fullrank怎么用?Python Q.fullrank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Q
的用法示例。
在下文中一共展示了Q.fullrank方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_invertible
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import fullrank [as 别名]
def test_invertible():
assert ask(Q.invertible(X), Q.invertible(X))
assert ask(Q.invertible(Y)) is False
assert ask(Q.invertible(X*Y), Q.invertible(X)) is False
assert ask(Q.invertible(X*Z), Q.invertible(X)) is None
assert ask(Q.invertible(X*Z), Q.invertible(X) & Q.invertible(Z)) is True
assert ask(Q.invertible(X.T)) is None
assert ask(Q.invertible(X.T), Q.invertible(X)) is True
assert ask(Q.invertible(X.I)) is True
assert ask(Q.invertible(Identity(3))) is True
assert ask(Q.invertible(ZeroMatrix(3, 3))) is False
assert ask(Q.invertible(X), Q.fullrank(X) & Q.square(X))
示例2: test_positive_definite
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import fullrank [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.fullrank(Y)) is True
assert not ask(Q.positive_definite(Y.T*X*Y), Q.positive_definite(X))
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_fullrank
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import fullrank [as 别名]
def test_fullrank():
assert ask(Q.fullrank(X), Q.fullrank(X))
assert ask(Q.fullrank(X.T), Q.fullrank(X)) is True
assert ask(Q.fullrank(X)) is None
assert ask(Q.fullrank(Y)) is None
assert ask(Q.fullrank(X*Z), Q.fullrank(X) & Q.fullrank(Z)) is True
assert ask(Q.fullrank(Identity(3))) is True
assert ask(Q.fullrank(ZeroMatrix(3, 3))) is False
assert ask(Q.invertible(X), ~Q.fullrank(X)) == False
示例4: test_invertible_fullrank
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import fullrank [as 别名]
def test_invertible_fullrank():
assert ask(Q.invertible(X), Q.fullrank(X))
示例5: Symbol
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import fullrank [as 别名]
""" Linear Regression """
from sympy import MatrixSymbol, Q, ZeroMatrix, assuming
from sympy import Symbol
n = Symbol('n')
m = Symbol('m')
X = MatrixSymbol('X', n, m)
y = MatrixSymbol('y', n, 1)
beta = (X.T*X).I * X.T*y
from computations.matrices.blas import SYRK, GEMM
from computations.matrices.lapack import POSV
c = (POSV(X.T*X, X.T*y)
+ SYRK(1.0, X.T, 0.0, ZeroMatrix(m, m))
+ GEMM(1.0, X.T, y, 0.0, ZeroMatrix(n, 1)))
assumptions = Q.fullrank(X), Q.real_elements(X), Q.real_elements(y)
示例6: Symbol
# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import fullrank [as 别名]
from sympy.matrices.expressions import MatrixSymbol, Transpose
from sympy import Symbol, Q
n, k = Symbol('n'), Symbol('k')
mu = MatrixSymbol('mu', n, 1)
Sigma = MatrixSymbol('Sigma', n, n)
H = MatrixSymbol('H', k, n)
R = MatrixSymbol('R', k, k)
data = MatrixSymbol('data', k, 1)
newmu = mu + Sigma*H.T * (R + H*Sigma*H.T).I * (H*mu - data)
newSigma= Sigma - Sigma*H.T * (R + H*Sigma*H.T).I * H * Sigma
newSigma = -1.0*Sigma*H.T*(H*Transpose(H*Sigma) + R).I*H*Sigma + Sigma
newmu = Sigma*H.T*(H*Transpose(H*Sigma) + R).I*(-1.0*data + H*mu) + mu
assumptions = (Q.positive_definite(Sigma), Q.symmetric(Sigma),
Q.positive_definite(R), Q.symmetric(R), Q.fullrank(H))
inputs = mu, Sigma, H, R, data
outputs = newmu, newSigma