LCOV - code coverage report
Current view: top level - eps/impls/davidson - dvdupdatev.c (source / functions) Hit Total Coverage
Test: SLEPc Lines: 209 227 92.1 %
Date: 2024-11-21 00:40:22 Functions: 9 9 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       3             :    SLEPc - Scalable Library for Eigenvalue Problem Computations
       4             :    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain
       5             : 
       6             :    This file is part of SLEPc.
       7             :    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
       8             :    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       9             : */
      10             : /*
      11             :    SLEPc eigensolver: "davidson"
      12             : 
      13             :    Step: test for restarting, updateV, restartV
      14             : */
      15             : 
      16             : #include "davidson.h"
      17             : 
      18             : typedef struct {
      19             :   PetscInt          min_size_V;        /* restart with this number of eigenvectors */
      20             :   PetscInt          plusk;             /* at restart, save plusk vectors from last iteration */
      21             :   PetscInt          mpd;               /* max size of the searching subspace */
      22             :   void              *old_updateV_data; /* old updateV data */
      23             :   PetscErrorCode    (*old_isRestarting)(dvdDashboard*,PetscBool*);  /* old isRestarting */
      24             :   Mat               oldU;              /* previous projected right igenvectors */
      25             :   Mat               oldV;              /* previous projected left eigenvectors */
      26             :   PetscInt          size_oldU;         /* size of oldU */
      27             :   PetscBool         allResiduals;      /* if computing all the residuals */
      28             : } dvdManagV_basic;
      29             : 
      30          97 : static PetscErrorCode dvd_updateV_start(dvdDashboard *d)
      31             : {
      32          97 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
      33          97 :   PetscInt        i;
      34             : 
      35          97 :   PetscFunctionBegin;
      36        1962 :   for (i=0;i<d->eps->ncv;i++) d->eigi[i] = 0.0;
      37          97 :   d->nR = d->real_nR;
      38        1962 :   for (i=0;i<d->eps->ncv;i++) d->nR[i] = 1.0;
      39          97 :   d->nX = d->real_nX;
      40        1962 :   for (i=0;i<d->eps->ncv;i++) d->errest[i] = 1.0;
      41          97 :   data->size_oldU = 0;
      42          97 :   d->nconv = 0;
      43          97 :   d->npreconv = 0;
      44          97 :   d->V_tra_s = d->V_tra_e = d->V_new_s = d->V_new_e = 0;
      45          97 :   d->size_D = 0;
      46          97 :   PetscFunctionReturn(PETSC_SUCCESS);
      47             : }
      48             : 
      49        8948 : static PetscErrorCode dvd_isrestarting_fullV(dvdDashboard *d,PetscBool *r)
      50             : {
      51        8948 :   PetscInt        l,k;
      52        8948 :   PetscBool       restart;
      53        8948 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
      54             : 
      55        8948 :   PetscFunctionBegin;
      56        8948 :   PetscCall(BVGetActiveColumns(d->eps->V,&l,&k));
      57        8948 :   restart = (k+2 > d->eps->ncv)? PETSC_TRUE: PETSC_FALSE;
      58             : 
      59             :   /* Check old isRestarting function */
      60        8948 :   if (PetscUnlikely(!restart && data->old_isRestarting)) PetscCall(data->old_isRestarting(d,&restart));
      61        8948 :   *r = restart;
      62        8948 :   PetscFunctionReturn(PETSC_SUCCESS);
      63             : }
      64             : 
      65          97 : static PetscErrorCode dvd_managementV_basic_d(dvdDashboard *d)
      66             : {
      67          97 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
      68             : 
      69          97 :   PetscFunctionBegin;
      70             :   /* Restore changes in dvdDashboard */
      71          97 :   d->updateV_data = data->old_updateV_data;
      72             : 
      73             :   /* Free local data */
      74          97 :   PetscCall(MatDestroy(&data->oldU));
      75          97 :   PetscCall(MatDestroy(&data->oldV));
      76          97 :   PetscCall(PetscFree(d->real_nR));
      77          97 :   PetscCall(PetscFree(d->real_nX));
      78          97 :   PetscCall(PetscFree(data));
      79          97 :   PetscFunctionReturn(PETSC_SUCCESS);
      80             : }
      81             : 
      82         318 : static PetscErrorCode dvd_updateV_conv_gen(dvdDashboard *d)
      83             : {
      84         318 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
      85         318 :   PetscInt        npreconv,cMT,cMTX,lV,kV,nV;
      86         318 :   Mat             Z,Z0,Q,Q0;
      87         318 :   PetscBool       t;
      88             : #if !defined(PETSC_USE_COMPLEX)
      89             :   PetscInt        i;
      90             : #endif
      91             : 
      92         318 :   PetscFunctionBegin;
      93         318 :   npreconv = d->npreconv;
      94             :   /* Constrains the converged pairs to nev */
      95             : #if !defined(PETSC_USE_COMPLEX)
      96             :   /* Tries to maintain together conjugate eigenpairs */
      97             :   for (i=0; (i + (d->eigi[i]!=0.0?1:0) < npreconv) && (d->nconv + i < d->nev); i+= (d->eigi[i]!=0.0?2:1));
      98             :   npreconv = i;
      99             : #else
     100         318 :   npreconv = PetscMax(PetscMin(d->nev-d->nconv,npreconv),0);
     101             : #endif
     102             :   /* For GHEP without B-ortho, converge all of the requested pairs at once */
     103         318 :   PetscCall(PetscObjectTypeCompare((PetscObject)d->eps->ds,DSGHEP,&t));
     104         318 :   if (t && d->nconv+npreconv<d->nev) npreconv = 0;
     105             :   /* Quick exit */
     106         318 :   if (npreconv == 0) PetscFunctionReturn(PETSC_SUCCESS);
     107             : 
     108         318 :   PetscCall(BVGetActiveColumns(d->eps->V,&lV,&kV));
     109         318 :   nV  = kV - lV;
     110         318 :   cMT = nV - npreconv;
     111             :   /* Harmonics restarts with right eigenvectors, and other with the left ones.
     112             :      If the problem is standard or hermitian, left and right vectors are the same */
     113         318 :   if (!(d->W||DVD_IS(d->sEP,DVD_EP_STD)||DVD_IS(d->sEP,DVD_EP_HERMITIAN))) {
     114             :     /* ps.Q <- [ps.Q(0:npreconv-1) ps.Z(npreconv:size_H-1)] */
     115           0 :     PetscCall(DSGetMat(d->eps->ds,DS_MAT_Q,&Q));
     116           0 :     PetscCall(DSGetMat(d->eps->ds,DS_MAT_Z,&Z));
     117           0 :     PetscCall(MatDenseGetSubMatrix(Q,0,npreconv,nV,npreconv+cMT,&Q0));
     118           0 :     PetscCall(MatDenseGetSubMatrix(Z,0,npreconv,nV,npreconv+cMT,&Z0));
     119           0 :     PetscCall(MatCopy(Z0,Q0,SAME_NONZERO_PATTERN));
     120           0 :     PetscCall(MatDenseRestoreSubMatrix(Q,&Q0));
     121           0 :     PetscCall(MatDenseRestoreSubMatrix(Z,&Z0));
     122           0 :     PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Q,&Q));
     123           0 :     PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Z,&Z));
     124             :   }
     125         318 :   if (DVD_IS(d->sEP,DVD_EP_INDEFINITE)) PetscCall(DSPseudoOrthogonalize(d->eps->ds,DS_MAT_Q,nV,d->nBds,&cMTX,d->nBds));
     126         318 :   else PetscCall(DSOrthogonalize(d->eps->ds,DS_MAT_Q,nV,&cMTX));
     127         318 :   cMT = cMTX - npreconv;
     128             : 
     129         318 :   if (d->W) {
     130          57 :     PetscCall(DSOrthogonalize(d->eps->ds,DS_MAT_Z,nV,&cMTX));
     131          57 :     cMT = PetscMin(cMT,cMTX - npreconv);
     132             :   }
     133             : 
     134             :   /* Lock the converged pairs */
     135         318 :   d->eigr+= npreconv;
     136             : #if !defined(PETSC_USE_COMPLEX)
     137             :   if (d->eigi) d->eigi+= npreconv;
     138             : #endif
     139         318 :   d->nconv+= npreconv;
     140         318 :   d->errest+= npreconv;
     141             :   /* Notify the changes in V and update the other subspaces */
     142         318 :   d->V_tra_s = npreconv;          d->V_tra_e = nV;
     143         318 :   d->V_new_s = cMT;               d->V_new_e = d->V_new_s;
     144             :   /* Remove oldU */
     145         318 :   data->size_oldU = 0;
     146             : 
     147         318 :   d->npreconv-= npreconv;
     148         318 :   PetscFunctionReturn(PETSC_SUCCESS);
     149             : }
     150             : 
     151        1240 : static PetscErrorCode dvd_updateV_restart_gen(dvdDashboard *d)
     152             : {
     153        1240 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
     154        1240 :   PetscInt        lV,kV,nV,size_plusk,size_X,cMTX,cMTY,max_restart_size;
     155        1240 :   Mat             Q,Q0,Z,Z0,U,V;
     156             : 
     157        1240 :   PetscFunctionBegin;
     158             :   /* Select size_X desired pairs from V */
     159             :   /* The restarted basis should:
     160             :      - have at least one spot to add a new direction;
     161             :      - keep converged vectors, npreconv;
     162             :      - keep at least 1 oldU direction if possible.
     163             :   */
     164        1240 :   PetscCall(BVGetActiveColumns(d->eps->V,&lV,&kV));
     165        1240 :   nV = kV - lV;
     166        1240 :   max_restart_size = PetscMax(0,PetscMin(d->eps->mpd - 1,d->eps->ncv - lV - 2));
     167        1240 :   size_X = PetscMin(PetscMin(data->min_size_V+d->npreconv,max_restart_size - (max_restart_size - d->npreconv > 1 && data->plusk > 0 && data->size_oldU > 0 ? 1 : 0)), nV);
     168             : 
     169             :   /* Add plusk eigenvectors from the previous iteration */
     170        1240 :   size_plusk = PetscMax(0,PetscMin(PetscMin(PetscMin(data->plusk,data->size_oldU),max_restart_size - size_X),nV - size_X));
     171             : 
     172        1240 :   d->size_MT = nV;
     173             :   /* ps.Q <- orth([pX(0:size_X-1) [oldU(0:size_plusk-1); 0] ]) */
     174             :   /* Harmonics restarts with right eigenvectors, and other with the left ones.
     175             :      If the problem is standard or hermitian, left and right vectors are the same */
     176        1240 :   if (!(d->W||DVD_IS(d->sEP,DVD_EP_STD)||DVD_IS(d->sEP,DVD_EP_HERMITIAN))) {
     177           0 :     PetscCall(DSGetMat(d->eps->ds,DS_MAT_Q,&Q));
     178           0 :     PetscCall(DSGetMat(d->eps->ds,DS_MAT_Z,&Z));
     179           0 :     PetscCall(MatDenseGetSubMatrix(Q,0,nV,0,size_X,&Q0));
     180           0 :     PetscCall(MatDenseGetSubMatrix(Z,0,nV,0,size_X,&Z0));
     181           0 :     PetscCall(MatCopy(Z0,Q0,SAME_NONZERO_PATTERN));
     182           0 :     PetscCall(MatDenseRestoreSubMatrix(Q,&Q0));
     183           0 :     PetscCall(MatDenseRestoreSubMatrix(Z,&Z0));
     184           0 :     PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Q,&Q));
     185           0 :     PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Z,&Z));
     186             :   }
     187        1240 :   PetscCheck(size_plusk<=0 || !DVD_IS(d->sEP,DVD_EP_INDEFINITE),PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported plusk>0 in indefinite eigenvalue problems");
     188        1240 :   if (size_plusk > 0) {
     189        1224 :     PetscCall(DSGetMat(d->eps->ds,DS_MAT_Q,&Q));
     190        1224 :     PetscCall(MatDenseGetSubMatrix(Q,0,nV,size_X,size_X+size_plusk,&Q0));
     191        1224 :     PetscCall(MatDenseGetSubMatrix(data->oldU,0,nV,0,size_plusk,&U));
     192        1224 :     PetscCall(MatCopy(U,Q0,SAME_NONZERO_PATTERN));
     193        1224 :     PetscCall(MatDenseRestoreSubMatrix(Q,&Q0));
     194        1224 :     PetscCall(MatDenseRestoreSubMatrix(data->oldU,&U));
     195        1224 :     PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Q,&Q));
     196             :   }
     197        1240 :   if (DVD_IS(d->sEP,DVD_EP_INDEFINITE)) PetscCall(DSPseudoOrthogonalize(d->eps->ds,DS_MAT_Q,size_X,d->nBds,&cMTX,d->nBds));
     198        1240 :   else PetscCall(DSOrthogonalize(d->eps->ds,DS_MAT_Q,size_X+size_plusk,&cMTX));
     199             : 
     200        1240 :   if (d->W && size_plusk > 0) {
     201             :     /* ps.Z <- orth([ps.Z(0:size_X-1) [oldV(0:size_plusk-1); 0] ]) */
     202         163 :     PetscCall(DSGetMat(d->eps->ds,DS_MAT_Z,&Z));
     203         163 :     PetscCall(MatDenseGetSubMatrix(Z,0,nV,size_X,size_X+size_plusk,&Z0));
     204         163 :     PetscCall(MatDenseGetSubMatrix(data->oldV,0,nV,0,size_plusk,&V));
     205         163 :     PetscCall(MatCopy(V,Z0,SAME_NONZERO_PATTERN));
     206         163 :     PetscCall(MatDenseRestoreSubMatrix(Z,&Z0));
     207         163 :     PetscCall(MatDenseRestoreSubMatrix(data->oldV,&V));
     208         163 :     PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Z,&Z));
     209         163 :     PetscCall(DSOrthogonalize(d->eps->ds,DS_MAT_Z,size_X+size_plusk,&cMTY));
     210         163 :     cMTX = PetscMin(cMTX, cMTY);
     211             :   }
     212        1240 :   PetscAssert(cMTX<=size_X+size_plusk,PETSC_COMM_SELF,PETSC_ERR_SUP,"Invalid number of columns to restart");
     213             : 
     214             :   /* Notify the changes in V and update the other subspaces */
     215        1240 :   d->V_tra_s = 0;                     d->V_tra_e = cMTX;
     216        1240 :   d->V_new_s = d->V_tra_e;            d->V_new_e = d->V_new_s;
     217             : 
     218             :   /* Remove oldU */
     219        1240 :   data->size_oldU = 0;
     220             : 
     221             :   /* Remove npreconv */
     222        1240 :   d->npreconv = 0;
     223        1240 :   PetscFunctionReturn(PETSC_SUCCESS);
     224             : }
     225             : 
     226       15098 : static PetscErrorCode dvd_updateV_testConv(dvdDashboard *d,PetscInt s,PetscInt pre,PetscInt e,PetscInt *nConv)
     227             : {
     228       15098 :   PetscInt        i,j,b;
     229       15098 :   PetscReal       norm;
     230       15098 :   PetscBool       conv, c;
     231       15098 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
     232             : 
     233       15098 :   PetscFunctionBegin;
     234       15098 :   if (nConv) *nConv = s;
     235       25498 :   for (i=s,conv=PETSC_TRUE;(conv || data->allResiduals) && (i < e);i+=b) {
     236             : #if !defined(PETSC_USE_COMPLEX)
     237             :     b = d->eigi[i]!=0.0?2:1;
     238             : #else
     239       10400 :     b = 1;
     240             : #endif
     241       10400 :     if (i+b-1 >= pre) PetscCall(d->calcpairs_residual(d,i,i+b));
     242             :     /* Test the Schur vector */
     243       20800 :     for (j=0,c=PETSC_TRUE;j<b && c;j++) {
     244       10400 :       norm = d->nR[i+j]/d->nX[i+j];
     245       10400 :       c = d->testConv(d,d->eigr[i+j],d->eigi[i+j],norm,&d->errest[i+j]);
     246             :     }
     247       10400 :     if (conv && c) { if (nConv) *nConv = i+b; }
     248             :     else conv = PETSC_FALSE;
     249             :   }
     250       15098 :   pre = PetscMax(pre,i);
     251             : 
     252             : #if !defined(PETSC_USE_COMPLEX)
     253             :   /* Enforce converged conjugate complex eigenpairs */
     254             :   if (nConv) {
     255             :     for (j=0;j<*nConv;j++) if (d->eigi[j] != 0.0) j++;
     256             :     if (j>*nConv) (*nConv)--;
     257             :   }
     258             : #endif
     259       15254 :   for (i=pre;i<e;i++) d->errest[i] = d->nR[i] = 1.0;
     260       15098 :   PetscFunctionReturn(PETSC_SUCCESS);
     261             : }
     262             : 
     263        7708 : static PetscErrorCode dvd_updateV_update_gen(dvdDashboard *d)
     264             : {
     265        7708 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
     266        7708 :   PetscInt        size_D,s,lV,kV,nV;
     267        7708 :   Mat             Q,Q0,Z,Z0,U,V;
     268             : 
     269        7708 :   PetscFunctionBegin;
     270             :   /* Select the desired pairs */
     271        7708 :   PetscCall(BVGetActiveColumns(d->eps->V,&lV,&kV));
     272        7708 :   nV = kV - lV;
     273        7708 :   size_D = PetscMin(PetscMin(PetscMin(d->bs,nV),d->eps->ncv-nV),nV);
     274        7708 :   if (size_D == 0) PetscFunctionReturn(PETSC_SUCCESS);
     275             : 
     276             :   /* Fill V with D */
     277        7708 :   PetscCall(d->improveX(d,d->npreconv,d->npreconv+size_D,&size_D));
     278             : 
     279             :   /* If D is empty, exit */
     280        7708 :   d->size_D = size_D;
     281        7708 :   if (size_D == 0) PetscFunctionReturn(PETSC_SUCCESS);
     282             : 
     283             :   /* Get the residual of all pairs */
     284             : #if !defined(PETSC_USE_COMPLEX)
     285             :   s = (d->eigi[0]!=0.0)? 2: 1;
     286             : #else
     287        7390 :   s = 1;
     288             : #endif
     289        7390 :   PetscCall(BVGetActiveColumns(d->eps->V,&lV,&kV));
     290        7390 :   nV = kV - lV;
     291        7390 :   PetscCall(dvd_updateV_testConv(d,s,s,data->allResiduals?nV:size_D,NULL));
     292             : 
     293             :   /* Notify the changes in V */
     294        7390 :   d->V_tra_s = 0;                 d->V_tra_e = 0;
     295        7390 :   d->V_new_s = nV;                d->V_new_e = nV+size_D;
     296             : 
     297             :   /* Save the projected eigenvectors */
     298        7390 :   if (data->plusk > 0) {
     299        7347 :     PetscCall(MatZeroEntries(data->oldU));
     300        7347 :     data->size_oldU = nV;
     301        7347 :     PetscCall(DSGetMat(d->eps->ds,DS_MAT_Q,&Q));
     302        7347 :     PetscCall(MatDenseGetSubMatrix(Q,0,nV,0,nV,&Q0));
     303        7347 :     PetscCall(MatDenseGetSubMatrix(data->oldU,0,nV,0,nV,&U));
     304        7347 :     PetscCall(MatCopy(Q0,U,SAME_NONZERO_PATTERN));
     305        7347 :     PetscCall(MatDenseRestoreSubMatrix(Q,&Q0));
     306        7347 :     PetscCall(MatDenseRestoreSubMatrix(data->oldU,&U));
     307        7347 :     PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Q,&Q));
     308        7347 :     if (d->W) {
     309        1234 :       PetscCall(MatZeroEntries(data->oldV));
     310        1234 :       PetscCall(DSGetMat(d->eps->ds,DS_MAT_Z,&Z));
     311        1234 :       PetscCall(MatDenseGetSubMatrix(Z,0,nV,0,nV,&Z0));
     312        1234 :       PetscCall(MatDenseGetSubMatrix(data->oldV,0,nV,0,nV,&V));
     313        1234 :       PetscCall(MatCopy(Z0,V,SAME_NONZERO_PATTERN));
     314        1234 :       PetscCall(MatDenseRestoreSubMatrix(Z,&Z0));
     315        1234 :       PetscCall(MatDenseRestoreSubMatrix(data->oldV,&V));
     316        1234 :       PetscCall(DSRestoreMat(d->eps->ds,DS_MAT_Z,&Z));
     317             :     }
     318             :   }
     319        7390 :   PetscFunctionReturn(PETSC_SUCCESS);
     320             : }
     321             : 
     322        8948 : static PetscErrorCode dvd_updateV_extrapol(dvdDashboard *d)
     323             : {
     324        8948 :   dvdManagV_basic *data = (dvdManagV_basic*)d->updateV_data;
     325        8948 :   PetscInt        i;
     326        8948 :   PetscBool       restart,t;
     327             : 
     328        8948 :   PetscFunctionBegin;
     329             :   /* TODO: restrict select pairs to each case */
     330        8948 :   PetscCall(d->calcpairs_selectPairs(d, data->min_size_V+d->npreconv));
     331             : 
     332             :   /* If the subspaces doesn't need restart, add new vector */
     333        8948 :   PetscCall(d->isRestarting(d,&restart));
     334        8948 :   if (!restart) {
     335        7708 :     d->size_D = 0;
     336        7708 :     PetscCall(dvd_updateV_update_gen(d));
     337             : 
     338             :     /* If no vector were converged, exit */
     339             :     /* For GHEP without B-ortho, converge all of the requested pairs at once */
     340        7708 :     PetscCall(PetscObjectTypeCompare((PetscObject)d->eps->ds,DSGHEP,&t));
     341        7708 :     if (d->nconv+d->npreconv < d->nev && (t || d->npreconv == 0)) PetscFunctionReturn(PETSC_SUCCESS);
     342             :   }
     343             : 
     344             :   /* If some eigenpairs were converged, lock them  */
     345        1558 :   if (d->npreconv > 0) {
     346         318 :     i = d->npreconv;
     347         318 :     PetscCall(dvd_updateV_conv_gen(d));
     348             : 
     349             :     /* If some eigenpair was locked, exit */
     350         318 :     if (i > d->npreconv) PetscFunctionReturn(PETSC_SUCCESS);
     351             :   }
     352             : 
     353             :   /* Else, a restarting is performed */
     354        1240 :   PetscCall(dvd_updateV_restart_gen(d));
     355        1240 :   PetscFunctionReturn(PETSC_SUCCESS);
     356             : }
     357             : 
     358         291 : PetscErrorCode dvd_managementV_basic(dvdDashboard *d,dvdBlackboard *b,PetscInt bs,PetscInt mpd,PetscInt min_size_V,PetscInt plusk,PetscBool harm,PetscBool allResiduals)
     359             : {
     360         291 :   dvdManagV_basic *data;
     361             : #if !defined(PETSC_USE_COMPLEX)
     362             :   PetscBool       her_probl,std_probl;
     363             : #endif
     364             : 
     365         291 :   PetscFunctionBegin;
     366             :   /* Setting configuration constrains */
     367             : #if !defined(PETSC_USE_COMPLEX)
     368             :   /* if the last converged eigenvalue is complex its conjugate pair is also
     369             :      converged */
     370             :   her_probl = DVD_IS(d->sEP,DVD_EP_HERMITIAN)? PETSC_TRUE: PETSC_FALSE;
     371             :   std_probl = DVD_IS(d->sEP,DVD_EP_STD)? PETSC_TRUE: PETSC_FALSE;
     372             :   b->max_size_X = PetscMax(b->max_size_X,bs+((her_probl && std_probl)?0:1));
     373             : #else
     374         291 :   b->max_size_X = PetscMax(b->max_size_X,bs);
     375             : #endif
     376             : 
     377         291 :   b->max_size_V = PetscMax(b->max_size_V,mpd);
     378         291 :   min_size_V = PetscMin(min_size_V,mpd-bs);
     379         291 :   b->size_V = PetscMax(b->size_V,b->max_size_V+b->max_size_P+b->max_nev);
     380         291 :   b->max_size_oldX = plusk;
     381             : 
     382             :   /* Setup the step */
     383         291 :   if (b->state >= DVD_STATE_CONF) {
     384          97 :     PetscCall(PetscNew(&data));
     385          97 :     data->mpd = b->max_size_V;
     386          97 :     data->min_size_V = min_size_V;
     387          97 :     d->bs = bs;
     388          97 :     data->plusk = plusk;
     389          97 :     data->allResiduals = allResiduals;
     390             : 
     391          97 :     d->eigr = d->eps->eigr;
     392          97 :     d->eigi = d->eps->eigi;
     393          97 :     d->errest = d->eps->errest;
     394          97 :     PetscCall(PetscMalloc1(d->eps->ncv,&d->real_nR));
     395          97 :     PetscCall(PetscMalloc1(d->eps->ncv,&d->real_nX));
     396          97 :     if (plusk > 0) PetscCall(MatCreateSeqDense(PETSC_COMM_SELF,d->eps->ncv,d->eps->ncv,NULL,&data->oldU));
     397           2 :     else data->oldU = NULL;
     398          97 :     if (harm && plusk>0) PetscCall(MatCreateSeqDense(PETSC_COMM_SELF,d->eps->ncv,d->eps->ncv,NULL,&data->oldV));
     399          76 :     else data->oldV = NULL;
     400             : 
     401          97 :     data->old_updateV_data = d->updateV_data;
     402          97 :     d->updateV_data = data;
     403          97 :     data->old_isRestarting = d->isRestarting;
     404          97 :     d->isRestarting = dvd_isrestarting_fullV;
     405          97 :     d->updateV = dvd_updateV_extrapol;
     406          97 :     d->preTestConv = dvd_updateV_testConv;
     407          97 :     PetscCall(EPSDavidsonFLAdd(&d->startList,dvd_updateV_start));
     408          97 :     PetscCall(EPSDavidsonFLAdd(&d->destroyList,dvd_managementV_basic_d));
     409             :   }
     410         291 :   PetscFunctionReturn(PETSC_SUCCESS);
     411             : }

Generated by: LCOV version 1.14