# convert matrix to petsc
from petsc4py import PETSc
fullA = self.fullA.tocsr()
fullE = self.fullE.tocsc()
fullAT = self.fullA.T.tocsr()
fullET = self.fullE.T.tocsc()
fullApetsc = PETSc.Mat().createAIJ(size=fullA.shape, csr=(fullA.indptr, fullA.indices, fullA.data))
fullEpetsc = PETSc.Mat().createAIJ(size=fullE.shape, csr=(fullE.indptr, fullE.indices, fullE.data))
fullATpetsc = PETSc.Mat().createAIJ(size=fullAT.shape, csr=(fullAT.indptr, fullAT.indices, fullAT.data))
fullETpetsc = PETSc.Mat().createAIJ(size=fullET.shape, csr=(fullET.indptr, fullET.indices, fullET.data))
fullApetsc.assemble()
fullEpetsc.assemble()
fullATpetsc.assemble()
fullETpetsc.assemble()
the way from scipy to petsc