[petsc-users] R: Re: Load real matrix in complex PETSc build.
stefano.pedraglio at libero.it
stefano.pedraglio at libero.it
Tue May 5 06:41:33 CDT 2015
Hallo
Thank you for your fast answer. I think I did what you meant with this script.
from petsc4py import PETSc
import sys
import os
directory = os.path.join(os.environ['PETSC_DIR'], 'bin','pythonscripts')
sys.path.insert(0,directory)
import PetscBinaryIO
InputOutput = PetscBinaryIO.PetscBinaryIO()
K, = InputOutput.readBinaryFile('K.txt', mattype='sparse')
M, = InputOutput.readBinaryFile('M.txt', mattype='sparse')
InputOutput.complexscalars = True
InputOutput._update_dtypes()
InputOutput.writeBinaryFile('Kcomplex.txt', [K,])
InputOutput.writeBinaryFile('Mcomplex.txt', [M,])
When I try to calculate the eigensolutions with the complex matrices I find
eigenpairs a little different from those I got with the real matrices, or at
least a different part of the spectrum. In addition not all the eigenalues have
their complex conjugate. I use the same parameters.
problem type PGNHEP
shift 0
eps type EPSARPACK
spectral transform STSINVERT
Is this behaviour expected? Thank you very much.
Hallo
Stefano
>----Messaggio originale----
>Da: bsmith at mcs.anl.gov
>Data: 4-mag-2015 21.40
>A: "stefano.pedraglio at libero.it"<stefano.pedraglio at libero.it>
>Cc: <petsc-users at mcs.anl.gov>
>Ogg: Re: [petsc-users] Load real matrix in complex PETSc build.
>
>
> You should be able to do it using the PetscBinaryIO.py tools we provide in
the bin directory. Just read in the matrix as real in python and then write it
out as complex using the methods there.
>
> Barry
>
>> On May 4, 2015, at 2:34 PM, stefano.pedraglio at libero.it wrote:
>>
>> Hallo
>> I have saved a large matrix using PETSc configured with scalar type real
and I used binary viewer. I need now to compute the eigensolutions in another
program using SLEPc and I need to use a complex shift. I have configured and
compiled another PETSc and SLEPc build for complex scalars. I know it is not
possible to load a matrix saved as real when using a program configured for
complex numbers. Is there a workaround to perform this operation? Maybe saving
and loading in some other format the matrix or using a different library for
eigenvalue computation. Thank you for any suggestion.
>>
>> Hallo
>> Stefano
>
>
More information about the petsc-users
mailing list