<div dir="ltr">Hi all,<div><br></div><div>I am solving the max eigenvalue of a Shell matrix using SLEPc. the Shell operation is set MATOP_MULT with user-defined function u = M*f. It works with the Krylov-Schur and Arnoldi method, but fails when I use Power Iteration method and several others. This is strange, because some of those are supposed to work with any type of problem.</div><div><br></div><div>I also wrote a power iteration algorithm by myself, and it works well and obtains the same results with that from Krylov_Schur. I am curious why this doesn't work is SLEPc. The following are my code and error messages:</div><div><br></div><div>----------------------------------------------------------------------------------</div> ierr = MatSetFromOptions(M); CHKERRQ(ierr);<br> ierr = MatShellSetOperation(M,MATOP_MULT,(void(*)())_MatMult_Stokes);CHKERRQ(ierr);<br><br> ierr = PetscPrintf(PETSC_COMM_WORLD,"\n");<br> printf("--->test: n = %d, N = %d, rank = %d\n",n, N, (int)rank);<br><br><br> /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br> Create the eigensolver and set various options<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br><br> ierr = EPSCreate(PETSC_COMM_WORLD,&eps); CHKERRQ(ierr);<br> ierr = EPSSetOperators(eps,M,NULL); CHKERRQ(ierr);<br> ierr = EPSSetProblemType(eps,EPS_HEP); CHKERRQ(ierr);<br><br><br> // EPSKRYLOVSCHUR(Default)/EPSARNOLDI/<br> // does NOT work: EPSPOWER/EPSLANCZOS/EPSSUBSPACE<br> ierr = EPSSetType(eps,EPSPOWER); CHKERRQ(ierr);<br><br><br> /* Select portion of spectrum */<br><br> if(option=="smallest") // LOBPCG for smallest eigenvalue problem!<br> { ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);CHKERRQ(ierr); }<br> else if(option=="largest")<br> { ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL); CHKERRQ(ierr); }<br> else<br> { ierr = EPSSetFromOptions(eps); CHKERRQ(ierr); }<br> // end if-else<br><br><br> // Set the tolerance and maximum iteration<br> ierr = EPSSetTolerances(eps, tol, maxits); CHKERRQ(ierr);<br> ierr = PetscPrintf(PETSC_COMM_WORLD,"EPS tol = %f, maxits = %d\n",tol,maxits);CHKERRQ(ierr);<br><br><br> /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br> Solve the eigensystem and get the solution<br> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br><br> ierr = PetscPrintf(PETSC_COMM_WORLD,"EPS solve starts ...\n");CHKERRQ(ierr);<br> ierr = EPSSolve(eps);CHKERRQ(ierr);<div><br></div><div>----------------------------------------------------------------------------------<br></div><div><br></div><div><br></div><div>
<p class="p1"><span class="s1">EPS tol = 0.000001, maxits = 100</span></p>
<p class="p1"><span class="s1">EPS solve starts ...</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: Wrong value of eps->which</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: Petsc Release Version 3.5.4, May, 23, 2015 </span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: ./example-opt on a arch-darwin-c-opt named <a href="http://mcswl121.mcs.anl.gov">mcswl121.mcs.anl.gov</a> by xzhao Fri Aug 7 10:31:38 2015</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: Configure options --with-cc=gcc-4.9 --with-cxx=g++-4.9 --with-fc=gfortran-4.9 --with-cxx-dialect=C++11 --download-mpich --download-fblaslapack --download-scalapack --download-mumps --download-superlu_dist --download-hypre --download-ml --download-parmetis --download-metis --download-triangle --download-chaco --download-elemental --with-debugging=0</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: #1 EPSSetUp_Power() line 64 in /Users/xzhao/software/slepc/slepc-3.5.4/src/eps/impls/power/power.c</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: #2 EPSSetUp() line 120 in /Users/xzhao/software/slepc/slepc-3.5.4/src/eps/interface/epssetup.c</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: #3 EPSSolve() line 88 in /Users/xzhao/software/slepc/slepc-3.5.4/src/eps/interface/epssolve.c</span></p>
<p class="p1"><span class="s1">[0]PETSC ERROR: #4 compute_eigenvalue() line 318 in brownian_system.C</span></p></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>