Python 我用代数多重网格法迭代(16671667)矩阵,结果只有两层,为什么?
结果是Python 我用代数多重网格法迭代(16671667)矩阵,结果只有两层,为什么?,python,matrix,pyamg,Python,Matrix,Pyamg,结果是 #-*- coding: UTF-8 -*- import numpy as np import scipy as sp from pyamg.aggregation import smoothed_aggregation_solver from scipy.sparse.linalg import cg from scipy.sparse import csr_matrix data = np.loadtxt('G:\data\chipfinal2.txt', dtype=float
#-*- coding: UTF-8 -*-
import numpy as np
import scipy as sp
from pyamg.aggregation import smoothed_aggregation_solver
from scipy.sparse.linalg import cg
from scipy.sparse import csr_matrix
data = np.loadtxt('G:\data\chipfinal2.txt', dtype=float, skiprows=0)
A = data.reshape((1667, 1667))
np.savetxt('chipfinal2_gc.txt', A, fmt="%f", delimiter=",")
print(A)
print(A.shape)
A = csr_matrix(A)
b = sp.rand(A.shape[0])
ml = smoothed_aggregation_solver(A)
M = ml.aspreconditioner(cycle='V')
x, info = cg(A, b, tol=1e-8, maxiter=10, M=M)
cycle_complexity(self, cycle='V')
print(x)
print(ml)
我用代数多重网格法迭代(16671667)矩阵,结果只有两层,为什么?
我希望有一个多层次的结果。我不知道哪里错了。
代码有什么问题吗?非常感谢强>
[ 3389. 3388. 3387. ..., 3548. 3546. 3545.]
...,
[ 3589. 3584. 3579. ..., 3625. 3623. 3622.]
[ 3574. 3570. 3566. ..., 3627. 3625. 3623.]
[ 3563. 3560. 3558. ..., 3629. 3626. 3624.]]
(1667, 1667)
multilevel_solver
Number of Levels: 2
Operator Complexity: 1.000
Grid Complexity: 1.006
Coarse Solver: 'pinv2'
level unknowns nonzeros
0 167 27889 [100.00%]
1 1 1 [ 0.00%]