Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-17 Thread Barry Smith
> On Oct 17, 2016, at 10:47 AM, Kong, Fande wrote: > > > > On Thu, Oct 13, 2016 at 8:21 PM, Barry Smith wrote: > > Fande, > > What SNES method are you using? If you use SNESKSPONLY I think it is ok, > it will solve for the norm minimizing least

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-17 Thread Kong, Fande
On Thu, Oct 13, 2016 at 8:21 PM, Barry Smith wrote: > > Fande, > > What SNES method are you using? If you use SNESKSPONLY I think it is > ok, it will solve for the norm minimizing least square solution during the > one KSPSolve() and then return. > The problem we are

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-17 Thread Kong, Fande
Hi Barry, Thanks so much for this work. I will checkout your branch, and take a look. Thanks again! Fande Kong, On Thu, Oct 13, 2016 at 8:10 PM, Barry Smith wrote: > > Fande, > >I have done some work, mostly understanding and documentation, on > handling singular

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-13 Thread Barry Smith
Fande, What SNES method are you using? If you use SNESKSPONLY I think it is ok, it will solve for the norm minimizing least square solution during the one KSPSolve() and then return. Yes, if you use SNESNEWTONLS or others though the SNES solver will, as you say, think that progress

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-13 Thread Barry Smith
Fande, I have done some work, mostly understanding and documentation, on handling singular systems with KSP in the branch barry/improve-matnullspace-usage. This also includes a new example that solves both a symmetric example and an example where nullspace(A) != nullspace(A')

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-13 Thread Kong, Fande
One more question. Suppose that we are solving the singular linear system Ax = b. N(A) is the null space of A, and N(A^T) is the null space of the transpose of A. The linear system is solved using SNES, that is, F(x) = Ax-b = Ax -b_r - b_n. Here b_n in N(A^T), and b_r in R(A). During each

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-13 Thread Matthew Knepley
On Thu, Oct 13, 2016 at 9:06 AM, Kong, Fande wrote: > > > On Wed, Oct 12, 2016 at 10:21 PM, Jed Brown wrote: > >> Barry Smith writes: >> > I would make that a separate routine that the users would call first. >> >> We have VecMDot

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-13 Thread Jed Brown
"Kong, Fande" writes: > On Wed, Oct 12, 2016 at 10:21 PM, Jed Brown wrote: > >> Barry Smith writes: >> > I would make that a separate routine that the users would call first. >> >> We have VecMDot and VecMAXPY. I would propose

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-13 Thread Kong, Fande
On Wed, Oct 12, 2016 at 10:21 PM, Jed Brown wrote: > Barry Smith writes: > > I would make that a separate routine that the users would call first. > > We have VecMDot and VecMAXPY. I would propose adding > > VecQR(PetscInt nvecs,Vec *vecs,PetscScalar

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Barry Smith
I also think it is best whenever possible to compute the orthonormal basis analytically rather than numerically. As Jed points out numerical orthogonalization generally does not provide full precision and that could matter. > On Oct 12, 2016, at 11:06 PM, Barry Smith

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Jed Brown
Barry Smith writes: > I would make that a separate routine that the users would call first. We have VecMDot and VecMAXPY. I would propose adding VecQR(PetscInt nvecs,Vec *vecs,PetscScalar *R); (where R can be NULL). Does anyone use the "Vecs" type? signature.asc

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Barry Smith
> On Oct 12, 2016, at 10:52 PM, Fande Kong wrote: > > > > On Wed, Oct 12, 2016 at 9:24 PM, Jed Brown wrote: > Fande Kong writes: > > > I think we need to make sure that the basis vectors are orthogonal to each > > other and they

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Jed Brown
Fande Kong writes: > I think we need to make sure that the basis vectors are orthogonal to each > other and they are normalized. Right? Yes, that is clearly stated in the man page and checked for in debug mode. The relevant code to remove the null space is if (sp->n) {

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Barry Smith
> On Oct 12, 2016, at 10:18 PM, Fande Kong wrote: > > > > On Wed, Oct 12, 2016 at 9:12 PM, Barry Smith wrote: > > > On Oct 12, 2016, at 10:00 PM, Amneet Bhalla wrote: > > > > > > > > On Monday, October 10, 2016, Barry Smith

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Fande Kong
On Wed, Oct 12, 2016 at 9:12 PM, Barry Smith wrote: > > > On Oct 12, 2016, at 10:00 PM, Amneet Bhalla > wrote: > > > > > > > > On Monday, October 10, 2016, Barry Smith wrote: > > > > > On Oct 10, 2016, at 4:01 PM, Kong, Fande

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Barry Smith
> On Oct 12, 2016, at 10:00 PM, Amneet Bhalla wrote: > > > > On Monday, October 10, 2016, Barry Smith wrote: > > > On Oct 10, 2016, at 4:01 PM, Kong, Fande wrote: > > > > Hi All, > > > > I know how to remove the null spaces

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Fande Kong
On Wed, Oct 12, 2016 at 9:00 PM, Amneet Bhalla wrote: > > > On Monday, October 10, 2016, Barry Smith wrote: > >> >> > On Oct 10, 2016, at 4:01 PM, Kong, Fande wrote: >> > >> > Hi All, >> > >> > I know how to remove the null spaces

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-12 Thread Amneet Bhalla
On Monday, October 10, 2016, Barry Smith wrote: > > > On Oct 10, 2016, at 4:01 PM, Kong, Fande > wrote: > > > > Hi All, > > > > I know how to remove the null spaces from a singular system using > creating a MatNullSpace and attaching it to

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-11 Thread Kong, Fande
Barry, I am trying to reproduce this issue using a pure PETSc code. VecLoad does not work for me. I do not know why. Anyway, I can reproduce this using a very small system. Here are some info: Mat, A Mat Object:() 2 MPI processes type: mpiaij row 0: (0, 1.) row 1: (0, -0.820827) (1, 1.51669)

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-11 Thread Barry Smith
Fande, Could you send me (petsc-ma...@mcs.anl.gov) a non symmetric matrix you have that has a different null space for A and A'. This would be one that is failing with right preconditioning. Smaller the better but whatever size you have. Run the code with -ksp_view_mat binary and send

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-11 Thread Kong, Fande
On Tue, Oct 11, 2016 at 12:18 PM, Barry Smith wrote: > > > On Oct 11, 2016, at 12:01 PM, Kong, Fande wrote: > > > > > > > > On Tue, Oct 11, 2016 at 10:39 AM, Barry Smith > wrote: > > > > > On Oct 11, 2016, at 9:33 AM, Kong, Fande

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-11 Thread Kong, Fande
On Tue, Oct 11, 2016 at 10:39 AM, Barry Smith wrote: > > > On Oct 11, 2016, at 9:33 AM, Kong, Fande wrote: > > > > Barry, Thanks so much for your explanation. It helps me a lot. > > > > On Mon, Oct 10, 2016 at 4:00 PM, Barry Smith

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-11 Thread Barry Smith
> On Oct 11, 2016, at 9:33 AM, Kong, Fande wrote: > > Barry, Thanks so much for your explanation. It helps me a lot. > > On Mon, Oct 10, 2016 at 4:00 PM, Barry Smith wrote: > > > On Oct 10, 2016, at 4:01 PM, Kong, Fande wrote: > >

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-11 Thread Kong, Fande
Barry, Thanks so much for your explanation. It helps me a lot. On Mon, Oct 10, 2016 at 4:00 PM, Barry Smith wrote: > > > On Oct 10, 2016, at 4:01 PM, Kong, Fande wrote: > > > > Hi All, > > > > I know how to remove the null spaces from a singular system

Re: [petsc-users] Algorithms to remove null spaces in a singular system

2016-10-10 Thread Barry Smith
> On Oct 10, 2016, at 4:01 PM, Kong, Fande wrote: > > Hi All, > > I know how to remove the null spaces from a singular system using creating a > MatNullSpace and attaching it to Mat. > > I was really wondering what is the philosophy behind this? The exact > algorithms we