[petsc-users] Nonconforming object sizes ERROR

Barry Smith bsmith at mcs.anl.gov
Wed Nov 12 15:06:28 CST 2014


  Oh, right CG only works for square matrices.

  I think you should be using lsqr. See http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPLSQR.html Note if you want to use preconditioning you need to pass for the second matrix the product of the transpose of the matrix times the matrix.

  There is also KSPCGNE but the docs say, I don't know why, that one should use lsqr for least squares problems.

  Basically our current support for overdetermined systems is not great and we need help.

  Barry

> On Nov 12, 2014, at 2:46 PM, Brian Yang <brianyang1106 at gmail.com> wrote:
> 
> Thank you for the prompt response. I checked and my usage of KSPSolve is correct.
> 
> Besides, the assertion line is:
> if (mat->rmap->N != y->map->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Mat mat,Vec y: global dim %D %D",mat->rmap->N,y->map->N);
> 
> On Wed, Nov 12, 2014 at 2:29 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>   The calling sequence for KSPSolve is KSPSolve(KSP ksp,Vec b,Vec x),  perhaps you have the b and the x backwards in your call?
> 
>   Barry
> 
> > On Nov 12, 2014, at 2:23 PM, Brian Yang <brianyang1106 at gmail.com> wrote:
> >
> > Hi,
> >
> > I am solving an over-determined linear system Ax=b and b=0.
> >
> > A size: 296856 x 14430
> > x (non-zero guess): 14430
> > b (zero): 296856
> >
> > All of them are using seq mode to create, so one node will solve this. However I got this error:
> >
> > [0]PETSC ERROR: Nonconforming object sizes!
> > [0]PETSC ERROR: Mat mat,Vec y: global dim 296856 14430!
> >
> > [0]PETSC ERROR: ------------------------------------------------------------------------
> > [0]PETSC ERROR: MatMult() line 2171 in src/mat/interface/matrix.c
> > [0]PETSC ERROR: KSP_MatMult() line 204 in src/ksp/ksp/impls/cg//datadb/raafat/src/petsc-3.4.3/include/petsc-private/kspimpl.h
> > [0]PETSC ERROR: KSPSolve_CG() line 132 in src/ksp/ksp/impls/cg/cg.c
> > [0]PETSC ERROR: KSPSolve() line 441 in src/ksp/ksp/interface/itfunc.c
> >
> >
> > Any restrictions here or I misunderstood something? Thanks!
> >
> > --
> > Brian Yang
> > U of Houston
> >
> >
> >
> 
> 
> 
> 
> -- 
> Brian Yang
> U of Houston
> 
> 
> 



More information about the petsc-users mailing list