# Call PETSc matrix operator MatDiagonalSet (…)

**URL:** <https://community.freefem.org/t/call-petsc-matrix-operator-matdiagonalset/1050>\
**Category:** General Discussion\
**Created:** [June 21, 2021, 12:41pm UTC](https://community.freefem.org/t/call-petsc-matrix-operator-matdiagonalset/1050 "2021-06-21T12:41:33Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![yongxing](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/yongxing/32/3632_2.png) [@yongxing](https://community.freefem.org/u/yongxing)\
**Post date:** [July 1, 2021, 3:38pm UTC](https://community.freefem.org/t/call-petsc-matrix-operator-matdiagonalset/1050/31 "2021-07-01T15:38:08Z")

</div>

Dear Prof. Pierre Jolivet,

Your know, after solving a PDE for **u** , we can use **dx(u)** to get the derivative of **u**.

However, In the case parallel, it seems we cannot directly do so, because I found the results were different between using one processor and two processors.

Do we have to gather **(centralise) u to one processor**, compute the derivative, and then distribute the results across different processors? or there is a simple trick?

Best,  
Yongxing.

---

_[View the full topic](https://community.freefem.org/t/call-petsc-matrix-operator-matdiagonalset/1050)._
