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: [email protected]
>Data: 4-mag-2015 21.40
>A: "[email protected]"<[email protected]>
>Cc: <[email protected]>
>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, [email protected] 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
>
>