# Problem of equation solving after MatLoad

**URL:** <https://community.freefem.org/t/problem-of-equation-solving-after-matload/4335>\
**Category:** General Discussion\
**Created:** [July 27, 2026, 7:12am UTC](https://community.freefem.org/t/problem-of-equation-solving-after-matload/4335 "2026-07-27T07:12:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RYP](https://avatars.discourse-cdn.com/v4/letter/r/b9e5f3/32.png) [@RYP](https://community.freefem.org/u/RYP)\
**Post date:** [July 27, 2026, 7:12am UTC](https://community.freefem.org/t/problem-of-equation-solving-after-matload/4335/1 "2026-07-27T07:12:09Z")

</div>

Hi, everyone

I have recently been learning parallel programming with PETSc and encountered an issue regarding `MatLoad`. I want to use `MatLoad` to load a previously saved matrix and then solve a system of linear equations, but the results are not as expected.  
The script file has been uploaded [Matload\_test.edp](https://community.freefem.org/uploads/short-url/cYX67yEBjPjmbmWiNIuiSZbWX3r.edp) (1.7 KB) , the output in terminal reads as follows,

```auto
rhsLoadPETSc: 36
          1 0.02 0.02 0.02 0.02
        0.006666666667 0.04 0.04 0.04 0.04
        0.02 0.04 0.04 0.02 0.02
          1 1 0.04 0.04 1
        0.04 0.04 0.04 0.04 1
        0.04 0.04 0.04 0.04 0.02
          1 0.02 0.02 0.02 0.02
        0.01333333333
 solLoad: 36
          0 0 0 0 0
          0 0 0 0 0
          0 0 0 0 0
          0 0 0 0 0
          0 0 0 0 0
          0 0 0 0 0
          0 0 0 0 0
          0
 rhs[]: 27
          1 0.02 0.02 0.02 0.02
        0.006666666667 1 0.04 0.04 0.04
        0.04 0.02 1 0.04 0.04
        0.04 0.04 0.02 0.01333333333 0.02666666667
        0.04 0.04 0.02 0.01333333333 0.02666666667
        0.02 0.006666666667
 sol[]: 27
        1.000000028 1.17974331 1.319379114 1.418734878 1.477407774
        1.494145153 1.000000028 1.179797049 1.319518824 1.419076003
        1.478375806 1.497549157 1.000000028 1.179924846 1.319824538
        1.419675883 1.479470061 1.499298595 1.180076533 1.320177181
        1.420328661 1.480533087 1.500705098 1.420926489 1.481626849
        1.502453926 1.505857998

```

I wonder why all values printed from `solLoad` are zeros. Have I misunderstood something?

Best regrads

---

<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:** [July 27, 2026, 1:46pm UTC](https://community.freefem.org/t/problem-of-equation-solving-after-matload/4335/2 "2026-07-27T13:46:10Z")

</div>

I’m investigating the issue, in the meantime, please switch to `KSPSolve(MatLoadA, rhsLoadPETSc, solLoad);` (instead of `solLoad = MatLoadA^-1 * rhsLoadPETSc;`).

---

<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:** [July 27, 2026, 3:05pm UTC](https://community.freefem.org/t/problem-of-equation-solving-after-matload/4335/3 "2026-07-27T15:05:31Z")

</div>

This is fixed in [Fix missing member initialization for single-process Mat · FreeFem/FreeFem-sources@1155541 · GitHub](https://github.com/FreeFem/FreeFem-sources/commit/11555417cf0555a33b598b815fefc4803fac2451). Thank you for your report.

---

<div class="post-metadata">

**Author:** ![RYP](https://avatars.discourse-cdn.com/v4/letter/r/b9e5f3/32.png) [@RYP](https://community.freefem.org/u/RYP)\
**Post date:** [July 28, 2026, 2:19am UTC](https://community.freefem.org/t/problem-of-equation-solving-after-matload/4335/4 "2026-07-28T02:19:51Z")

</div>

> [@prj](#):
>
> KSPSolve(MatLoadA, rhsLoadPETSc, solLoad);

Thank you, Professor. It works well.
