Thanks Barry, Now I get this:
[0]PETSC ERROR: --------------------- Error Message ---------------------------- -------- [0]PETSC ERROR: No support for this operation for this object type! [0]PETSC ERROR: Mat type shell! [0]PETSC ERROR: ---------------------------------------------------------------- -------- [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20 14:26:37 CST 20 10 [0]PETSC ERROR: See docs/changes/index.html for recent updates. [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. [0]PETSC ERROR: See docs/index.html for manual pages. [0]PETSC ERROR: ---------------------------------------------------------------- -------- [0]PETSC ERROR: test.exe on a cygwin -cx named MT0. by Unknown Mon Jun 27 16:30:42 2011 [0]PETSC ERROR: Libraries linked from /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-de bug/lib [0]PETSC ERROR: Configure run at Fri Mar 4 10:10:06 2011 [0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-fc="win32fe ifor t" --with-cxx="win32fe cl" --with-windows-graphics=0 --download-f-blas-lapack=1 --with-precision=double --with-scalar-type=complex --with-clanguage=cxx --with-m pi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include --with-mpi-lib="[/cygdrive/d/Dev /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife c.lib]" --useThreads=0 --useThreads=0 [0]PETSC ERROR: ---------------------------------------------------------------- -------- [0]PETSC ERROR: MatNorm() line 4512 in src/mat/interface/D:\dev\PETSC-3.1-P\src\mat\INTERF~1\matrix.c On 27.06.2011 16:32, Barry Smith wrote: > You should pass H as third argument to KSPSetOperators() as well as the > second. > > Barry > > On Jun 27, 2011, at 9:23 AM, Alexander Grayver wrote: > >> Hello! >> >> I'm using matrix-free formulation and KSPLSQR to solve normal equations >> system: >> >> (A'*A)b = -g >> >> I managed to write all necessary code: >> >> call MatCreateShell(MPI_COMM_WORLD,m,N,N,N,PETSC_NULL_INTEGER,H,ierr) >> call MatShellSetOperation(H,MATOP_MULT,MFMatMult,ierr) >> >> call KSPCreate(MPI_COMM_WORLD,ksp,ierr);CHKERRQ(ierr) >> call KSPSetType(ksp,KSPLSQR,ierr);CHKERRQ(ierr) >> call KSPGetPC(ksp,pc,ierr);CHKERRQ(ierr) >> call PCSetType(pc,PCNONE,ierr);CHKERRQ(ierr) >> call >> KSPSetOperators(ksp,H,PETSC_NULL_OBJECT,SAME_PRECONDITIONER,ierr);CHKERRQ(ierr) >> call KSPSolve(ksp,g,b,ierr);CHKERRQ(ierr) >> >> >> but fail in KSPSolve stage with that: >> [0]PETSC ERROR: --------------------- Error Message >> ---------------------------- >> -------- >> [0]PETSC ERROR: Object is in wrong state! >> [0]PETSC ERROR: Mat object's type is not set: Argument # 1! >> [0]PETSC ERROR: >> ---------------------------------------------------------------- >> -------- >> [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20 14:26:37 >> CST 20 >> 10 >> [0]PETSC ERROR: See docs/changes/index.html for recent updates. >> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. >> [0]PETSC ERROR: See docs/index.html for manual pages. >> [0]PETSC ERROR: >> ---------------------------------------------------------------- >> -------- >> [0]PETSC ERROR: test.exe on a cygwin >> -cx named MT0. by Unknown Mon Jun 27 16:18:43 2011 >> [0]PETSC ERROR: Libraries linked from >> /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-de >> bug/lib >> [0]PETSC ERROR: Configure run at Fri Mar 4 10:10:06 2011 >> [0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-fc="win32fe >> ifor >> t" --with-cxx="win32fe cl" --with-windows-graphics=0 >> --download-f-blas-lapack=1 >> --with-precision=double --with-scalar-type=complex --with-clanguage=cxx >> --with-m >> pi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include >> --with-mpi-lib="[/cygdrive/d/Dev >> /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife >> c.lib]" --useThreads=0 --useThreads=0 >> [0]PETSC ERROR: >> ---------------------------------------------------------------- >> -------- >> [0]PETSC ERROR: MatNorm() line 4507 in >> src/mat/interface/D:\dev\PETSC-3.1-P\src\mat\INTERF~1\matrix.c >> [0]PETSC ERROR: KSPSolve_LSQR() line 90 in >> src/ksp/ksp/impls/lsqr/D:\dev\PETSC-3.1-P\src\ksp\ksp\impls\lsqr\lsqr.c >> >> Any suggestions? Do I have to set MATOP_NORM operation? Then how? >> >> Regards, >> Alexander
