MatSetValue() takes a PetscScalar, but you declared s as PetscInt.<br><br>  Matt<br><br><div class="gmail_quote">On Tue, Mar 3, 2009 at 2:51 PM, Damian Kaleta <span dir="ltr">&lt;<a href="mailto:damian.kaleta@mail.utexas.edu">damian.kaleta@mail.utexas.edu</a>&gt;</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;">Hi<br>
<br>
I have a hard time implementing very simple program using fortran. The same code works perfectly for me in C.<br>
<br>
Here is a source code:<br>
<br>
program main<br>
implicit none<br>
<br>
<br>
#include &quot;/home/damian/petsc-2.3.3-p15/include/finclude/petsc.h&quot;<br>
#include &quot;/home/damian/petsc-2.3.3-p15/include/finclude/petscpc.h&quot;<br>
#include &quot;/home/damian/petsc-2.3.3-p15/include/finclude/petscsys.h&quot;<br>
#include &quot;/home/damian/petsc-2.3.3-p15/include/finclude/petscvec.h&quot;<br>
#include &quot;/home/damian/petsc-2.3.3-p15/include/finclude/petscmat.h&quot;<br>
<br>
<br>
   PetscErrorCode::pierr<br>
   Mat::zpastp<br>
   PetscInt::s<br>
<br>
s=3<br>
<br>
call PetscInitialize(PETSC_NULL_CHARACTER,pierr)<br>
call MatCreateSeqAIJ(PETSC_COMM_SELF, 10, 10, 1, PETSC_NULL_INTEGER, zpastp, pierr)<br>
<br>
call MatSetValue(zpastp, 2, 2, s, INSERT_VALUES,pierr)<br>
<br>
call MatAssemblyBegin(zpastp,MAT_FINAL_ASSEMBLY,pierr)<br>
call MatAssemblyEnd(zpastp,MAT_FINAL_ASSEMBLY,pierr)<br>
<br>
call MatView(zpastp, PETSC_VIEWER_STDOUT_SELF, pierr)<br>
call MatDestroy(zpastp,pierr)<br>
call PetscFinalize(pierr)<br>
<br>
end<br>
<br>
<br>
and the result:<br>
[damian@utcem001 pet]$ ./ex4f<br>
row 0:<br>
row 1:<br>
row 2: (2, 1.4822e-323)<br>
row 3:<br>
row 4:<br>
row 5:<br>
row 6:<br>
row 7:<br>
row 8:<br>
row 9:<br>
<br>
why don&#39;t I get 3 ? But some number close to zero ? I build PETSc to use integers.<br>
<br>
<br>
Thanks,<br><font color="#888888">
Damian<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>