Re: [petsc-users] using real and complex together

2020-09-28 Thread Jed Brown
Matthew Knepley writes: >> What do you mean? How to let mumps solve with a real matrix and a complex >> rhs? >> > > Two solves. It can be one solve with two right-hand sides, which should cost about the same as a solve with one right-hand side (because solves are memory bandwidth-limited on t

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
;>>>>>>> explain below. >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>>> I still need to understand how MatRealPart works. Does it >>>>>>>&g

Re: [petsc-users] using real and complex together

2020-09-28 Thread Junchao Zhang
t;>>>>>>> allocate and store them. Thus you cannot talk about just the >>>>>>>>>>>> memory to >>>>>>>>>>>> store imaginar

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
>>>>> image memory? >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> When we have complex values, we use the "complex" type to >>>>>>>>>>>>

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
parts of all the matrix elements >>>>>>>>>>> to zero. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> If my input matrix A is real, how do I create a shell matrix to >>>&g

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
to >>>>>>>>>>> matrix -vector multiplication y=A*x where A is real, PestcScalar = >>>>>>>>>>> complex, >>>>>>>>>>> x and y are Vec? I notice there is a VecRealPart but it seems it >>>>>>>>>>> just zeros >>>>>>

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
>>>>>>>>>> you comment on it? >>>>>>>>>> >>>>>>>>> >>>>>>>>> What you suggest would mean rewriting the matrix multiplication >>>>>>>>> algorit

Re: [petsc-users] using real and complex together

2020-09-28 Thread Randall Mackie
e. real > and imaginary part) > > >> On May 26, 2020, at 11:28 PM, Sam Guo > <mailto:sam@cd-adapco.com>> wrote: >> >> complex version is needed since matrix sometimes is real and sometimes is >> complex. I want to solve real matrix with

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
y really your >>>>>>>> limiting factor? Even if you tried to do this with templates, the >>>>>>>> memory >>>>>>>> from temporaries would be very hard to control. >>&

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
rix multiplication >>>>>>>> algorithm by hand after extracting the values. I am not sure if this >>>>>>>> is really what you want to do. Is the matrix memory really your >>>>>>>> limiting factor? Even if you tried to do this with templates, the >>>>>>>> memory >>&g

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
t;>>>> >>>>>>>> Thanks, >>>>>>>> Sam >>>>>>>> >>>>>>>> PetscScalar *px = nullptr; >>>>>>>> VecGetArrayRead(x, &px); >>>>

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
localSize); >>>>>>> std::vector realX(localSize); // I am using c++ to call >>>>>>> PETSc >>>>>>> >>>>>>> //retrieve real part >>>>>>> for(int i = 0; i < localSize; i++) realX[i] = PetscRealPa

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
gt;>>>>> >>>>>> //retrieve real part >>>>>> for(int i = 0; i < localSize; i++) realX[i] = PetscRealPart(px[i]); >>>>>> >>>>>> // do real matrix-vector multiplication >>>>>> // realY=A*realX &

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
;py); >>>>> >>>>> On Tue, May 26, 2020 at 1:49 PM Sam Guo wrote: >>>>> >>>>>> Thanks >>>>>> >>>>>> On Tuesday, May 26, 2020, Stefano Zampini >>>>>> wrote: >>>>>&g

Re: [petsc-users] using real and complex together

2020-09-28 Thread Barry Smith
ry >> part((except eigen pairs). >> >> On Tuesday, May 26, 2020, Zhang, Hong > <mailto:hzh...@mcs.anl.gov>> wrote: >> You can build PETSc with complex version, and declare some variables as >> 'PETSC_REAL'. >> Hong >> >> From:

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
ay 26, 2020, Stefano Zampini >>>>> wrote: >>>>> >>>>>> All the solvers/matrices/vectors works for PetscScalar types (i.e. in >>>>>> your case complex) >>>>>> If you need to solve for the real part only, you can duplicate the >>

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
;>>> On Tuesday, May 26, 2020, Stefano Zampini >>>>> wrote: >>>>> >>>>>> All the solvers/matrices/vectors works for PetscScalar types (i.e. in >>>>>> your case complex) >>>>>> If you need to solve for the re

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
e solve >>>>> will always run in the complex space >>>>> You should not be worried about doubling the memory for a matrix (i.e. >>>>> real and imaginary part) >>>>> >>>>> >>>>> On May

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
d not be worried about doubling the memory for a matrix (i.e. >>>> real and imaginary part) >>>> >>>> >>>> On May 26, 2020, at 11:28 PM, Sam Guo wrote: >>>> >>>> complex version is needed since matrix sometimes is real and sometim

Re: [petsc-users] using real and complex together

2020-09-28 Thread Matthew Knepley
ometimes >>> is complex. I want to solve real matrix without allocating memory for >>> imaginary part((except eigen pairs). >>> >>> On Tuesday, May 26, 2020, Zhang, Hong wrote: >>> >>>> You can build PETSc with complex version, and declare some variables >>>> as &

Re: [petsc-users] using real and complex together

2020-09-28 Thread Sam Guo
ry part((except eigen pairs). >> >> On Tuesday, May 26, 2020, Zhang, Hong wrote: >> >>> You can build PETSc with complex version, and declare some variables as >>> 'PETSC_REAL'. >>> Hong >>> >>> ------

Re: [petsc-users] using real and complex together

2020-05-26 Thread Sam Guo
gt; Hong >> >> -- >> *From:* petsc-users on behalf of Sam >> Guo >> *Sent:* Tuesday, May 26, 2020 1:00 PM >> *To:* PETSc >> *Subject:* [petsc-users] using real and complex together >> >> Dear PETSc dev team, >>Can I use both real and complex versions together? >> >> Thanks, >> Sam >> > >

Re: [petsc-users] using real and complex together

2020-05-26 Thread Stefano Zampini
..@mcs.anl.gov>> on behalf of Sam Guo > mailto:sam@cd-adapco.com>> > Sent: Tuesday, May 26, 2020 1:00 PM > To: PETSc mailto:petsc-users@mcs.anl.gov>> > Subject: [petsc-users] using real and complex together > > Dear PETSc dev team, >Can I use both real and complex versions together? > > Thanks, > Sam

Re: [petsc-users] using real and complex together

2020-05-26 Thread Jacob Faibussowitsch
gt; > From: petsc-users <mailto:petsc-users-boun...@mcs.anl.gov>> on behalf of Sam Guo > mailto:sam@cd-adapco.com>> > Sent: Tuesday, May 26, 2020 1:00 PM > To: PETSc mailto:petsc-users@mcs.anl.gov>> > Subject: [petsc-users] using real and complex together > > Dear PETSc dev team, >Can I use both real and complex versions together? > > Thanks, > Sam

Re: [petsc-users] using real and complex together

2020-05-26 Thread Sam Guo
les as > 'PETSC_REAL'. > Hong > > -- > *From:* petsc-users on behalf of Sam > Guo > *Sent:* Tuesday, May 26, 2020 1:00 PM > *To:* PETSc > *Subject:* [petsc-users] using real and complex together > > Dear PETSc dev team, >

Re: [petsc-users] using real and complex together

2020-05-26 Thread Zhang, Hong via petsc-users
You can build PETSc with complex version, and declare some variables as 'PETSC_REAL'. Hong From: petsc-users on behalf of Sam Guo Sent: Tuesday, May 26, 2020 1:00 PM To: PETSc Subject: [petsc-users] using real and complex together Dear PETSc dev te

[petsc-users] using real and complex together

2020-05-26 Thread Sam Guo
Dear PETSc dev team, Can I use both real and complex versions together? Thanks, Sam