# Changing Matrix components PETSc Parallel

**URL:** <https://community.freefem.org/t/changing-matrix-components-petsc-parallel/2367>\
**Category:** General Discussion\
**Created:** [March 30, 2023, 1:25pm UTC](https://community.freefem.org/t/changing-matrix-components-petsc-parallel/2367 "2023-03-30T13:25:58Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [April 1, 2023, 1:27pm UTC](https://community.freefem.org/t/changing-matrix-components-petsc-parallel/2367/10 "2023-04-01T13:27:46Z")

</div>

I don’t understand your code.

1. Why are you calling `metisdual()`?
2. Why are you assembling a square `Mat` (`B`) with a rectangular `matrix` (`vB`)?

> Does it mean creating a Mat B having the same number of rows as A?

No, it means creating a restricted `Mat`, i.e., a distributed `fespace` with fewer degrees of freedom.  
So if you want to mix `P2` and `P1`, you’ll need to make sure you are using the appropriate initial `Mat`.

> How can I transfer the matrix vB to Mat B?

You should not do this, `vB` is rectangular, `B` is square, that does not make sense.

I’m attaching a working [testCode.edp](https://community.freefem.org/uploads/short-url/u2jJh2OzKYTKfdVChlp5BNd5DbC.edp) (815 Bytes).

---

_[View the full topic](https://community.freefem.org/t/changing-matrix-components-petsc-parallel/2367)._
