Save a FreeFEM Matrix in Python format

Hello all,

I would like to know how to save a FreeFEM matrix, to open it with Python ?

Now, I save my matrix like this:

string MatrixAglobal="Aglobal.txt";
ofstream saveA(MatrixAglobal);
saveA << Aglobal << endl;

And when I am trying to open it with Python:

import numpy as np
data=np.load('Aglobal.txt')

I get this error:

ValueError: Cannot load file containing pickled data when allow_pickle=False

Thank you,

Best regards,

Loïc,

Use a PETSc Mat and then use petsc4py in your Python script.