Please add complex solver.

40 views
Skip to first unread message

HEMMI, Shigeru

unread,
Jul 8, 2010, 9:40:11 AM7/8/10
to pyamg-user
Hello PyAMG developers, I believe PyAMG is much excellent to solve
sparse linear systems.
Thank you very much.

As somebodies posted in the issues 54 & 61, I am eagerly want to have
sparse complex solvers.
Please give higher priority to these issues.
Best regards,


Jacob

unread,
Jul 9, 2010, 7:07:24 PM7/9/10
to pyamg-user
Hi,

The smoothed aggregation solvers and Krylov solvers do currently
support complex arithmetic. The Ruge-Stuben solver, however, does
not. The setup and use of the smoothed aggregation and Krylov solvers
is the exact same for both complex-valued matrices and real-valued
matrices.

Thanks,

Jacob

HEMMI, Shigeru

unread,
Jul 12, 2010, 8:26:27 AM7/12/10
to pyamg...@googlegroups.com
Dear Jacob,

Thanks for the support.
I confirmed the smoothed aggregation and Krylov solvers can handle
complex numbers at your suggestion.

However, I encounterd a new non-convergent problem:
I downloaded a sample complex-valued matrix, young4c.mtx, from matrix
market web site.
http://math.nist.gov/MatrixMarket/data/Harwell-Boeing/acoust/young4c.html

I experienced a divergent problem, my python source is:

import numpy, scipy.io, scipy.sparse.linalg
import pyamg
from pyamg.util.linalg import norm
A = scipy.io.mmread("young4c.mtx").tocsr()
A_direct = A[:]
b = numpy.ones((A.shape[0], 1))
b_direct = b[:]
#Agg = pyamg.aggregation.standard_aggregation(A)
B = numpy.ones((A.shape[0], 1))
x0 = numpy.zeros((A.shape[0], 1))
residuals = []
ml =pyamg.smoothed_aggregation_solver(A,B,max_coarse=10)
x = ml.solve(b=b,x0=x0,tol=1e-14,residuals=residuals,accel='cg')
print ml
print "residuals[0]; residuals[-1] = ", residuals[0],"; ", residuals[-1]
print "norm(x) = ", norm(x)
x_direct = scipy.sparse.linalg.spsolve(A_direct, b_direct)
print "norm(x_direct) = ", norm(x_direct)

My output is:
$ python SpExp1_foo.py
multilevel_solver
Number of Levels: 4
Operator Complexity: 1.333
Grid Complexity: 1.206
Coarse Solver: 'pinv2'
level unknowns nonzeros
0 841 4089 [75.03%]
1 150 1212 [22.24%]
2 20 140 [ 2.57%]
3 3 9 [ 0.17%]

residuals[0]; residuals[-1] = 29.0 ; 60.5816600971
norm(x) = 0.445003361946
norm(x_direct) = 0.381460403374

Let me know whats wrong with me.

regards,

2010/7/10 Jacob <jacob.b....@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "pyamg-user" group.
> To post to this group, send email to pyamg...@googlegroups.com.
> To unsubscribe from this group, send email to pyamg-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyamg-user?hl=en.
>
>

Jacob Schroder

unread,
Jul 12, 2010, 5:08:52 PM7/12/10
to pyamg...@googlegroups.com
Hi,

It appears that the young4.mtx is complex symmetric indefinite.  Classic smoothed aggregation (and AMG for that matter) is only designed for Hermitian positive definite systems.  Using classic smoothed aggregation (as you do in your example) will typically diverge for most indefinite systems.  PyAMG has some experimental support for complex symmetric matrices right now, and it may not work for your system.

You can try constructing your smoothed_aggregation_solver(...) with these flags
mat_flag = "symmetric"
smooth = ("energy", {"SPD" : False, "maxiter" : 8}
pre_smoother=('gauss_seidel_nr', {'sweep':'symmetric'})
post_smoother=('gauss_seidel_nr', {'sweep':'symmetric'})

Then you have to use 'accel' equal to something suitable for this matrix type, like GMRES.  CG (conjugate gradient) will typically diverge for indefinite or non-Hermitian problems.

Jacob
Reply all
Reply to author
Forward
0 new messages