Date: 2015-09-03T15:04:47+00:00

Actual source code: dvdtestconv.c
slepc-3.6.1 2015-09-03
Report Typos and Errors

      1: /*
      2:   SLEPc eigensolver: "davidson"

      4:   Step: test for convergence

      6:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      7:    SLEPc - Scalable Library for Eigenvalue Problem Computations
      8:    Copyright (c) 2002-2015, Universitat Politecnica de Valencia, Spain

     10:    This file is part of SLEPc.

     12:    SLEPc is free software: you can redistribute it and/or modify it under  the
     13:    terms of version 3 of the GNU Lesser General Public License as published by
     14:    the Free Software Foundation.

     16:    SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
     17:    WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
     18:    FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
     19:    more details.

     21:    You  should have received a copy of the GNU Lesser General  Public  License
     22:    along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
     23:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     24: */

     26:  #include davidson.h

     30: static PetscBool dvd_testconv_basic_0(dvdDashboard *d,PetscScalar eigvr,PetscScalar eigvi,PetscReal r,PetscReal *err)
     31: {
     32:   PetscBool conv;
     33:   PetscReal eig_norm,errest;

     36:   eig_norm = SlepcAbsEigenvalue(eigvr, eigvi);
     37:   errest = r/eig_norm;
     38:   conv = (errest <= d->tol)? PETSC_TRUE: PETSC_FALSE;
     39:   if (err) *err = errest;
     40:   PetscFunctionReturn(conv);
     41: }

     45: PetscErrorCode dvd_testconv_basic(dvdDashboard *d, dvdBlackboard *b)
     46: {

     50:   /* Setup the step */
     51:   if (b->state >= DVD_STATE_CONF) {
     52:     PetscFree(d->testConv_data);
     53:     d->testConv = dvd_testconv_basic_0;
     54:   }
     55:   return(0);
     56: }

     60: static PetscBool dvd_testconv_slepc_0(dvdDashboard *d,PetscScalar eigvr,PetscScalar eigvi,PetscReal r,PetscReal *err)
     61: {

     65:   (*d->eps->converged)(d->eps,eigvr,eigvi,r,err,d->eps->convergedctx);CHKERRABORT(PetscObjectComm((PetscObject)d->eps),ierr);
     66:   PetscFunctionReturn((*err<d->eps->tol)? PETSC_TRUE: PETSC_FALSE);
     67: }

     71: PetscErrorCode dvd_testconv_slepc(dvdDashboard *d, dvdBlackboard *b)
     72: {

     76:   /* Setup the step */
     77:   if (b->state >= DVD_STATE_CONF) {
     78:     PetscFree(d->testConv_data);
     79:     d->testConv = dvd_testconv_slepc_0;
     80:   }
     81:   return(0);
     82: }