-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
When I use the "pairwise" method to aggregate nodes in smoothed_aggregation_solver, I encounter the following error:
warn('Implicit conversion of A to CSR', SparseEfficiencyWarning)
Traceback (most recent call last):
File "/root/pyamg/my_test/test_sa.py", line 14, in <module>
ml = pyamg.smoothed_aggregation_solver(A, aggregate='pairwise', presmoother=('jacobi', {'iterations': 5}), postsmoother=('jacobi', {'iterations': 5}))
File "/root/python311/lib/python3.11/site-packages/pyamg/aggregation/aggregation.py", line 272, in smoothed_aggregation_solver
_extend_hierarchy(levels, strength, aggregate, smooth,
File "/root/python311/lib/python3.11/site-packages/pyamg/aggregation/aggregation.py", line 372, in _extend_hierarchy
T, B = fit_candidates(AggOp, B)
File "/root/python311/lib/python3.11/site-packages/pyamg/aggregation/tentative.py", line 118, in fit_candidates
raise TypeError('expected csr_array for argument AggOp')
TypeError: expected csr_array for argument AggOp
My code is as follows:
from scipy.io import mmread
import pyamg
import numpy as np
A = mmread("/root/AMG_mg/data/bcsstk01/bcsstk01.mtx", spmatrix=True)
ml = pyamg.smoothed_aggregation_solver(
A,
aggregate='pairwise',
presmoother=('jacobi', {'iterations': 5}),
postsmoother=('jacobi', {'iterations': 5})
)
b = np.ones((A.shape[0], 1))
accelerated_residuals = []
x = ml.solve(b, tol=1e-6, maxiter=1000, accel='cg', residuals=accelerated_residuals)
print("Number of iterations of preconditioner: {}\n".format(len(accelerated_residuals)))
for i, r in enumerate(accelerated_residuals):
print("residual at iteration {0:2}: {1:^6.2e}".format(i, r))Could you please let me know why this error occurs when using the "pairwise" aggregation method, and how to fix it?
darius513
Metadata
Metadata
Assignees
Labels
No labels