Hello everyone,<br><br>I am a novice to Petsc and parallel computing. I have created a mpi sparse matrix A (size n-by-n) and a parallel vector b (size n-by-1). Now I want to modify the diagonal of A by adding the values of vector b. Namely, A(i,i) = A(i,i) + b(i) and all the off-diagonal elements remains the same. I am worrying that when I use MatSetValue or MatSetValues, b(i) may not be accessed by some particular processor since VecGetValues can only get values on the same processor. One possible solution I am thinking is converting vector b to a diagonal matrix B and then do the MatAXPY operation. However, using MatSetValue to set diagonal elements of B, B(i,i) = b(i), still faces the similar problem. Can anyone give me some suggestion? Thanks.<br>
<br>Best,<br>Xiangdong<br><br>P.S. When I compiled my program, I get warnings like that: warning: return makes pointer from integer without a cast. Actually, these lines are standard Petsc functions like that: <br><br>ierr = VecCreate(PETSC_COMM_WORLD,&x);CHKERRQ(ierr);<br>
ierr = VecDestroy(x); CHKERRQ(ierr);<br><br>How can I get rid of these warnings? <br>