[petsc-users] Matrix exponential

Jose E. Roman jroman at dsic.upv.es
Fri Sep 3 13:53:41 CDT 2021


Please always reply to the list (Reply-All), not to myself.

You should be able to convert from a scipy sparse matrix to a PETSc matrix via PETSc.Mat().createAIJWithArrays(). Don't know how if there is any example in the petsc4py documentation.

Jose


> El 3 sept 2021, a las 20:26, Paul, Sanku <paulsank at msu.edu> escribió:
> 
> Dear Jose,
> 
>    Thank you very much for your help. I have another question can we just simply pass a sparse.csr.matrix to A. For instance, if B is the sparse.csr.matrix can we do A=B.copy(). Or do I have to do it in a different way?
> 
> Best,
> Sanku
> From: Jose E. Roman <jroman at dsic.upv.es>
> Sent: Friday, September 3, 2021 2:13 PM
> To: Paul, Sanku <paulsank at msu.edu>
> Cc: petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
> Subject: Re: [petsc-users] Matrix exponential
>  
> You should either create the FN object and then
> 
> E.setFN(F)
> 
> or extract the FN object and assign to a variable
> 
> F = E.getFN()
> 
> You can see an example in $SLEPC_DIR/src/binding/slepc4py/demo/ex6.py
> 
> 
> Jose
> 
> 
> > El 3 sept 2021, a las 19:53, Paul, Sanku <paulsank at msu.edu> escribió:
> > 
> > Dear Sir/Ma'am,
> > 
> >    I am trying to use SLEPc to calculate matrix exponential in my python code but I am not getting the correct result. I have attached the code. Could you let me know what I am doing wrong. This is my first time using SLEPc. So, I would like to ask you if you could send me a tutorial on matrix exponential using SLEPc in python code.
> > 
> > Best,
> > Sanku
> > <ex2.py>



More information about the petsc-users mailing list