无法完成 B 的因式分解,未计算特征值或特征向量
The factorization of B could not be completed and no eigenvalues or eigenvectors were computed
我正在尝试用 A 和 B 求解特征值方程 A x = λ B x 为 16×16 方厄密矩阵。在 python (Spyder4) 上使用 linalg 库,我收到一条错误消息:
LinAlgError: The leading minor of order 12 of B is not positive definite.
The factorization of B could not be completed and no eigenvalues or eigenvectors were computed.
这是我使用的矩阵和命令:
H = np.array([[a11,0,0,0,0,0,0,0,a19,a110,a111,a112,a113,a114,a115,a116]
[0,a22,0,0,0,0,0,0,a29,a210,a211,a212,a213,a214,a215,a216],
[0,0,a33,0,0,0,0,0,a39,a310,a311,a312,a313,a314,a315,a316],
[0,0,0,a44,0,0,0,0,a49,a410,a411,a412,a413,a414,a415,a416],
[0,0,0,0,a55,0,0,0,a59,a510,a511,a512,a513,a514,a515,a516],
[0,0,0,0,0,a66,0,0,a69,a610,a611,a612,a613,a614,a615,a616],
[0,0,0,0,0,0,a77,0,a79,a710,a711,a712,a713,a714,a715,a716],
[0,0,0,0,0,0,0,a88,a89,a810,a811,a812,a813,a814,a815,a816],
[0,0,0,0,0,0,0,0,a99,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,a1010,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,a1111,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,a1212,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,a1313,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,a1414,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,a1515,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,a1616]])
S = np.array([[1,0,0,0,0,0,0,0,b19,b110,b111,b112,b113,b114,b115,b116],
[0,1,0,0,0,0,0,0,b29,b210,b211,b212,b213,b214,b215,b216],
[0,0,1,0,0,0,0,0,b39,b310,b311,b312,b313,b314,b315,b316],
[0,0,0,1,0,0,0,0,b49,b410,b411,b412,b413,b414,b415,b416],
[0,0,0,0,1,0,0,0,b59,b510,b511,b512,b513,b514,b515,b516],
[0,0,0,0,0,1,0,0,b69,b610,b611,b612,b613,b614,b615,b616],
[0,0,0,0,0,0,1,0,b79,b710,b711,b712,b713,b714,b715,b716],
[0,0,0,0,0,0,0,1,b89,b810,b811,b812,b813,b814,b815,b816],
[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]])
lamda, x = lg.eigh(H, S, lower=False, eigvals_only=False)
print("Eigenvalues")
print(lamda)
矩阵中的变量是用户输入(一些 -ve 值和复数)。
特征值是在我使用“linalg.eig
”命令时计算的,但由于我的实际矩阵是对称的,我正在尝试使用 eigh 命令。
有没有人遇到过这个问题and/or 提示错误是什么?
谢谢
文档说第二个参数必须是复数厄尔米特矩阵或实数对称正定正矩阵。如果你的 b
很复杂,那么这个论点似乎都不是。
文档还说这个方法抛出一个 LinAlgError
:
If eigenvalue computation does not converge, an error occurred, or b
matrix is not definite positive. Note that if input matrices are not
symmetric or Hermitian, no error will be reported but results will be
wrong.
我正在尝试用 A 和 B 求解特征值方程 A x = λ B x 为 16×16 方厄密矩阵。在 python (Spyder4) 上使用 linalg 库,我收到一条错误消息:
LinAlgError: The leading minor of order 12 of B is not positive definite. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed.
这是我使用的矩阵和命令:
H = np.array([[a11,0,0,0,0,0,0,0,a19,a110,a111,a112,a113,a114,a115,a116]
[0,a22,0,0,0,0,0,0,a29,a210,a211,a212,a213,a214,a215,a216],
[0,0,a33,0,0,0,0,0,a39,a310,a311,a312,a313,a314,a315,a316],
[0,0,0,a44,0,0,0,0,a49,a410,a411,a412,a413,a414,a415,a416],
[0,0,0,0,a55,0,0,0,a59,a510,a511,a512,a513,a514,a515,a516],
[0,0,0,0,0,a66,0,0,a69,a610,a611,a612,a613,a614,a615,a616],
[0,0,0,0,0,0,a77,0,a79,a710,a711,a712,a713,a714,a715,a716],
[0,0,0,0,0,0,0,a88,a89,a810,a811,a812,a813,a814,a815,a816],
[0,0,0,0,0,0,0,0,a99,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,a1010,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,a1111,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,a1212,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,a1313,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,a1414,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,a1515,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,a1616]])
S = np.array([[1,0,0,0,0,0,0,0,b19,b110,b111,b112,b113,b114,b115,b116],
[0,1,0,0,0,0,0,0,b29,b210,b211,b212,b213,b214,b215,b216],
[0,0,1,0,0,0,0,0,b39,b310,b311,b312,b313,b314,b315,b316],
[0,0,0,1,0,0,0,0,b49,b410,b411,b412,b413,b414,b415,b416],
[0,0,0,0,1,0,0,0,b59,b510,b511,b512,b513,b514,b515,b516],
[0,0,0,0,0,1,0,0,b69,b610,b611,b612,b613,b614,b615,b616],
[0,0,0,0,0,0,1,0,b79,b710,b711,b712,b713,b714,b715,b716],
[0,0,0,0,0,0,0,1,b89,b810,b811,b812,b813,b814,b815,b816],
[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]])
lamda, x = lg.eigh(H, S, lower=False, eigvals_only=False)
print("Eigenvalues")
print(lamda)
矩阵中的变量是用户输入(一些 -ve 值和复数)。
特征值是在我使用“linalg.eig
”命令时计算的,但由于我的实际矩阵是对称的,我正在尝试使用 eigh 命令。
有没有人遇到过这个问题and/or 提示错误是什么? 谢谢
文档说第二个参数必须是复数厄尔米特矩阵或实数对称正定正矩阵。如果你的 b
很复杂,那么这个论点似乎都不是。
文档还说这个方法抛出一个 LinAlgError
:
If eigenvalue computation does not converge, an error occurred, or b matrix is not definite positive. Note that if input matrices are not symmetric or Hermitian, no error will be reported but results will be wrong.