迭代法的收敛性判断
import numpy as np
def is_diagonally_dominant(A):
"""
Check if the matrix A is strictly diagonally dominant.
Parameters:
A : numpy array
Coefficient matrix
Returns:
bool
True if A is strictly diagonally dominant, False otherwise
"""
n = A.shape[0]
for i in range(n):
row_sum = np.sum(np.abs(A[i, :])) - np.abs(A[i, i])
if np.abs(A[i, i]) <= row_sum:
return False
return True2. 判断谱半径条件
示例用法
Last updated