Solving complex symmertric indefinite matrices

41 views
Skip to first unread message

Neilen

unread,
May 9, 2011, 6:49:43 AM5/9/11
to pyamg-user
Hi,

I'm experimenting with using pyamg for solving matrices that result
from Electromagnetics problem. The matrix to be solved is composed as

A = S - k_0^2*M + 1j*k_0*Q

where S and Q are symetric positive indefinite and M is symetric
positive definite, and k_0 is a real scalar. In the simple case I'm
doing now, M, S and Q are all real, but M and S could potentially be
complex.

I initially tried using the blackbox solver

x, ml = pyamg.solve(A,b,verb=True, return_solver=True)

which states that the matrix is not symmetric. I checked, and A
definitely is symmetric. The results don't seem to compare well at all
to a direct solution either. Is this because the blackbox solver
doesn't know how to handle complex matrices?

I also tried smoothed_aggregation_solver, which doesn't seem to work
either. I think this is because the matrix is indefinite?

Is there a way to solve my matrix with pyamg?

As an aside, is there a way to get reporting like verb=True does for
the blackbox solver with the smoothed_aggregation_solver?

Thanks
Neilen

Jacob Schroder

unread,
May 11, 2011, 12:45:55 AM5/11/11
to pyamg...@googlegroups.com
Hi Neilen,

Thanks for the inquiry. The output from the blackbox solver of
"nonsymmetric" refers to your matrix not being symmetric in a
Hermitian sense, which I believe is correct. So, I apologize for the
confusing output. I just changed this in the repository so that the
latest version of the blackbox solver will output "non-Hermitian" for
your matrix.

I don't know why the blackbox solver would give worse results than a
direct method, unless the convergence tolerance isn't being satisfied.
You should try increasing "maxiter" to 600 or 700 and setting "tol"
to 1e-8 when calling pyamg.solve(...). Then make sure that the
relative residual is small after PyAMG solves the system. Also, the
code does support complex data types, so that should not be a problem.

You are correct that if you call the default
smoothed_aggregation_solver(...) on an indefinite matrix, the solver
will quite possibly diverge. However, the solver options loaded by
the blackbox solver should be robust enough to handle an indefinite
matrix. There's no guarantee that the convergence of the blackbox
solver will be fast, though.

One thing that I would recommend trying, is to post modify the solver
that you get out of the black box solver with this code

# Just generate the solver first
x, ml = pyamg.solve(A, b, maxiter=1, return_solver=True)
# Now modify the relaxation method
from pyamg.relaxation.smoothing import change_smoothers
prepost = [('gauss_seidel', {'sweep' : 'symmetric', 'iterations' : 1}),
('gauss_seidel_nr', {'sweep' : 'symmetric', 'iterations' : 2})]
change_smoothers(ml, prepost, prepost)
# Finally solve with existing_solver = ml
x = pyamg.solve(A, b, existing_solver=ml, maxiter=600, tol=1e-8)

As of now, there is not a verb=True option for
smoothed_aggregation_solver.solve(...). Perhaps, we should implement
one though.

Hopefully, this helps. If it doesn't, you could try the
adaptive_sa_solver(...) with appropriate parameters for indefinite
matrices (look to see what parameters blackbox uses in blackbox.py for
non-Hermitian matrices). Additionally, you could look at the
Helmholtz example in the Examples/ComplexSymmetric/ directory, where a
Helmholtz operator with only a real shift is solved (i.e., Q is the
zero matrix in your example).

Keep us posted,

Jacob

> --
> 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.
>
>

Reply all
Reply to author
Forward
0 new messages