<div dir="ltr">Dear Hong and Matthew, <br><br>I looked at the interface file for umfpack, while I did not understand all the things inside very clearly.   I just began to read petsc manual three days ago. <br><br>I guess the interface file is used to call the functions in umfpack to solve the linear system.  But the default matrix format in umfack should be csc, and I did get how the interface handle this problem. <br>

<br><br>My matrix conversion problem is generally solved. The crucial point is that you need to count the number of the non-zero entries in each row and use that information to do the preallocation. <br><br>I go forward to try some linear solvers now. <br>

<br>The matrix generated with my problem is a little poor, resulting from a mixed finite element method, asymmetric and indefinite. And the inclusion of irregular boundary makes it worse.  This is actually one reason I began with a direct solver.  <br>
<br>If you have any suggestions on solve this kinds of linear systems, please tell me. <br><br>Thank you very much. <br><br>Best Regard, <br>Kai <br><br><br><div class="gmail_quote">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Message: 3<br>
Date: Wed, 9 Nov 2011 08:44:24 -0600<br>
From: Hong Zhang &lt;<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</a>&gt;<br>
Subject: Re: [petsc-users] How to use other matrix directly in petsc?<br>
To: PETSc users list &lt;<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>&gt;<br>
Message-ID:<br>
        &lt;CAGCphBsnmj0uvTnvcWvg=<a href="mailto:TCBiNhzuiBF8CAw1p3uKZjiyE7ySw@mail.gmail.com" target="_blank">TCBiNhzuiBF8CAw1p3uKZjiyE7ySw@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
Bao:<br>
You may look at petsc-umfpack interface<br>
~petsc/src/mat/impls/aij/seq/umfpack/umfpack.c<br>
<br>
It seems umfpack use csr format, same as petsc aij format.<br>
<br>
Hong<br>
<br>
&gt; Dear all,<br>
&gt; I have been writing a serial FEM code with a direct linear solver umfpack,<br>
&gt; which is pretty easy to use. The problem is the memory required turned to be<br>
&gt; very big and I can not afford it.<br>
&gt; So I want to turn to PETSC to use ?some iterative solver.<br>
&gt; I have written the the whole matrix assembly process with?coordinates list<br>
&gt; format. The matrix can be converted to CSC format to use umfpack.<br>
&gt; When I tried to use MatSetValues to generate the Matrix for petsc, it turned<br>
&gt; out to be really slow.<br>
&gt; I am wondering if there is some?efficient?way to convert the generated<br>
&gt; matrix ( with COO, or CSC, or even CSR ) properly to make it usable for<br>
&gt; PETSC.<br>
&gt; Since the code at the moment is serial, the methods working for serial petsc<br>
&gt; will be OK.<br>
&gt; And I do many matrix manipulation( some may not easy with petsc) during the<br>
&gt; matrix assembly, so I do not want to rewrite the whole assembling process<br>
&gt; with petsc at the moment.<br>
&gt; I just want to convert the matrix generated to the format the petsc can use.<br>
&gt; It can save much time.<br>
&gt; Thank you very much.<br>
&gt;<br>
&gt; Best Regards,<br>
&gt; Kai<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
</blockquote></div><br></div>