Dear Barry,<br><br>Thank you very much for your information. I am considering to do it by myself. To the latter, if the package with PETSc can be avoided to use PetscScalar and to check this when it is built. Should it work? to my understanding, if one is using real number, PetscScalar should be "double" type generally? Thanks again.<br>
<br>Regards,<br>Yujie <br><br><div class="gmail_quote">On Fri, Jan 22, 2010 at 3:03 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
On Jan 22, 2010, at 2:57 PM, Yujie wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
In order to using PETSc with complex and real numbers, a simple method I am considering is to build PETSc with complex numbers. I can control the matrices with complex or real numbers by myself. However, I can't built PETSc with some external packages and some packages developed based on PETSc. If I want to do it successfully, do you have any advice for me? Thanks a lot.<br>
</blockquote>
<br></div>
Some external packages simply don't support complex numbers, there is nothing we can do about this. Similarly if some writes a package with PETSc if they are not careful to use PetscScalar it won't be usable with complex, again there is nothing we can do about this.<br>
<font color="#888888">
<br>
Barry</font><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Regards,<br>
Yujie<br>
<br>
On Fri, Jan 22, 2010 at 2:49 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br>
<br>
The issue is that PETSc is written in C and there are not C++ templates in C. We do not want to write TWO copies of each file, one with dcomplex everywhere and another with double everywhere and give different names to the functions in each language. It would be a pain to write and maintain and a pain to use. Who wants to write MatSolve() to solve with real numbers and MatSolveComplex() to solve with complex?<br>
<br>
C++ templates can be used to make all this possible but they are not perfect to the task. Basically we need a better language to allow easy mixing of dcomplex and double.<br>
<br>
Barry<br>
<br>
<br>
<br>
<br>
On Jan 22, 2010, at 2:43 PM, Yujie wrote:<br>
<br>
Dear Barry,<br>
<br>
What are the difficult things if PETSc is revised with matrices of complex and real numbers? It should be more flexible for a general scientific toolbox. I am curious almost all the packages don't support both simultaneously. Thanks a lot.<br>
<br>
Regards,<br>
Yujie<br>
<br>
On Fri, Jan 22, 2010 at 2:35 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br>
<br>
The way we handle complex numbered linear systems in PETSc is to compile all of PETSc with complex numbers and then just use the solvers on those complex numbers. The current drawback to this is that PETSc can only be built with support for complex numbers or for real numbers. We cannot build a PETSc where some matrices are complex and some are real.<br>
We don't have any interest in solving complex systems as larger real systems.<br>
<br>
Barry<br>
<br>
<br>
On Jan 22, 2010, at 11:04 AM, Yujie wrote:<br>
<br>
Dear PETSc Developers,<br>
<br>
Recently, I am trying to find some complex number-based solvers and preconditioners. However, it is difficult to find a general framework to include some solvers and preconditioners. Trilinos is developing a package, komplex, to use the real-number-based solver to solve complex number -based problem. I don't know whether PETSc wants to develop such the function for complex number-based problem. I think it will significantly increase the application range of PETSc. After all, in PETSc, lots of solvers and preconditioners have been developed. Thanks a lot.<br>
<br>
Regards,<br>
Yujie<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>